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: <7d76567549f81a42bf8f944dde3528b18cb3b690.camel@amazon.com>
Date: Wed, 2 Oct 2024 22:42:59 +0000
From: "Okanovic, Haris" <harisokn@...zon.com>
To: "linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "kvm@...r.kernel.org"
	<kvm@...r.kernel.org>, "linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"ankur.a.arora@...cle.com" <ankur.a.arora@...cle.com>
CC: "joao.m.martins@...cle.com" <joao.m.martins@...cle.com>,
	"boris.ostrovsky@...cle.com" <boris.ostrovsky@...cle.com>,
	"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
	"konrad.wilk@...cle.com" <konrad.wilk@...cle.com>, "wanpengli@...cent.com"
	<wanpengli@...cent.com>, "cl@...two.org" <cl@...two.org>, "mingo@...hat.com"
	<mingo@...hat.com>, "catalin.marinas@....com" <catalin.marinas@....com>,
	"pbonzini@...hat.com" <pbonzini@...hat.com>, "tglx@...utronix.de"
	<tglx@...utronix.de>, "misono.tomohiro@...itsu.com"
	<misono.tomohiro@...itsu.com>, "daniel.lezcano@...aro.org"
	<daniel.lezcano@...aro.org>, "arnd@...db.de" <arnd@...db.de>,
	"lenb@...nel.org" <lenb@...nel.org>, "will@...nel.org" <will@...nel.org>,
	"hpa@...or.com" <hpa@...or.com>, "peterz@...radead.org"
	<peterz@...radead.org>, "maobibo@...ngson.cn" <maobibo@...ngson.cn>,
	"vkuznets@...hat.com" <vkuznets@...hat.com>, "bp@...en8.de" <bp@...en8.de>,
	"Okanovic, Haris" <harisokn@...zon.com>, "rafael@...nel.org"
	<rafael@...nel.org>, "sudeep.holla@....com" <sudeep.holla@....com>,
	"mtosatti@...hat.com" <mtosatti@...hat.com>, "x86@...nel.org"
	<x86@...nel.org>, "mark.rutland@....com" <mark.rutland@....com>
Subject: Re: [PATCH v8 11/11] arm64: support cpuidle-haltpoll

On Wed, 2024-09-25 at 16:24 -0700, Ankur Arora wrote:
> CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.
> 
> 
> 
> Add architectural support for the cpuidle-haltpoll driver by defining
> arch_haltpoll_*(). Also define ARCH_CPUIDLE_HALTPOLL to allow
> cpuidle-haltpoll to be selected.
> 
> Haltpoll uses poll_idle() to do the actual polling. This in turn
> uses smp_cond_load*() to wait until there's a specific store to
> a cacheline.
> In the edge case -- no stores to the cacheline and no interrupt --
> the event-stream provides the terminating condition ensuring we
> don't wait forever. But because the event-stream runs at a fixed
> frequency (configured at 10kHz) haltpoll might spend more time in
> the polling stage than specified by cpuidle_poll_time().
> 
> This would only happen in the last iteration, since overshooting the
> poll_limit means the governor will move out of the polling stage.
> 
> Tested-by: Haris Okanovic <harisokn@...zon.com>
> Tested-by: Misono Tomohiro <misono.tomohiro@...itsu.com>
> Signed-off-by: Ankur Arora <ankur.a.arora@...cle.com>
> ---
>  arch/arm64/Kconfig                        |  6 ++++++
>  arch/arm64/include/asm/cpuidle_haltpoll.h | 24 +++++++++++++++++++++++
>  2 files changed, 30 insertions(+)
>  create mode 100644 arch/arm64/include/asm/cpuidle_haltpoll.h
> 
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index ef9c22c3cff2..5fc99eba22b2 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -2415,6 +2415,12 @@ config ARCH_HIBERNATION_HEADER
>  config ARCH_SUSPEND_POSSIBLE
>         def_bool y
> 
> +config ARCH_CPUIDLE_HALTPOLL
> +       bool "Enable selection of the cpuidle-haltpoll driver"
> +       help
> +         cpuidle-haltpoll allows for adaptive polling based on
> +         current load before entering the idle state.
> +
>  endmenu # "Power management options"
> 
>  menu "CPU Power Management"
> diff --git a/arch/arm64/include/asm/cpuidle_haltpoll.h b/arch/arm64/include/asm/cpuidle_haltpoll.h
> new file mode 100644
> index 000000000000..91f0be707629
> --- /dev/null
> +++ b/arch/arm64/include/asm/cpuidle_haltpoll.h
> @@ -0,0 +1,24 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +
> +#ifndef _ARCH_HALTPOLL_H
> +#define _ARCH_HALTPOLL_H
> +
> +static inline void arch_haltpoll_enable(unsigned int cpu) { }
> +static inline void arch_haltpoll_disable(unsigned int cpu) { }
> +
> +static inline bool arch_haltpoll_want(bool force)
> +{
> +       /*
> +        * Enabling haltpoll requires two things:
> +        *
> +        * - Event stream support to provide a terminating condition to the
> +        *   WFE in the poll loop.
> +        *
> +        * - KVM support for arch_haltpoll_enable(), arch_haltpoll_disable().
> +        *
> +        * Given that the second is missing, only allow force loading for
> +        * haltpoll.
> +        */
> +       return force;
> +}
> +#endif
> --
> 2.43.5
> 

I applied your patches to master e32cde8d2bd7 and verified same
performance gains on AWS Graviton.

Reviewed-by: Haris Okanovic <harisokn@...zon.com>
Tested-by: Haris Okanovic <harisokn@...zon.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ