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: <YgY6zb7FT/lifZfd@FVFF77S0Q05N>
Date:   Fri, 11 Feb 2022 10:30:37 +0000
From:   Mark Rutland <mark.rutland@....com>
To:     Yury Norov <yury.norov@...il.com>, Will Deacon <will@...nel.org>
Cc:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Michał Mirosław <mirq-linux@...e.qmqm.pl>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Peter Zijlstra <peterz@...radead.org>,
        David Laight <David.Laight@...lab.com>,
        Joe Perches <joe@...ches.com>, Dennis Zhou <dennis@...nel.org>,
        Emil Renner Berthing <kernel@...il.dk>,
        Nicholas Piggin <npiggin@...il.com>,
        Matti Vaittinen <matti.vaittinen@...rohmeurope.com>,
        Alexey Klimov <aklimov@...hat.com>,
        linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 33/49] perf: replace bitmap_weight with bitmap_weight_eq
 for ThunderX2

On Thu, Feb 10, 2022 at 02:49:17PM -0800, Yury Norov wrote:
> tx2_uncore_event_start() calls bitmap_weight() to compare the weight
> of bitmap with a given number. We can do it more efficiently with
> bitmap_weight_eq because conditional bitmap_weight may stop traversing
> the bitmap earlier, as soon as condition is (or can't be) met.
> 
> Signed-off-by: Yury Norov <yury.norov@...il.com>

Given the max counters value is either 4 or 8 I doubt this should matter, but
for consistenct this is fine, so:

Acked-by: Mark Rutland <mark.rutland@....com>

I now see bitmap_weight_eq() is introduced within this series, so I assume you
need to queue that and its users together, and will want to take the prior
drivers/perf/ bit together with that.

Thanks,
Mark.

> ---
>  drivers/perf/thunderx2_pmu.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/perf/thunderx2_pmu.c b/drivers/perf/thunderx2_pmu.c
> index 1edb9c03704f..97d5b39778fa 100644
> --- a/drivers/perf/thunderx2_pmu.c
> +++ b/drivers/perf/thunderx2_pmu.c
> @@ -623,8 +623,8 @@ static void tx2_uncore_event_start(struct perf_event *event, int flags)
>  		return;
>  
>  	/* Start timer for first event */
> -	if (bitmap_weight(tx2_pmu->active_counters,
> -				tx2_pmu->max_counters) == 1) {
> +	if (bitmap_weight_eq(tx2_pmu->active_counters,
> +				tx2_pmu->max_counters, 1)) {
>  		hrtimer_start(&tx2_pmu->hrtimer,
>  			ns_to_ktime(tx2_pmu->hrtimer_interval),
>  			HRTIMER_MODE_REL_PINNED);
> -- 
> 2.32.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ