From: Borislav Petkov <bp@alien8.de>
To: "Farber, Eliav" <farbere@amazon.com>
Cc: mchehab@kernel.org, tony.luck@intel.com, james.morse@arm.com,
rric@kernel.org, linux-edac@vger.kernel.org,
linux-kernel@vger.kernel.org, talel@amazon.com,
jonnyc@amazon.com, hhhawa@amazon.com, hanochu@amazon.com,
itamark@amazon.com, shellykz@amazon.com, amitlavi@amazon.com,
dkl@amazon.com
Subject: Re: [PATCH v2] edac: fix period calculation in edac_device_reset_delay_period()
Date: Fri, 30 Dec 2022 15:48:01 +0100 [thread overview]
Message-ID: <Y676ITA0tCjEo3av@zn.tnic> (raw)
In-Reply-To: <aebd2f07-674c-b848-69e7-5479d111bad1@amazon.com>
On Thu, Dec 29, 2022 at 10:17:48PM +0200, Farber, Eliav wrote:
> The one-liner below will not work. See the comment in
> edac_device_workq_setup() that explains why round is used:
Bah, right you are - there's that "optimization".
Ok, I've applied this:
---
From: Eliav Farber <farbere@amazon.com>
Date: Thu, 20 Oct 2022 12:44:58 +0000
Subject: [PATCH] EDAC/device: Fix period calculation in
edac_device_reset_delay_period()
Fix period calculation in case user sets a value of 1000. The input of
round_jiffies_relative() should be in jiffies and not in milli-seconds.
[ bp: Use the same code pattern as in edac_device_workq_setup() for
clarity. ]
Fixes: c4cf3b454eca ("EDAC: Rework workqueue handling")
Signed-off-by: Eliav Farber <farbere@amazon.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20221020124458.22153-1-farbere@amazon.com
---
drivers/edac/edac_device.c | 17 ++++++++---------
drivers/edac/edac_module.h | 2 +-
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c
index 19522c568aa5..878deb4880cd 100644
--- a/drivers/edac/edac_device.c
+++ b/drivers/edac/edac_device.c
@@ -394,17 +394,16 @@ static void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev)
* Then restart the workq on the new delay
*/
void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev,
- unsigned long value)
+ unsigned long msec)
{
- unsigned long jiffs = msecs_to_jiffies(value);
-
- if (value == 1000)
- jiffs = round_jiffies_relative(value);
-
- edac_dev->poll_msec = value;
- edac_dev->delay = jiffs;
+ edac_dev->poll_msec = msec;
+ edac_dev->delay = msecs_to_jiffies(msec);
- edac_mod_work(&edac_dev->work, jiffs);
+ /* See comment in edac_device_workq_setup() above */
+ if (edac_dev->poll_msec == 1000)
+ edac_mod_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay));
+ else
+ edac_mod_work(&edac_dev->work, edac_dev->delay);
}
int edac_device_alloc_index(void)
diff --git a/drivers/edac/edac_module.h b/drivers/edac/edac_module.h
index 763c076d96f2..47593afdc234 100644
--- a/drivers/edac/edac_module.h
+++ b/drivers/edac/edac_module.h
@@ -53,7 +53,7 @@ bool edac_stop_work(struct delayed_work *work);
bool edac_mod_work(struct delayed_work *work, unsigned long delay);
extern void edac_device_reset_delay_period(struct edac_device_ctl_info
- *edac_dev, unsigned long value);
+ *edac_dev, unsigned long msec);
extern void edac_mc_reset_delay_period(unsigned long value);
/*
--
2.35.1
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
prev parent reply other threads:[~2022-12-30 14:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-20 12:44 [PATCH v2] edac: fix period calculation in edac_device_reset_delay_period() Eliav Farber
2022-12-29 15:23 ` Borislav Petkov
2022-12-29 20:17 ` Farber, Eliav
2022-12-30 14:48 ` Borislav Petkov [this message]
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=Y676ITA0tCjEo3av@zn.tnic \
--to=bp@alien8.de \
--cc=amitlavi@amazon.com \
--cc=dkl@amazon.com \
--cc=farbere@amazon.com \
--cc=hanochu@amazon.com \
--cc=hhhawa@amazon.com \
--cc=itamark@amazon.com \
--cc=james.morse@arm.com \
--cc=jonnyc@amazon.com \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=rric@kernel.org \
--cc=shellykz@amazon.com \
--cc=talel@amazon.com \
--cc=tony.luck@intel.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