diff options
author | linyuny <linyuny@google.com> | 2023-01-04 21:50:10 +0000 |
---|---|---|
committer | Holmes Chou <holmeschou@google.com> | 2023-02-23 06:51:39 +0000 |
commit | f64b1f139af2187bd0fad7f0483551d6f3555e2b (patch) | |
tree | 2b00ac7e19633057207a277ebcd1837f9bc4d4db | |
parent | e96fdea90a99cd794fe8735ef89a4ad5d6ad8f51 (diff) | |
download | lwis-f64b1f139af2187bd0fad7f0483551d6f3555e2b.tar.gz |
LWIS: Readjust subscription thread to real time priority
Readjust subscription thread to real time priority
Bug: 263312667
Test: Manual run
Change-Id: I684844c29ba3c866d130c8c4c75ab871014035a0
Signed-off-by: linyuny <linyuny@google.com>
-rw-r--r-- | lwis_device_top.c | 19 | ||||
-rw-r--r-- | lwis_device_top.h | 3 |
2 files changed, 21 insertions, 1 deletions
diff --git a/lwis_device_top.c b/lwis_device_top.c index b2fbbc6..3175173 100644 --- a/lwis_device_top.c +++ b/lwis_device_top.c @@ -29,6 +29,12 @@ #endif #define LWIS_DRIVER_NAME "lwis-top" +#define LWIS_SUBSCRIBER_THREAD_NAME "lwis_s_top" +/* + * RT priority needed because events need to be transferred to + * another device in low latency. +*/ +#define SUBSCRIBE_THREAD_PRIORITY 99 static int lwis_top_register_io(struct lwis_device *lwis_dev, struct lwis_io_entry *entry, int access_size); @@ -511,6 +517,17 @@ static int lwis_top_device_probe(struct platform_device *plat_dev) goto error_probe; } + ret = lwis_set_kthread_priority(&top_dev->base_dev, + top_dev->subscribe_worker_thread, + SUBSCRIBE_THREAD_PRIORITY); + if (ret) { + dev_err(top_dev->base_dev.dev, + "Failed to set LWIS top subscription kthread priority (%d)", + ret); + lwis_base_unprobe(&top_dev->base_dev); + goto error_probe; + } + /* Create associated kworker threads */ ret = lwis_create_kthread_workers(&top_dev->base_dev); if (ret) { @@ -519,6 +536,8 @@ static int lwis_top_device_probe(struct platform_device *plat_dev) goto error_probe; } + dev_info(top_dev->base_dev.dev, "Top Device Probe: Success\n"); + return 0; error_probe: diff --git a/lwis_device_top.h b/lwis_device_top.h index 497cd6b..e2ef4ea 100644 --- a/lwis_device_top.h +++ b/lwis_device_top.h @@ -32,7 +32,8 @@ struct lwis_top_device { struct kthread_work subscribe_work; struct list_head emitted_event_list_work; - /* Subscription thread */ + + /* Subscription thread */ struct kthread_worker subscribe_worker; struct task_struct *subscribe_worker_thread; }; |