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] [day] [month] [year] [list]
Message-ID: <197a23f047d.1095ea2d92028509.1160531071010499395@linux.beauty>
Date: Tue, 24 Jun 2025 22:02:08 +0800
From: Li Chen <me@...ux.beauty>
To: "Thomas Gleixner" <tglx@...utronix.de>
Cc: "Ingo Molnar" <mingo@...hat.com>, "Borislav Petkov" <bp@...en8.de>,
	"Dave Hansen" <dave.hansen@...ux.intel.com>, "x86" <x86@...nel.org>,
	"H . Peter Anvin" <hpa@...or.com>,
	"Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
	"Peter Zijlstra" <peterz@...radead.org>,
	"K Prateek Nayak" <kprateek.nayak@....com>,
	"Sohil Mehta" <sohil.mehta@...el.com>,
	"Brian Gerst" <brgerst@...il.com>,
	"Patryk Wlazlyn" <patryk.wlazlyn@...ux.intel.com>,
	"linux-kernel" <linux-kernel@...r.kernel.org>,
	"Gautham R. Shenoy" <gautham.shenoy@....com>,
	"Li Chen" <chenl311@...natelecom.cn>
Subject: Re: [PATCH 2/2] x86/smpboot: avoid SMT domain attach/destroy if SMT
 is not enabled

Hi Thomas. 

 ---- On Tue, 24 Jun 2025 21:36:10 +0800  Thomas Gleixner <tglx@...utronix.de> wrote --- 
 > On Tue, Jun 24 2025 at 16:08, Li Chen wrote:
 > > From: Li Chen <chenl311@...natelecom.cn>
 > >
 > > Currently, the SMT domain is added into sched_domain_topology
 > > by default if CONFIG_SCHED_SMT is enabled.
 > >
 > > If cpu_attach_domain finds that the CPU SMT domain’s cpumask_weight
 > 
 > If cpu_attach_domain()
 > 
 > IIRC, I told you that before.
 > 
 > > is just 1, it will destroy_sched_domain it.
 > >
 > > On a large machine, such as one with 512 cores, this results in
 > > 512 redundant domain attach/destroy operations.
 > >
 > > We can avoid these unnecessary operations by simply checking
 > 
 > s/We can avoid/Avoid/
 > 
 > Care to read my reviews? If you disagree, then discuss it with me, but

I'm sorry that I forget to say that your previous wording review have already been fixed in v2 https://lore.kernel.org/all/20250624085559.69436-3-me@linux.beauty/

And I would replace cpu_attach_domain with cpu_attach_domain().

Sorry for wasting your time. 

 > silently ignoring it them is not an option.
 > 
 > > cpu_smt_num_threads and not inserting SMT domain into x86_topology if SMT
 > 
 > not inserting? That's not what this new version does.
 > 
 > > +static void __init maybe_remove_smt_level(void)
 > > +{
 > > +    if (cpu_smt_num_threads <= 1) {
 > > +        /*
 > > +         * SMT level is x86_topology[0].  Shift the array left by one,
 > > +         * keep the sentinel { NULL } at the end.
 > > +         */
 > > +        memmove(&x86_topology[0], &x86_topology[1],
 > > +            sizeof(x86_topology) - sizeof(x86_topology[0]));
 > > +        memset(&x86_topology[ARRAY_SIZE(x86_topology) - 1], 0,
 > > +               sizeof(x86_topology[0]));
 > 
 > So this sets the last entry in the array, aka the original sentinel in
 > the last array entry, to zero...
 > 
 > This is completely pointless. The above memmove() copies
 > 
 >     topo[1 .. (N - 1)] 
 > to
 >     topo[0 .. (N - 2)]
 > 
 > Where N = ARRAY_SIZE(topo).
 > 
 > Therefore
 >         topo[N - 1] == NULL
 > and
 >         topo[N - 2] == NULL
 > 
 > No?
 > 
 > But then what's worse is that you fail to take that removal into account
 > for the x86_has_numa_in_package case, which still unconditionally sets
 > topo[N - 2] to zero even if the SMT level had been removed...
 > 
 > Please take your time and do not rush out half baked stuff.
 
Sorry again for my mistake. I will fix it in v3.

Regards,
Li

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ