From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Linux PM <linux-pm@vger.kernel.org>,
Marcelo Tosatti <mtosatti@redhat.com>
Subject: Re: [PATCH] cpuidle: not unset the driver if it already exist
Date: Tue, 22 Oct 2019 18:35:31 +0200 [thread overview]
Message-ID: <CAJZ5v0iaWxu1vL08zyEfx6_Eku9yK5kh-HK4ZdbBtqZvSVd6tw@mail.gmail.com> (raw)
In-Reply-To: <1570927586-12023-1-git-send-email-zhenzhong.duan@oracle.com>
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.
prev parent reply other threads:[~2019-10-22 16:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJZ5v0iaWxu1vL08zyEfx6_Eku9yK5kh-HK4ZdbBtqZvSVd6tw@mail.gmail.com \
--to=rafael@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=rjw@rjwysocki.net \
--cc=zhenzhong.duan@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).