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: <8a76c5df-3982-c53a-9643-4b6b1de290e2@intel.com>
Date: Mon, 4 Nov 2024 15:59:03 -0800
From: Fenghua Yu <fenghua.yu@...el.com>
To: "Luck, Tony" <tony.luck@...el.com>, Peter Newman <peternewman@...gle.com>,
	"Chatre, Reinette" <reinette.chatre@...el.com>
CC: Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
	Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
	"x86@...nel.org" <x86@...nel.org>, "H . Peter Anvin" <hpa@...or.com>, "Babu
 Moger" <babu.moger@....com>, James Morse <james.morse@....com>, "Martin
 Kletzander" <nert.pinx@...il.com>, Shaopeng Tan <tan.shaopeng@...itsu.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, "Eranian,
 Stephane" <eranian@...gle.com>
Subject: Re: [PATCH 2/2] x86/resctrl: Don't workqueue local event counter
 reads

Hi, Tony,

On 11/4/24 14:56, Luck, Tony wrote:
>>    	cpu = cpumask_any_housekeeping(cpumask, RESCTRL_PICK_ANY_CPU);
> 
> To a large degree Peter's is working around inefficiency in this housekeeping
> call.
> 
> Code may be running on a suitable CPU from the domain cpumask, but this
> call will very likely pick the first CPU in that mask, rather than the current one.

Agree.

> 
>  From that point it's all downhill unless you are lucky enough that the first
> CPU is a tick_nohz_full_cpu() one and you take the
> 
> 	smp_call_function_any(cpumask, mon_event_count, rr, 1);

Whenever this function is called, the performance is degraded rather 
than improved because extra get_cpu()/put_cpu() are called in the fast 
path in the current patch.

On platforms that have less housekeeping CPUs (e.g. a RT platform), 
there could be a higher chance that the first CPU is a nohz_full CPU and 
run smp_call_function_any().

> 
> path. It seems that on many systems you'll take the
> 
> 	smp_call_on_cpu(cpu, smp_mon_event_count, rr, false);
> 
> path and make a pointless IPI to get the data.

Yes, that's right. But it's not conflicting with my suggested change.

What I suggested is to move the fast path code to this case only. So the 
fast path is always checked/called in both cases if condition is met:
1. It's already checked/called inside smp_call_function_any() in 
nohz_full case. No need to call out the fast path separately.
    - No extra get_cpu() and put_cpu() are called.
    - The performance is better than the current patch.
2. It's called out in non nohz_full case. No performance difference from 
the current patch.

Thanks.

-Fenghua

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ