hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I9AZFU
--------------------------------
In mpam_enable(), the enabling process is designed to be called once after all devices are probed. But if the kworker is parallel and delayed, it may be called multi times, add an atomic guard to avoid this situation.
Fixes: e4173244bdfb ("arm64/mpam: Probe supported partid/pmg ranges from devices") Signed-off-by: Wei Li liwei391@huawei.com --- arch/arm64/kernel/mpam/mpam_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/mpam/mpam_device.c b/arch/arm64/kernel/mpam/mpam_device.c index 5286fc024494..e781f6ef56da 100644 --- a/arch/arm64/kernel/mpam/mpam_device.c +++ b/arch/arm64/kernel/mpam/mpam_device.c @@ -568,6 +568,7 @@ static void mpam_enable(struct work_struct *work) unsigned long flags; struct mpam_device *dev; bool all_devices_probed = true; + static atomic_t once;
/* Have we probed all the devices? */ mutex_lock(&mpam_devices_lock); @@ -582,7 +583,7 @@ static void mpam_enable(struct work_struct *work) } mutex_unlock(&mpam_devices_lock);
- if (!all_devices_probed) + if (!(all_devices_probed && !atomic_fetch_inc(&once))) return;
mutex_lock(&mpam_devices_lock);
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/5493 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/A...
FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/5493 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/A...