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: <ed3c066f-5040-4573-a91f-3ee95014c951@linux.intel.com>
Date: Tue, 8 Oct 2024 17:05:22 -0400
From: "Liang, Kan" <kan.liang@...ux.intel.com>
To: Thomas Gleixner <tglx@...utronix.de>, peterz@...radead.org,
 mingo@...hat.com, linux-kernel@...r.kernel.org
Cc: Oliver Sang <oliver.sang@...el.com>,
 Dhananjay Ugwekar <Dhananjay.Ugwekar@....com>
Subject: Re: [PATCH 1/2] perf/x86/rapl: Move the pmu allocation out of CPU
 hotplug



On 2024-10-08 4:36 p.m., Thomas Gleixner wrote:
> On Tue, Oct 08 2024 at 22:23, Thomas Gleixner wrote:
>> On Tue, Oct 08 2024 at 16:10, Kan Liang wrote:
>>> On 2024-10-08 12:33 p.m., Thomas Gleixner wrote:
>>>> On Fri, Sep 13 2024 at 10:10, kan liang wrote:
>>>>> +static void __init init_rapl_pmu(void)
>>>>> +{
>>>>> +	struct rapl_pmu *pmu;
>>>>> +	s32 rapl_pmu_idx;
>>>>> +	int cpu;
>>>>> +
>>>>> +	cpus_read_lock();
>>>>> +
>>>>> +	for_each_cpu(cpu, cpu_online_mask) {
>>>>
>>>> How is that supposed to work, when not all CPUs are online when
>>>> init_rapl_pmus() is invoked?
>>>>
>>>
>>> RAPL is a module. The module_init() is called during do_initcalls(),
>>> which is after the smp_init(). The cpu_online_mask has been setup in the
>>> smp_init().
>>>
>>> I also patched the kernel to double check. The cpu_online_mask indeed
>>> shows all the online CPUs.
>>>
>>> [    7.021212] smp: Brought up 1 node, 48 CPUs
>>> [    7.021212] smpboot: Total of 48 processors activated (211200.00
>>> BogoMIPS)
>>> ... ...
>>> [   16.557323] RAPL PMU: rapl_pmu_init: cpu_online_mask 0xffffffffffff
>>
>>  1) Start your kernel with maxcpus=2 (not recommended, but ...)
>>  2) Load the module
>>  3) Online the rest of the CPUs from userspace
>>
>> If your machine has more than one die you might be surprised...

Thanks. I will find a 2 sockets machine and give it a try.

> 
> You can make this work because the new topology code allows you to
> retrieve the possible number of cores/dies/packages even when they have
> not been onlined yet. 
>

Actually, I think the possible CPU mask should be good enough here. The
init_rapl_pmu() just intends to allocate the space for a pmu in each die.

The worst case of using a possible mask is that some space may be
wasted, when there is no online CPUs on a die. But it should be an
unusual case. It should be harmless.

Thanks,
Kan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ