提交 0d6d208b 编写于 作者: E Eliav Farber 提交者: sanglipeng

EDAC/device: Fix period calculation in edac_device_reset_delay_period()

stable inclusion
from stable-v5.10.164
commit 3ca8ef4d91ef1742fd4ec1c8827cb12677caf36f
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7T7G4

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=3ca8ef4d91ef1742fd4ec1c8827cb12677caf36f

--------------------------------

commit e8407743 upstream.

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: c4cf3b45 ("EDAC: Rework workqueue handling")
Signed-off-by: NEliav Farber <farbere@amazon.com>
Signed-off-by: NBorislav Petkov (AMD) <bp@alien8.de>
Cc: <stable@kernel.org>
Link: https://lore.kernel.org/r/20221020124458.22153-1-farbere@amazon.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Nsanglipeng <sanglipeng1@jd.com>
上级 bd9bbb3a
...@@ -424,17 +424,16 @@ static void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev) ...@@ -424,17 +424,16 @@ static void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev)
* Then restart the workq on the new delay * Then restart the workq on the new delay
*/ */
void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev, 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); edac_dev->poll_msec = msec;
edac_dev->delay = msecs_to_jiffies(msec);
if (value == 1000)
jiffs = round_jiffies_relative(value);
edac_dev->poll_msec = value;
edac_dev->delay = jiffs;
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) int edac_device_alloc_index(void)
......
...@@ -56,7 +56,7 @@ bool edac_stop_work(struct delayed_work *work); ...@@ -56,7 +56,7 @@ 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 delay);
extern void edac_device_reset_delay_period(struct edac_device_ctl_info 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); extern void edac_mc_reset_delay_period(unsigned long value);
extern void *edac_align_ptr(void **p, unsigned size, int n_elems); extern void *edac_align_ptr(void **p, unsigned size, int n_elems);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册