Skip to contentSkip to conversation

drivers/cros_ec: Make log polling period a parameter

PATCH Applied Rob Barnes 3 participants 5 messages May 7, 2024 – May 29, 2024

Subsystems (2)
lore
Share & tools
lore

Rob Barnes

author
#0 lore raw

PATCH 1/1 drivers/cros_ec: Make log polling period a parameter

Make EC log polling period a module parameter. This allows the polling period to be set via the kernel command line. Keeping the default at the current 10 second period. The optimal polling period will differ by board.

---
 drivers/platform/chrome/cros_ec_debugfs.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/platform/chrome/cros_ec_debugfs.c +6 -2
index 6bf6f0e7b597..95101b0d5227 100644
@@ -25,6 +25,10 @@
 
 #define CIRC_ADD(idx, size, value)	(((idx) + (value)) & ((size) - 1))
 
+static unsigned int log_poll_period_ms = LOG_POLL_SEC * MSEC_PER_SEC;
+module_param(log_poll_period_ms, uint, 0644);
+MODULE_PARM_DESC(log_poll_period_ms, "EC log polling period(ms)");
+
 /* waitqueue for log readers */
 static DECLARE_WAIT_QUEUE_HEAD(cros_ec_debugfs_log_wq);
 
@@ -56,7 +60,7 @@ struct cros_ec_debugfs {
 
 /*
  * We need to make sure that the EC log buffer on the UART is large enough,
- * so that it is unlikely enough to overlow within LOG_POLL_SEC.
+ * so that it is unlikely enough to overlow within log_poll_period_ms.
  */
 static void cros_ec_console_log_work(struct work_struct *__work)
 {
@@ -118,7 +122,7 @@ static void cros_ec_console_log_work(struct work_struct *__work)
 
 resched:
 	schedule_delayed_work(&debug_info->log_poll_work,
-			      msecs_to_jiffies(LOG_POLL_SEC * 1000));
+			      msecs_to_jiffies(log_poll_period_ms));
 }
 
 static int cros_ec_console_log_open(struct inode *inode, struct file *file)
Signature · 1 line
2.45.0.rc1.225.g2a3ae87e7f-goog
maintainer
#1 lore raw
Quoted 4 lines · Rob Barnes

Make EC log polling period a module parameter. This allows the polling period to be set via the kernel command line. Keeping the default at the current 10 second period. The optimal polling period will differ by board.

If you get chance for sending next version, please use title prefix "platform/chrome: cros_ec_debugfs:".

drivers/platform/chrome/cros_ec_debugfs.c static void cros_ec_console_log_work(struct work_struct *__work) · line 125

Quoted 6 lines
drivers/platform/chrome/cros_ec_debugfs.c +1 -1
@@ -118,7 +122,7 @@ static void cros_ec_console_log_work(struct work_struct *__work)
 
 resched:
 	schedule_delayed_work(&debug_info->log_poll_work,
-			      msecs_to_jiffies(LOG_POLL_SEC * 1000));
+			      msecs_to_jiffies(log_poll_period_ms));

If the value is set to 0, it works like an infinite loop on cros_ec_console_log_work(). Is it expected?

author
#2 lore raw
Quoted 12 lines · Tzung-Bi Shih
Quoted 4 lines · Rob Barnes

Make EC log polling period a module parameter. This allows the polling period to be set via the kernel command line. Keeping the default at the current 10 second period. The optimal polling period will differ by board.

If you get chance for sending next version, please use title prefix "platform/chrome: cros_ec_debugfs:".

Quoted 2 lines
(quoted diff) +0 -0
@@ -118,7 +122,7 @@ static void cros_ec_console_log_work(struct work_struct *__work)
 
Quoted 7 lines

drivers/platform/chrome/cros_ec_debugfs.c static void cros_ec_console_log_work(struct work_struct *__work) · line 125

Quoted 4 lines
drivers/platform/chrome/cros_ec_debugfs.c +1 -1
 resched:
      schedule_delayed_work(&debug_info->log_poll_work,
-                           msecs_to_jiffies(LOG_POLL_SEC * 1000));
+                           msecs_to_jiffies(log_poll_period_ms));

If the value is set to 0, it works like an infinite loop on cros_ec_console_log_work(). Is it expected?

Yes. I think this result is clear from the parameter name, "log_poll_period_ms", i.e. a developer setting this parameter to 0 would expect the EC log to be polled as fast as possible. This may be done for testing, but it wouldn't make sense in production. We could enforce an absolute minimum, but the value would be mostly a guess. Let me know if you still want a minimum enforced and if you have a recommendation on the value?

#3 lore raw
In reply to Rob Barnes
This patch was applied to chrome-platform/linux.git (for-kernelci) by Tzung-Bi Shih <[email protected]>:

Hello:

This patch was applied to chrome-platform/linux.git (for-kernelci) by Tzung-Bi Shih <[email protected]>:

Quoted 8 lines · On Tue, 7 May 2024 15:58:09 +0000 you wrote:

Make EC log polling period a module parameter. This allows the polling period to be set via the kernel command line. Keeping the default at the current 10 second period. The optimal polling period will differ by board.

[...]

Here is the summary with links:
- drivers/cros_ec: Make log polling period a parameter

    https://git.kernel.org/chrome-platform/c/7b44d5381e54

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#4 lore raw
In reply to Rob Barnes
This patch was applied to chrome-platform/linux.git (for-next) by Tzung-Bi Shih <[email protected]>:

Hello:

This patch was applied to chrome-platform/linux.git (for-next) by Tzung-Bi Shih <[email protected]>:

Quoted 8 lines · On Tue, 7 May 2024 15:58:09 +0000 you wrote:

Make EC log polling period a module parameter. This allows the polling period to be set via the kernel command line. Keeping the default at the current 10 second period. The optimal polling period will differ by board.

[...]

Here is the summary with links:
- drivers/cros_ec: Make log polling period a parameter

    https://git.kernel.org/chrome-platform/c/7b44d5381e54

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html