Re: [PATCH 0/2 v3] cpu hotplug: Preserve topology directory after soft remove event
From: Prarit Bhargava
Date: Tue Sep 27 2016 - 07:46:14 EST
On 09/26/2016 07:57 AM, Borislav Petkov wrote:
> On Mon, Sep 26, 2016 at 07:45:37AM -0400, Prarit Bhargava wrote:
>> When offline, /sys/devices/system/cpuX/cpu/online is 0. The problem is that
>> when online is 0, topology disappears so there is no way to determine _the
>> location_ of the offline'd thread.
>
> What does "the location" mean exactly?
>
>> cpupower should still print out all asterisks for down'd threads. It does not
>> because the topology directory is incorrectly removed.
>>
>> IOW how does userspace know the _location_ of the thread? The topology
>> directory no longer exists when the thread is downed, so core_id and
>> physical_package_id (both of which would be effectively static) do not exist.
>> The whole point of this patchset is to know where the offline'd thread actually is.
>
> What do you mean "where"?
The socket and core location.
Look at it this way (and let's get the terminology straight at the same time).
You have a socket CPU. That socket has cores on it. Each core (at least on
Intel) has two threads.
I down a thread (as you did):
>
> $ echo 0 > /sys/devices/system/cpu/cpu2/online
This results in the topology directory being destroyed. It shouldn't be -- the
socket and core are still there. If you could open up your computer you could
touch them. This is similar to downing a PCI device, or removing !kernel memory
DIMM from a system. The device is still physically there.
> $ cat /sys/devices/system/cpu/online
> 0-1,3-7
>
> So core 2 is right between 1 and 3.
Yes. But *where* is it relative to the cores and socket(s)?
>
> If you need to show the package id, you still iterate over the core
> numbers in an increasing order and show '*' for the offlined ones.
>
Explain this in more detail please?
P.