lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230711074231.GD3062772@hirez.programming.kicks-ass.net>
Date:   Tue, 11 Jul 2023 09:42:31 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Kazuki Hashimoto <kazukih0205@...il.com>
Cc:     "Rafael J. Wysocki" <rafael@...nel.org>,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        Ingo Molnar <mingo@...hat.com>,
        Len Brown <len.brown@...el.com>, Pavel Machek <pavel@....cz>,
        linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
        Hector Martin <marcan@...can.st>
Subject: Re: [PATCH 1/2] cpuidle: Don't pass any values to
 cpuidle_not_available

On Tue, Jul 11, 2023 at 02:54:21PM +0900, Kazuki Hashimoto wrote:
> There's no reason to pass any values to cpuidle_not_available() as the
> function works standalone. Since we're planning to use the function in
> other places, make it so to avoid code duplication.
> 
> Signed-off-by: Kazuki Hashimoto <kazukih0205@...il.com>
> ---
>  drivers/cpuidle/cpuidle.c | 6 ++++--
>  include/linux/cpuidle.h   | 6 ++----
>  kernel/sched/idle.c       | 2 +-
>  3 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
> index 737a026ef58a..c9ba51e0fa38 100644
> --- a/drivers/cpuidle/cpuidle.c
> +++ b/drivers/cpuidle/cpuidle.c
> @@ -49,9 +49,11 @@ void disable_cpuidle(void)
>  	off = 1;
>  }
>  
> -bool cpuidle_not_available(struct cpuidle_driver *drv,
> -			   struct cpuidle_device *dev)
> +bool cpuidle_not_available(void)
>  {
> +	struct cpuidle_device *dev = cpuidle_get_device();
> +	struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
> +
>  	return off || !initialized || !drv || !dev || !dev->enabled;
>  }

It appears to me these are a lot of conditions to check *every* time we
go idle -- especially since they hardly, if ever, change.

Can't cpuidle track all this in a single global variable, preferably as
a static_key ?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ