From: Thomas Gleixner <tglx@linutronix.de>
To: "Liang, Kan" <kan.liang@linux.intel.com>,
peterz@infradead.org, mingo@redhat.com,
linux-kernel@vger.kernel.org
Cc: Oliver Sang <oliver.sang@intel.com>,
Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
Subject: Re: [PATCH 1/2] perf/x86/rapl: Move the pmu allocation out of CPU hotplug
Date: Wed, 09 Oct 2024 00:38:47 +0200 [thread overview]
Message-ID: <87ed4qrzig.ffs@tglx> (raw)
In-Reply-To: <ed3c066f-5040-4573-a91f-3ee95014c951@linux.intel.com>
On Tue, Oct 08 2024 at 17:05, Kan Liang wrote:
> On 2024-10-08 4:36 p.m., Thomas Gleixner wrote:
>>>
>>> 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.
Right, but you can't use the regular topology functions which are used
by cpu to rapl ID for that because they depend on the CPU being
online. The x86 specific ones which parse the APIC ID topology
information can provide that information.
I.e. you only need
topology_max_packages()
topology_max_dies_per_package()
topology_num_cores_per_package()
which provide you the required information to allocate upfront. Later
when the CPUs are actually online the existing mapping functions work.
Thanks,
tglx
prev parent reply other threads:[~2024-10-08 22:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-13 17:10 [PATCH 1/2] perf/x86/rapl: Move the pmu allocation out of CPU hotplug kan.liang
2024-09-13 17:10 ` [PATCH 2/2] perf/x86/rapl: Clean up cpumask and hotplug kan.liang
2024-10-08 16:33 ` [PATCH 1/2] perf/x86/rapl: Move the pmu allocation out of CPU hotplug Thomas Gleixner
2024-10-08 20:10 ` Liang, Kan
2024-10-08 20:23 ` Thomas Gleixner
2024-10-08 20:36 ` Thomas Gleixner
2024-10-08 21:05 ` Liang, Kan
2024-10-08 22:38 ` Thomas Gleixner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ed4qrzig.ffs@tglx \
--to=tglx@linutronix.de \
--cc=Dhananjay.Ugwekar@amd.com \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oliver.sang@intel.com \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox