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: <20181120140250.GT2131@hirez.programming.kicks-ass.net>
Date:   Tue, 20 Nov 2018 15:02:50 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Frederic Weisbecker <frederic@...nel.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Wanpeng Li <wanpengli@...cent.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Yauheni Kaliuta <yauheni.kaliuta@...hat.com>,
        Ingo Molnar <mingo@...nel.org>, Rik van Riel <riel@...hat.com>
Subject: Re: [PATCH 13/25] context_tracking: Introduce
 context_tracking_enabled_cpu()

On Wed, Nov 14, 2018 at 03:45:57AM +0100, Frederic Weisbecker wrote:
> This allows us to check if a remote CPU runs context tracking
> (ie: is nohz_full). We'll need that to reliably support "nice"
> accounting on kcpustat.
> 
> Signed-off-by: Frederic Weisbecker <frederic@...nel.org>
> Cc: Yauheni Kaliuta <yauheni.kaliuta@...hat.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Rik van Riel <riel@...hat.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Wanpeng Li <wanpengli@...cent.com>
> Cc: Ingo Molnar <mingo@...nel.org>
> ---
>  include/linux/context_tracking_state.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/include/linux/context_tracking_state.h b/include/linux/context_tracking_state.h
> index 08f125f..5877177 100644
> --- a/include/linux/context_tracking_state.h
> +++ b/include/linux/context_tracking_state.h
> @@ -31,6 +31,11 @@ static inline bool context_tracking_enabled(void)
>  	return static_branch_unlikely(&context_tracking_key);
>  }
>  
> +static inline bool context_tracking_enabled_cpu(int cpu)
> +{
> +	return per_cpu(context_tracking.active, cpu);
> +}
> +
>  static inline bool context_tracking_enabled_this_cpu(void)
>  {
>  	return __this_cpu_read(context_tracking.active);

Should not the last two be something like:

static inline bool context_tracking_enabled_cpu(int cpu)
{
	return context_tracking_enabled() && per_cpu(context_tracking.active, cpu);
}

static inline bool context_tracking_enabled_this_cpu(void)
{
	return context_tracking_enabled() && __this_cpu_read(context_tracking.active);
}

Because, afaict, not all callsites first check the static key.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ