[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <173012422146.1442.7437515597289801002.tip-bot2@tip-bot2>
Date: Mon, 28 Oct 2024 14:03:41 -0000
From: "tip-bot2 for Qiuxu Zhuo" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Qiuxu Zhuo <qiuxu.zhuo@...el.com>, "Borislav Petkov (AMD)" <bp@...en8.de>,
Tony Luck <tony.luck@...el.com>, Nikolay Borisov <nik.borisov@...e.com>,
Sohil Mehta <sohil.mehta@...el.com>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: ras/core] x86/mce/mcelog: Use xchg() to get and clear the flags
The following commit has been merged into the ras/core branch of tip:
Commit-ID: 325c3376afad838eec8b9342e9e5eef270c5b184
Gitweb: https://git.kernel.org/tip/325c3376afad838eec8b9342e9e5eef270c5b184
Author: Qiuxu Zhuo <qiuxu.zhuo@...el.com>
AuthorDate: Fri, 25 Oct 2024 10:45:53 +08:00
Committer: Borislav Petkov (AMD) <bp@...en8.de>
CommitterDate: Mon, 28 Oct 2024 14:07:47 +01:00
x86/mce/mcelog: Use xchg() to get and clear the flags
Using xchg() to atomically get and clear the MCE log buffer flags,
streamlines the code and reduces the text size by 20 bytes.
$ size dev-mcelog.o.*
text data bss dec hex filename
3013 360 160 3533 dcd dev-mcelog.o.old
2993 360 160 3513 db9 dev-mcelog.o.new
No functional changes intended.
Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@...el.com>
Signed-off-by: Borislav Petkov (AMD) <bp@...en8.de>
Reviewed-by: Tony Luck <tony.luck@...el.com>
Reviewed-by: Nikolay Borisov <nik.borisov@...e.com>
Reviewed-by: Sohil Mehta <sohil.mehta@...el.com>
Link: https://lore.kernel.org/r/20241025024602.24318-2-qiuxu.zhuo@intel.com
---
arch/x86/kernel/cpu/mce/dev-mcelog.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/arch/x86/kernel/cpu/mce/dev-mcelog.c b/arch/x86/kernel/cpu/mce/dev-mcelog.c
index af44fd5..8d02323 100644
--- a/arch/x86/kernel/cpu/mce/dev-mcelog.c
+++ b/arch/x86/kernel/cpu/mce/dev-mcelog.c
@@ -264,15 +264,8 @@ static long mce_chrdev_ioctl(struct file *f, unsigned int cmd,
return put_user(sizeof(struct mce), p);
case MCE_GET_LOG_LEN:
return put_user(mcelog->len, p);
- case MCE_GETCLEAR_FLAGS: {
- unsigned flags;
-
- do {
- flags = mcelog->flags;
- } while (cmpxchg(&mcelog->flags, flags, 0) != flags);
-
- return put_user(flags, p);
- }
+ case MCE_GETCLEAR_FLAGS:
+ return put_user(xchg(&mcelog->flags, 0), p);
default:
return -ENOTTY;
}
Powered by blists - more mailing lists