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: <20200720055519.GB4000@drishya.in.ibm.com>
Date:   Mon, 20 Jul 2020 11:25:19 +0530
From:   Vaidyanathan Srinivasan <svaidy@...ux.ibm.com>
To:     "Gautham R. Shenoy" <ego@...ux.vnet.ibm.com>
Cc:     Nicholas Piggin <npiggin@...il.com>,
        Anton Blanchard <anton@...abs.org>,
        Nathan Lynch <nathanl@...ux.ibm.com>,
        Michael Ellerman <mpe@...erman.id.au>,
        Michael Neuling <mikey@...ling.org>, linuxppc-dev@...abs.org,
        linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org
Subject: Re: [PATCH 1/5] cpuidle-pseries: Set the latency-hint before
 entering CEDE

* Gautham R Shenoy <ego@...ux.vnet.ibm.com> [2020-07-07 16:41:35]:

> From: "Gautham R. Shenoy" <ego@...ux.vnet.ibm.com>
> 
> As per the PAPR, each H_CEDE call is associated with a latency-hint to
> be passed in the VPA field "cede_latency_hint". The CEDE states that
> we were implicitly entering so far is CEDE with latency-hint = 0.
> 
> This patch explicitly sets the latency hint corresponding to the CEDE
> state that we are currently entering. While at it, we save the
> previous hint, to be restored once we wakeup from CEDE. This will be
> required in the future when we expose extended-cede states through the
> cpuidle framework, where each of them will have a different
> cede-latency hint.
> 
> Signed-off-by: Gautham R. Shenoy <ego@...ux.vnet.ibm.com>

Reviewed-by: Vaidyanathan Srinivasan <svaidy@...ux.ibm.com>


> ---
>  drivers/cpuidle/cpuidle-pseries.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/cpuidle/cpuidle-pseries.c b/drivers/cpuidle/cpuidle-pseries.c
> index 4a37252..39d4bb6 100644
> --- a/drivers/cpuidle/cpuidle-pseries.c
> +++ b/drivers/cpuidle/cpuidle-pseries.c
> @@ -105,19 +105,27 @@ static void check_and_cede_processor(void)
>  	}
>  }
> 
> +#define NR_CEDE_STATES		1  /* CEDE with latency-hint 0 */
> +#define NR_DEDICATED_STATES	(NR_CEDE_STATES + 1) /* Includes snooze */
> +
> +u8 cede_latency_hint[NR_DEDICATED_STATES];
>  static int dedicated_cede_loop(struct cpuidle_device *dev,
>  				struct cpuidle_driver *drv,
>  				int index)
>  {
> +	u8 old_latency_hint;
> 
>  	pseries_idle_prolog();
>  	get_lppaca()->donate_dedicated_cpu = 1;
> +	old_latency_hint = get_lppaca()->cede_latency_hint;
> +	get_lppaca()->cede_latency_hint = cede_latency_hint[index];
> 
>  	HMT_medium();
>  	check_and_cede_processor();
> 
>  	local_irq_disable();
>  	get_lppaca()->donate_dedicated_cpu = 0;
> +	get_lppaca()->cede_latency_hint = old_latency_hint;
> 
>  	pseries_idle_epilog();
> 
> @@ -149,7 +157,7 @@ static int shared_cede_loop(struct cpuidle_device *dev,
>  /*
>   * States for dedicated partition case.
>   */
> -static struct cpuidle_state dedicated_states[] = {
> +static struct cpuidle_state dedicated_states[NR_DEDICATED_STATES] = {
>  	{ /* Snooze */
>  		.name = "snooze",
>  		.desc = "snooze",


Saving and restoring the current cede hint value helps in maintaining
compatibility with other parts of the kernel.  Over long term we can
make cpuidle driver deterministically set the CEDE hint at each
invocation of H_CEDE call so that we do not have to do multiple
redundant save-restore.

This is a reasonable start to cleanup this cupidle subsystem on PAPR
guests. 

--Vaidy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ