* [PATCH] cpuidle: not unset the driver if it already exist
@ 2019-10-13 0:46 Zhenzhong Duan
2019-10-22 16:35 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Zhenzhong Duan @ 2019-10-13 0:46 UTC (permalink / raw)
To: linux-kernel; +Cc: rjw, daniel.lezcano, linux-pm, mtosatti, Zhenzhong Duan
__cpuidle_set_driver() check if there is an already exist driver and
unset it before return with -EBUSY. The next call will succeed as it's
just unset. This is strange as we should either keep old driver and
return -EBUSY or unset and set new driver and return 0.
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
---
drivers/cpuidle/driver.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index 80c1a83..a200304 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -74,7 +74,6 @@ static inline int __cpuidle_set_driver(struct cpuidle_driver *drv)
for_each_cpu(cpu, drv->cpumask) {
if (__cpuidle_get_cpu_driver(cpu)) {
- __cpuidle_unset_driver(drv);
return -EBUSY;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] cpuidle: not unset the driver if it already exist
2019-10-13 0:46 [PATCH] cpuidle: not unset the driver if it already exist Zhenzhong Duan
@ 2019-10-22 16:35 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2019-10-22 16:35 UTC (permalink / raw)
To: Zhenzhong Duan
Cc: Linux Kernel Mailing List, Rafael J. Wysocki, Daniel Lezcano,
Linux PM, Marcelo Tosatti
On Mon, Oct 14, 2019 at 2:43 AM Zhenzhong Duan
<zhenzhong.duan@oracle.com> wrote:
>
> __cpuidle_set_driver() check if there is an already exist driver and
> unset it before return with -EBUSY. The next call will succeed as it's
> just unset. This is strange as we should either keep old driver and
> return -EBUSY or unset and set new driver and return 0.
>
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
> ---
> drivers/cpuidle/driver.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
> index 80c1a83..a200304 100644
> --- a/drivers/cpuidle/driver.c
> +++ b/drivers/cpuidle/driver.c
> @@ -74,7 +74,6 @@ static inline int __cpuidle_set_driver(struct cpuidle_driver *drv)
> for_each_cpu(cpu, drv->cpumask) {
>
> if (__cpuidle_get_cpu_driver(cpu)) {
> - __cpuidle_unset_driver(drv);
> return -EBUSY;
> }
There is a bug here, but it needs to be fixed differently.
The function should check if any of the CPUs in the mask have a driver
(which is different from drv) already and if so return -EBUSY before
updating any cpuidle_drivers per-CPU pointers.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-22 16:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-13 0:46 [PATCH] cpuidle: not unset the driver if it already exist Zhenzhong Duan
2019-10-22 16:35 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).