[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <169053107483.28540.2683617765976319627.tip-bot2@tip-bot2>
Date: Fri, 28 Jul 2023 07:57:54 -0000
From: "tip-bot2 for Michael Ellerman" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Michael Ellerman <mpe@...erman.id.au>,
Thomas Gleixner <tglx@...utronix.de>,
Zhang Rui <rui.zhang@...el.com>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: smp/core] cpu/SMT: Move smt/control simple exit cases earlier
The following commit has been merged into the smp/core branch of tip:
Commit-ID: c53361ce7d8771129c517dca529d2f2dc5bf04d1
Gitweb: https://git.kernel.org/tip/c53361ce7d8771129c517dca529d2f2dc5bf04d1
Author: Michael Ellerman <mpe@...erman.id.au>
AuthorDate: Wed, 05 Jul 2023 16:51:36 +02:00
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Fri, 28 Jul 2023 09:53:36 +02:00
cpu/SMT: Move smt/control simple exit cases earlier
Move the simple exit cases, i.e. those which don't depend on the value
written, earlier in the function. That makes it clearer that regardless of
the input those states cannot be transitioned out of.
That does have a user-visible effect, in that the error returned will
now always be EPERM/ENODEV for those states, regardless of the value
written. Previously writing an invalid value would return EINVAL even
when in those states.
Signed-off-by: Michael Ellerman <mpe@...erman.id.au>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Tested-by: Zhang Rui <rui.zhang@...el.com>
Link: https://lore.kernel.org/r/20230705145143.40545-4-ldufour@linux.ibm.com
---
kernel/cpu.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/kernel/cpu.c b/kernel/cpu.c
index e02204c..b6fe170 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -2841,6 +2841,12 @@ __store_smt_control(struct device *dev, struct device_attribute *attr,
{
int ctrlval, ret;
+ if (cpu_smt_control == CPU_SMT_FORCE_DISABLED)
+ return -EPERM;
+
+ if (cpu_smt_control == CPU_SMT_NOT_SUPPORTED)
+ return -ENODEV;
+
if (sysfs_streq(buf, "on"))
ctrlval = CPU_SMT_ENABLED;
else if (sysfs_streq(buf, "off"))
@@ -2850,12 +2856,6 @@ __store_smt_control(struct device *dev, struct device_attribute *attr,
else
return -EINVAL;
- if (cpu_smt_control == CPU_SMT_FORCE_DISABLED)
- return -EPERM;
-
- if (cpu_smt_control == CPU_SMT_NOT_SUPPORTED)
- return -ENODEV;
-
ret = lock_device_hotplug_sysfs();
if (ret)
return ret;
Powered by blists - more mailing lists