Jelajahi Sumber

display: msm: optimize driver debug allocations

This change uses kvzalloc to allocate memory for eventlog and register
dumps. This is needed since kernel cannot guarantee that physically
contiguous allocations greater than 32 KB will succeed.
Additionally it reduces the number of entries for evt logs and
register dumps for trusted vm.

Change-Id: I8b76e79d62850904f6445d8b66c882529ba6e9ba
Signed-off-by: Abhijit Kulkarni <[email protected]>
Abhijit Kulkarni 4 tahun lalu
induk
melakukan
b4f00361f3
3 mengubah file dengan 16 tambahan dan 6 penghapusan
  1. 2 2
      msm/sde_dbg.c
  2. 10 0
      msm/sde_dbg.h
  3. 4 4
      msm/sde_dbg_evtlog.c

+ 2 - 2
msm/sde_dbg.c

@@ -1467,7 +1467,7 @@ static ssize_t sde_recovery_regdump_read(struct file *file, char __user *ubuf,
 
 	if (!rbuf->dump_done && !rbuf->cur_blk) {
 		if (!rbuf->buf)
-			rbuf->buf = kzalloc(DUMP_BUF_SIZE, GFP_KERNEL);
+			rbuf->buf = kvzalloc(DUMP_BUF_SIZE, GFP_KERNEL);
 		if (!rbuf->buf) {
 			len =  -ENOMEM;
 			goto err;
@@ -2292,7 +2292,7 @@ static void sde_dbg_dsi_ctrl_destroy(void)
  */
 void sde_dbg_destroy(void)
 {
-	kfree(sde_dbg_base.regbuf.buf);
+	kvfree(sde_dbg_base.regbuf.buf);
 	memset(&sde_dbg_base.regbuf, 0, sizeof(sde_dbg_base.regbuf));
 	_sde_dbg_debugfs_destroy();
 	sde_dbg_base_evtlog = NULL;

+ 10 - 0
msm/sde_dbg.h

@@ -117,7 +117,13 @@ enum sde_dbg_dump_context {
  * number must be greater than print entry to prevent out of bound evtlog
  * entry array access.
  */
+
+#if IS_ENABLED(CONFIG_DRM_SDE_VM)
+#define SDE_EVTLOG_ENTRY	(SDE_EVTLOG_PRINT_ENTRY * 8)
+#else
 #define SDE_EVTLOG_ENTRY	(SDE_EVTLOG_PRINT_ENTRY * 32)
+#endif /* IS_ENABLED(CONFIG_DRM_SDE_VM) */
+
 #define SDE_EVTLOG_MAX_DATA 15
 #define SDE_EVTLOG_BUF_MAX 512
 #define SDE_EVTLOG_BUF_ALIGN 32
@@ -162,7 +168,11 @@ extern struct sde_dbg_evtlog *sde_dbg_base_evtlog;
  * number must be greater than number of possible writes in at least one
  * single commit.
  */
+#if IS_ENABLED(CONFIG_DRM_SDE_VM)
+#define SDE_REGLOG_ENTRY 256
+#else
 #define SDE_REGLOG_ENTRY 1024
+#endif /* IS_ENABLED(CONFIG_DRM_SDE_VM) */
 
 struct sde_dbg_reglog_log {
 	s64 time;

+ 4 - 4
msm/sde_dbg_evtlog.c

@@ -224,7 +224,7 @@ struct sde_dbg_evtlog *sde_evtlog_init(void)
 {
 	struct sde_dbg_evtlog *evtlog;
 
-	evtlog = kzalloc(sizeof(*evtlog), GFP_KERNEL);
+	evtlog = kvzalloc(sizeof(*evtlog), GFP_KERNEL);
 	if (!evtlog)
 		return ERR_PTR(-ENOMEM);
 
@@ -241,7 +241,7 @@ struct sde_dbg_reglog *sde_reglog_init(void)
 {
 	struct sde_dbg_reglog *reglog;
 
-	reglog = kzalloc(sizeof(*reglog), GFP_KERNEL);
+	reglog = kvzalloc(sizeof(*reglog), GFP_KERNEL);
 	if (!reglog)
 		return ERR_PTR(-ENOMEM);
 
@@ -349,7 +349,7 @@ void sde_evtlog_destroy(struct sde_dbg_evtlog *evtlog)
 		list_del(&filter_node->list);
 		kfree(filter_node);
 	}
-	kfree(evtlog);
+	kvfree(evtlog);
 }
 
 void sde_reglog_destroy(struct sde_dbg_reglog *reglog)
@@ -357,5 +357,5 @@ void sde_reglog_destroy(struct sde_dbg_reglog *reglog)
 	if (!reglog)
 		return;
 
-	kfree(reglog);
+	kvfree(reglog);
 }