Browse Source

mm-drivers: hw_fence: add debug refcount to trylock

Add debugfs to query the amount of times that
inter-vm trylock needs to wakeup the svm.

Change-Id: Ic1f88319f502e652902be0d45792768cf5c5154e
Signed-off-by: Ingrid Gallardo <[email protected]>
Ingrid Gallardo 2 years ago
parent
commit
b87b258b9e

+ 3 - 0
hw_fence/include/hw_fence_drv_priv.h

@@ -191,6 +191,7 @@ struct msm_hw_fence_mem_data {
  * @create_hw_fences: boolean to continuosly create hw-fences within debugfs
  * @clients_list: list of debug clients registered
  * @clients_list_lock: lock to synchronize access to the clients list
+ * @lock_wake_cnt: number of times that driver triggers wake-up ipcc to unlock inter-vm try-lock
  */
 struct msm_hw_fence_dbg_data {
 	struct dentry *root;
@@ -204,6 +205,8 @@ struct msm_hw_fence_dbg_data {
 
 	struct list_head clients_list;
 	struct mutex clients_list_lock;
+
+	u64 lock_wake_cnt;
 };
 
 /**

+ 2 - 0
hw_fence/src/hw_fence_drv_debug.c

@@ -1003,6 +1003,8 @@ int hw_fence_debug_debugfs_register(struct hw_fence_driver_data *drv_data)
 	debugfs_create_file("hw_fence_dump_queues", 0600, debugfs_root, drv_data,
 		&hw_fence_dump_queues_fops);
 	debugfs_create_file("hw_sync", 0600, debugfs_root, NULL, &hw_sync_debugfs_fops);
+	debugfs_create_u64("hw_fence_lock_wake_cnt", 0600, debugfs_root,
+		&drv_data->debugfs_data.lock_wake_cnt);
 
 	return 0;
 }

+ 5 - 1
hw_fence/src/hw_fence_drv_utils.c

@@ -59,7 +59,11 @@ static void _unlock(struct hw_fence_driver_data *drv_data, uint64_t *lock)
 		 * SVM is in WFI state, since SVM acquire bit is set
 		 * Trigger IRQ to Wake-Up SVM Client
 		 */
-		HWFNC_DBG_LOCK("triggering ipc to unblock SVM lock_val:%d\n", lock_val);
+#if IS_ENABLED(CONFIG_DEBUG_FS)
+		drv_data->debugfs_data.lock_wake_cnt++;
+		HWFNC_DBG_LOCK("triggering ipc to unblock SVM lock_val:%d cnt:%llu\n", lock_val,
+			drv_data->debugfs_data.lock_wake_cnt);
+#endif
 		hw_fence_ipcc_trigger_signal(drv_data,
 			drv_data->ipcc_client_pid,
 			drv_data->ipcc_client_vid, 30); /* Trigger APPS Signal 30 */