* [PATCH v3] EDAC/mc: Convert the poll period to jiffies when it is changed
@ 2026-11-24 1:21 Ahmed Abdelfattah via B4 Relay
2026-11-24 2:02 ` Qiuxu (Leo) Zhuo
0 siblings, 1 reply; 3+ messages in thread
From: Ahmed Abdelfattah via B4 Relay @ 2026-11-24 1:21 UTC (permalink / raw)
To: Borislav Petkov, Tony Luck
Cc: Qiuxu Zhuo, linux-edac, linux-kernel, Ahmed Abdelfattah
From: Ahmed Abdelfattah <me@ahmedabdelfattah.dev>
Writing edac_mc_poll_msec at run time re-arms every polled memory
controller through edac_mc_reset_delay_period(), which passes the new
value to edac_mod_work() as it is. mod_delayed_work() takes jiffies, so
the first poll after the write comes that many jiffies later, not that
many milliseconds: at HZ=300, writing 2000 puts the next poll 6.7 s
out. edac_mc_workq_function() re-arms with msecs_to_jiffies(), so only
that first poll is off.
Before commit c4cf3b454eca ("EDAC: Rework workqueue handling") this
path converted the value through edac_mc_workq_setup(), and
edac_device_reset_delay_period() still does. Convert it here as well.
All other callers of edac_mod_work() and edac_queue_work() already pass
jiffies. Name the arguments after the unit they are in: "jiffies" for
the two workqueue helpers, and "msec" for edac_mc_reset_delay_period(),
as edac_device_reset_delay_period() has it.
Fixes: c4cf3b454eca ("EDAC: Rework workqueue handling")
Signed-off-by: Ahmed Abdelfattah <me@ahmedabdelfattah.dev>
---
I noticed this while timing ie31200_edac's polls in a KVM guest: the
first poll after a write to edac_mc_poll_msec came late.
Tested on v7.4-rc3+ (4405c18c95d2) at HZ=300, with ie31200_edac bound
to a QEMU model of the Kaby Lake host bridge (a local device model, not
upstream QEMU), timing edac_mc_workq_function() with a kprobe. Without
the patch the first poll came 6.76 s after writing 2000 and 3.51 s after
writing 1000, with the polls after it every 2.13 s and 1.01 s. With the
patch the first poll comes 2.11 s and 1.02 s after the write, in line
with the ones after it. Writes below 1000 are still rejected.
---
Changes in v3:
- Dropped Qiuxu's Reviewed-by: he gave it for the one-line conversion
in v1, and v2 added the argument renames on top of that (Borislav).
- No code changes.
- Link to v2: https://patch.msgid.link/20261123-edac-mc-poll-msec-jiffies-v2-1-0407cc52556d@ahmedabdelfattah.dev
Changes in v2:
- Went through the callers of edac_mod_work() and edac_queue_work(). The
others already pass jiffies: edac_device keeps msecs_to_jiffies(msec)
in edac_dev->delay, edac_pci and the other edac_mc callers convert at
the call. So the fix is the same as in v1.
- Renamed the "delay" argument of both helpers to "jiffies" (Borislav).
The "value" in the v1 hunk is edac_mc_reset_delay_period()'s argument
and is in milliseconds, so that one is now "msec". As an argument name
"jiffies" shadows the global one, which only W=2 complains about; I
can call it something else if you prefer.
- Added Qiuxu's Reviewed-by and retested.
- Link to v1: https://patch.msgid.link/20261119-edac-mc-poll-msec-jiffies-v1-1-fe329938fa09@ahmedabdelfattah.dev
---
drivers/edac/edac_mc.c | 6 +++---
drivers/edac/edac_module.h | 6 +++---
drivers/edac/wq.c | 8 ++++----
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index fd70caa85574..6feb0809a959 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -483,12 +483,12 @@ static void edac_mc_workq_function(struct work_struct *work_req)
}
/*
- * edac_mc_reset_delay_period(unsigned long value)
+ * edac_mc_reset_delay_period(unsigned long msec)
*
* user space has updated our poll period value, need to
* reset our workq delays
*/
-void edac_mc_reset_delay_period(unsigned long value)
+void edac_mc_reset_delay_period(unsigned long msec)
{
struct mem_ctl_info *mci;
struct list_head *item;
@@ -499,7 +499,7 @@ void edac_mc_reset_delay_period(unsigned long value)
mci = list_entry(item, struct mem_ctl_info, link);
if (mci->op_state == OP_RUNNING_POLL)
- edac_mod_work(&mci->work, value);
+ edac_mod_work(&mci->work, msecs_to_jiffies(msec));
}
mutex_unlock(&mem_ctls_mutex);
}
diff --git a/drivers/edac/edac_module.h b/drivers/edac/edac_module.h
index eceef5539186..762a331a5708 100644
--- a/drivers/edac/edac_module.h
+++ b/drivers/edac/edac_module.h
@@ -48,12 +48,12 @@ extern void edac_device_remove_sysfs(struct edac_device_ctl_info *edac_dev);
/* edac core workqueue: single CPU mode */
int edac_workqueue_setup(void);
void edac_workqueue_teardown(void);
-bool edac_queue_work(struct delayed_work *work, unsigned long delay);
+bool edac_queue_work(struct delayed_work *work, unsigned long jiffies);
bool edac_stop_work(struct delayed_work *work);
-bool edac_mod_work(struct delayed_work *work, unsigned long delay);
+bool edac_mod_work(struct delayed_work *work, unsigned long jiffies);
extern void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev, unsigned int msec);
-extern void edac_mc_reset_delay_period(unsigned long value);
+extern void edac_mc_reset_delay_period(unsigned long msec);
/*
* EDAC debugfs functions
diff --git a/drivers/edac/wq.c b/drivers/edac/wq.c
index ad3f516627c5..edeb7bbd3d68 100644
--- a/drivers/edac/wq.c
+++ b/drivers/edac/wq.c
@@ -3,15 +3,15 @@
static struct workqueue_struct *wq;
-bool edac_queue_work(struct delayed_work *work, unsigned long delay)
+bool edac_queue_work(struct delayed_work *work, unsigned long jiffies)
{
- return queue_delayed_work(wq, work, delay);
+ return queue_delayed_work(wq, work, jiffies);
}
EXPORT_SYMBOL_GPL(edac_queue_work);
-bool edac_mod_work(struct delayed_work *work, unsigned long delay)
+bool edac_mod_work(struct delayed_work *work, unsigned long jiffies)
{
- return mod_delayed_work(wq, work, delay);
+ return mod_delayed_work(wq, work, jiffies);
}
EXPORT_SYMBOL_GPL(edac_mod_work);
---
base-commit: 4405c18c95d2d0f99f6c581ef0ee8591a1aa6ccd
change-id: 20261119-edac-mc-poll-msec-jiffies-fb7f926f112c
Best regards,
--
Ahmed Abdelfattah <me@ahmedabdelfattah.dev>
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH v3] EDAC/mc: Convert the poll period to jiffies when it is changed
2026-11-24 1:21 [PATCH v3] EDAC/mc: Convert the poll period to jiffies when it is changed Ahmed Abdelfattah via B4 Relay
@ 2026-11-24 2:02 ` Qiuxu (Leo) Zhuo
2026-11-24 12:01 ` Ahmed Abdelfattah
0 siblings, 1 reply; 3+ messages in thread
From: Qiuxu (Leo) Zhuo @ 2026-11-24 2:02 UTC (permalink / raw)
To: me, Borislav Petkov, Tony Luck; +Cc: linux-edac, linux-kernel
> From: Ahmed Abdelfattah via B4 Relay
> [...]
> diff --git a/drivers/edac/edac_module.h b/drivers/edac/edac_module.h index
> eceef5539186..762a331a5708 100644
> --- a/drivers/edac/edac_module.h
> +++ b/drivers/edac/edac_module.h
> @@ -48,12 +48,12 @@ extern void edac_device_remove_sysfs(struct
> edac_device_ctl_info *edac_dev);
> /* edac core workqueue: single CPU mode */ int edac_workqueue_setup(void);
> void edac_workqueue_teardown(void); -bool edac_queue_work(struct
> delayed_work *work, unsigned long delay);
> +bool edac_queue_work(struct delayed_work *work, unsigned long jiffies);
How about using delay_jiffies instead of jiffies?
This would avoid shadowing the global 'jiffies' and the associated W=2 warning.
The same applies to both the declarations and definitions.
Otherwise, this looks good to me.
Reviewed-by: Qiuxu Zhuo <qzhuo@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] EDAC/mc: Convert the poll period to jiffies when it is changed
2026-11-24 2:02 ` Qiuxu (Leo) Zhuo
@ 2026-11-24 12:01 ` Ahmed Abdelfattah
0 siblings, 0 replies; 3+ messages in thread
From: Ahmed Abdelfattah @ 2026-11-24 12:01 UTC (permalink / raw)
To: Qiuxu (Leo) Zhuo; +Cc: Borislav Petkov, Tony Luck, linux-edac, linux-kernel
On Tue, Nov 24, 2026 at 02:02:46AM +0000, Qiuxu (Leo) Zhuo wrote:
> How about using delay_jiffies instead of jiffies?
> This would avoid shadowing the global 'jiffies' and the associated W=2
> warning.
>
> The same applies to both the declarations and definitions.
Fine with me. It still says what unit the argument is in, and W=2 stays
quiet.
Boris, you asked for "jiffies" in the v1 review. Is delay_jiffies OK
with you? I will wait for your answer and send v4 with the name you
prefer.
> Otherwise, this looks good to me.
>
> Reviewed-by: Qiuxu Zhuo <qzhuo@nvidia.com>
Thanks for the review.
Ahmed
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-24 12:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-24 1:21 [PATCH v3] EDAC/mc: Convert the poll period to jiffies when it is changed Ahmed Abdelfattah via B4 Relay
2026-11-24 2:02 ` Qiuxu (Leo) Zhuo
2026-11-24 12:01 ` Ahmed Abdelfattah
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®