mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiajun Wang <ryan1202@foxmail.com>
To: tony.luck@intel.com, bp@alien8.de
Cc: xiyou.wangcong@gmail.com, linux-edac@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] RAS/CEC: Fix decay work delay calculation
Date: Sun,  8 Nov 2026 17:52:01 +0800	[thread overview]
Message-ID: <tencent_9286255027243E5338FE93692C54FEC21D09@qq.com> (raw)

The conversion from a timer to delayed work left two issues in the
decay work scheduling.

The initial delay is passed to schedule_delayed_work() in seconds,
although the function expects jiffies. This schedules the first decay
after 86400 jiffies rather than 24 hours, or approximately 86 seconds
with CONFIG_HZ=1000. Use secs_to_jiffies() to convert the delay.

When rearming the work, cec_mod_work() passes the relative delay to
round_jiffies(), which expects an absolute expiration time. Use
round_jiffies_relative() to round the delay instead.

Fixes: 0ade0b6240c4 ("RAS/CEC: Convert the timer callback to a workqueue")

Signed-off-by: Jiajun Wang <ryan1202@foxmail.com>
---
Build-tested on x86_64 with CONFIG_RAS_CEC=y.
Not runtime-tested.

 drivers/ras/cec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c
index 15f7f043c8efd..3c61c2aa78f2e 100644
--- a/drivers/ras/cec.c
+++ b/drivers/ras/cec.c
@@ -166,7 +166,7 @@ static void cec_mod_work(unsigned long interval)
 	unsigned long iv;
 
 	iv = interval * HZ;
-	mod_delayed_work(system_percpu_wq, &cec_work, round_jiffies(iv));
+	mod_delayed_work(system_percpu_wq, &cec_work, round_jiffies_relative(iv));
 }
 
 static void cec_work_fn(struct work_struct *work)
@@ -582,7 +582,7 @@ static int __init cec_init(void)
 	}
 
 	INIT_DELAYED_WORK(&cec_work, cec_work_fn);
-	schedule_delayed_work(&cec_work, CEC_DECAY_DEFAULT_INTERVAL);
+	schedule_delayed_work(&cec_work, secs_to_jiffies(CEC_DECAY_DEFAULT_INTERVAL));
 
 	mce_register_decode_chain(&cec_nb);
 
-- 
2.56.0


                 reply	other threads:[~2026-11-08  9:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_9286255027243E5338FE93692C54FEC21D09@qq.com \
    --to=ryan1202@foxmail.com \
    --cc=bp@alien8.de \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®