linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch v1] ACPI, x86: fix bug in associating hot-added CPUs with corresponding NUMA node
@ 2014-01-20  2:31 Jiang Liu
  2014-02-05  0:14 ` Rafael J. Wysocki
  0 siblings, 1 reply; 6+ messages in thread
From: Jiang Liu @ 2014-01-20  2:31 UTC (permalink / raw)
  To: Rafael J . Wysocki, Toshi Kani, Yinghai Lu, Yijing Wang,
	Len Brown, Pavel Machek, Rafael J. Wysocki, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86
  Cc: Jiang Liu, linux-acpi, linux-hotplug, linux-kernel, linux-pm

Current ACPI cpu hotplug driver fails to associate hot-added CPUs with
corresponding NUMA node when doing socket online. The code path to
associate CPU with NUMA node is as below:
acpi_processor_add()
    ->acpi_processor_get_info()
	->acpi_processor_hotadd_init()
	    ->acpi_map_lsapic()
		->_acpi_map_lsapic()
		    ->acpi_map_cpu2node()
cpu_subsys_online()
    ->try_online_node()
	->node_set_online()

When doing socket online, a new NUMA node is introduced in addition to
hot-added CPU and memory device. And the new NUMA node is marked as
online when onlining hot-added CPUs through sysfs interface
/sys/devices/system/cpu/cpuxx/online.

On the other hand, acpi_map_cpu2node() will only build the CPU to node
map if corresponding NUMA node is already online, so it always fails
to associate hot-added CPUs with corresponding NUMA node because the
NUMA node is still in offline state.

For the fix, we could safely remove the "node_online(node)" check in
function acpi_map_cpu2node() because it's only called for hot-added CPUs
by acpi_processor_hotadd_init().

Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
 arch/x86/kernel/acpi/boot.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 6c0b43b..7625de9 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -614,10 +614,10 @@ static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 	int nid;
 
 	nid = acpi_get_node(handle);
-	if (nid == -1 || !node_online(nid))
-		return;
-	set_apicid_to_node(physid, nid);
-	numa_set_node(cpu, nid);
+	if (nid != -1) {
+		set_apicid_to_node(physid, nid);
+		numa_set_node(cpu, nid);
+	}
 #endif
 }
 
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Patch v1] ACPI, x86: fix bug in associating hot-added CPUs with corresponding NUMA node
  2014-01-20  2:31 [Patch v1] ACPI, x86: fix bug in associating hot-added CPUs with corresponding NUMA node Jiang Liu
@ 2014-02-05  0:14 ` Rafael J. Wysocki
  2014-02-07  9:17   ` Jiang Liu
  0 siblings, 1 reply; 6+ messages in thread
From: Rafael J. Wysocki @ 2014-02-05  0:14 UTC (permalink / raw)
  To: Jiang Liu
  Cc: Rafael J . Wysocki, Toshi Kani, Yinghai Lu, Yijing Wang,
	Len Brown, Pavel Machek, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86, linux-acpi, linux-hotplug, linux-kernel,
	linux-pm

On Monday, January 20, 2014 10:31:54 AM Jiang Liu wrote:
> Current ACPI cpu hotplug driver fails to associate hot-added CPUs with
> corresponding NUMA node when doing socket online. The code path to
> associate CPU with NUMA node is as below:
> acpi_processor_add()
>     ->acpi_processor_get_info()
> 	->acpi_processor_hotadd_init()
> 	    ->acpi_map_lsapic()
> 		->_acpi_map_lsapic()
> 		    ->acpi_map_cpu2node()
> cpu_subsys_online()
>     ->try_online_node()
> 	->node_set_online()
> 
> When doing socket online, a new NUMA node is introduced in addition to
> hot-added CPU and memory device. And the new NUMA node is marked as
> online when onlining hot-added CPUs through sysfs interface
> /sys/devices/system/cpu/cpuxx/online.
> 
> On the other hand, acpi_map_cpu2node() will only build the CPU to node
> map if corresponding NUMA node is already online, so it always fails
> to associate hot-added CPUs with corresponding NUMA node because the
> NUMA node is still in offline state.
> 
> For the fix, we could safely remove the "node_online(node)" check in
> function acpi_map_cpu2node() because it's only called for hot-added CPUs
> by acpi_processor_hotadd_init().
> 
> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>

I wonder what the status here is?  Did this patch go anywhere?

> ---
>  arch/x86/kernel/acpi/boot.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
> index 6c0b43b..7625de9 100644
> --- a/arch/x86/kernel/acpi/boot.c
> +++ b/arch/x86/kernel/acpi/boot.c
> @@ -614,10 +614,10 @@ static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
>  	int nid;
>  
>  	nid = acpi_get_node(handle);
> -	if (nid == -1 || !node_online(nid))
> -		return;
> -	set_apicid_to_node(physid, nid);
> -	numa_set_node(cpu, nid);
> +	if (nid != -1) {
> +		set_apicid_to_node(physid, nid);
> +		numa_set_node(cpu, nid);
> +	}
>  #endif
>  }
>  
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Patch v1] ACPI, x86: fix bug in associating hot-added CPUs with corresponding NUMA node
  2014-02-05  0:14 ` Rafael J. Wysocki
@ 2014-02-07  9:17   ` Jiang Liu
  2014-02-07 12:03     ` Rafael J. Wysocki
  0 siblings, 1 reply; 6+ messages in thread
From: Jiang Liu @ 2014-02-07  9:17 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Rafael J . Wysocki, Toshi Kani, Yinghai Lu, Yijing Wang,
	Len Brown, Pavel Machek, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86, linux-acpi, linux-hotplug, linux-kernel,
	linux-pm



On 2014/2/5 8:14, Rafael J. Wysocki wrote:
> On Monday, January 20, 2014 10:31:54 AM Jiang Liu wrote:
>> Current ACPI cpu hotplug driver fails to associate hot-added CPUs with
>> corresponding NUMA node when doing socket online. The code path to
>> associate CPU with NUMA node is as below:
>> acpi_processor_add()
>>     ->acpi_processor_get_info()
>> 	->acpi_processor_hotadd_init()
>> 	    ->acpi_map_lsapic()
>> 		->_acpi_map_lsapic()
>> 		    ->acpi_map_cpu2node()
>> cpu_subsys_online()
>>     ->try_online_node()
>> 	->node_set_online()
>>
>> When doing socket online, a new NUMA node is introduced in addition to
>> hot-added CPU and memory device. And the new NUMA node is marked as
>> online when onlining hot-added CPUs through sysfs interface
>> /sys/devices/system/cpu/cpuxx/online.
>>
>> On the other hand, acpi_map_cpu2node() will only build the CPU to node
>> map if corresponding NUMA node is already online, so it always fails
>> to associate hot-added CPUs with corresponding NUMA node because the
>> NUMA node is still in offline state.
>>
>> For the fix, we could safely remove the "node_online(node)" check in
>> function acpi_map_cpu2node() because it's only called for hot-added CPUs
>> by acpi_processor_hotadd_init().
>>
>> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
> 
> I wonder what the status here is?  Did this patch go anywhere?
Hi Rafael,
	It's still in review stage, hasn't been accepted by any
maintainer yet.
Thanks!
Gerry

> 
>> ---
>>  arch/x86/kernel/acpi/boot.c |    8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
>> index 6c0b43b..7625de9 100644
>> --- a/arch/x86/kernel/acpi/boot.c
>> +++ b/arch/x86/kernel/acpi/boot.c
>> @@ -614,10 +614,10 @@ static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
>>  	int nid;
>>  
>>  	nid = acpi_get_node(handle);
>> -	if (nid == -1 || !node_online(nid))
>> -		return;
>> -	set_apicid_to_node(physid, nid);
>> -	numa_set_node(cpu, nid);
>> +	if (nid != -1) {
>> +		set_apicid_to_node(physid, nid);
>> +		numa_set_node(cpu, nid);
>> +	}
>>  #endif
>>  }
>>  
>>
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Patch v1] ACPI, x86: fix bug in associating hot-added CPUs with corresponding NUMA node
  2014-02-07  9:17   ` Jiang Liu
@ 2014-02-07 12:03     ` Rafael J. Wysocki
  2014-02-13  2:32       ` Jiang Liu
  0 siblings, 1 reply; 6+ messages in thread
From: Rafael J. Wysocki @ 2014-02-07 12:03 UTC (permalink / raw)
  To: Jiang Liu, H. Peter Anvin
  Cc: Rafael J . Wysocki, Toshi Kani, Yinghai Lu, Yijing Wang,
	Len Brown, Pavel Machek, Thomas Gleixner, Ingo Molnar, x86,
	linux-acpi, linux-hotplug, linux-kernel, linux-pm

On Friday, February 07, 2014 05:17:45 PM Jiang Liu wrote:
> 
> On 2014/2/5 8:14, Rafael J. Wysocki wrote:
> > On Monday, January 20, 2014 10:31:54 AM Jiang Liu wrote:
> >> Current ACPI cpu hotplug driver fails to associate hot-added CPUs with
> >> corresponding NUMA node when doing socket online. The code path to
> >> associate CPU with NUMA node is as below:
> >> acpi_processor_add()
> >>     ->acpi_processor_get_info()
> >> 	->acpi_processor_hotadd_init()
> >> 	    ->acpi_map_lsapic()
> >> 		->_acpi_map_lsapic()
> >> 		    ->acpi_map_cpu2node()
> >> cpu_subsys_online()
> >>     ->try_online_node()
> >> 	->node_set_online()
> >>
> >> When doing socket online, a new NUMA node is introduced in addition to
> >> hot-added CPU and memory device. And the new NUMA node is marked as
> >> online when onlining hot-added CPUs through sysfs interface
> >> /sys/devices/system/cpu/cpuxx/online.
> >>
> >> On the other hand, acpi_map_cpu2node() will only build the CPU to node
> >> map if corresponding NUMA node is already online, so it always fails
> >> to associate hot-added CPUs with corresponding NUMA node because the
> >> NUMA node is still in offline state.
> >>
> >> For the fix, we could safely remove the "node_online(node)" check in
> >> function acpi_map_cpu2node() because it's only called for hot-added CPUs
> >> by acpi_processor_hotadd_init().
> >>
> >> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
> > 
> > I wonder what the status here is?  Did this patch go anywhere?
> Hi Rafael,
> 	It's still in review stage, hasn't been accepted by any
> maintainer yet.

OK

Peter, are you fine with the patch below?

Rafael


> > 
> >> ---
> >>  arch/x86/kernel/acpi/boot.c |    8 ++++----
> >>  1 file changed, 4 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
> >> index 6c0b43b..7625de9 100644
> >> --- a/arch/x86/kernel/acpi/boot.c
> >> +++ b/arch/x86/kernel/acpi/boot.c
> >> @@ -614,10 +614,10 @@ static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
> >>  	int nid;
> >>  
> >>  	nid = acpi_get_node(handle);
> >> -	if (nid == -1 || !node_online(nid))
> >> -		return;
> >> -	set_apicid_to_node(physid, nid);
> >> -	numa_set_node(cpu, nid);
> >> +	if (nid != -1) {
> >> +		set_apicid_to_node(physid, nid);
> >> +		numa_set_node(cpu, nid);
> >> +	}
> >>  #endif
> >>  }
> >>  
> >>
> > 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Patch v1] ACPI, x86: fix bug in associating hot-added CPUs with corresponding NUMA node
  2014-02-07 12:03     ` Rafael J. Wysocki
@ 2014-02-13  2:32       ` Jiang Liu
  2014-02-13  3:37         ` H. Peter Anvin
  0 siblings, 1 reply; 6+ messages in thread
From: Jiang Liu @ 2014-02-13  2:32 UTC (permalink / raw)
  To: Rafael J. Wysocki, H. Peter Anvin
  Cc: Rafael J . Wysocki, Toshi Kani, Yinghai Lu, Yijing Wang,
	Len Brown, Pavel Machek, Thomas Gleixner, Ingo Molnar, x86,
	linux-acpi, linux-hotplug, linux-kernel, linux-pm

Ping...

On 2014/2/7 20:03, Rafael J. Wysocki wrote:
> On Friday, February 07, 2014 05:17:45 PM Jiang Liu wrote:
>>
>> On 2014/2/5 8:14, Rafael J. Wysocki wrote:
>>> On Monday, January 20, 2014 10:31:54 AM Jiang Liu wrote:
>>>> Current ACPI cpu hotplug driver fails to associate hot-added CPUs with
>>>> corresponding NUMA node when doing socket online. The code path to
>>>> associate CPU with NUMA node is as below:
>>>> acpi_processor_add()
>>>>     ->acpi_processor_get_info()
>>>> 	->acpi_processor_hotadd_init()
>>>> 	    ->acpi_map_lsapic()
>>>> 		->_acpi_map_lsapic()
>>>> 		    ->acpi_map_cpu2node()
>>>> cpu_subsys_online()
>>>>     ->try_online_node()
>>>> 	->node_set_online()
>>>>
>>>> When doing socket online, a new NUMA node is introduced in addition to
>>>> hot-added CPU and memory device. And the new NUMA node is marked as
>>>> online when onlining hot-added CPUs through sysfs interface
>>>> /sys/devices/system/cpu/cpuxx/online.
>>>>
>>>> On the other hand, acpi_map_cpu2node() will only build the CPU to node
>>>> map if corresponding NUMA node is already online, so it always fails
>>>> to associate hot-added CPUs with corresponding NUMA node because the
>>>> NUMA node is still in offline state.
>>>>
>>>> For the fix, we could safely remove the "node_online(node)" check in
>>>> function acpi_map_cpu2node() because it's only called for hot-added CPUs
>>>> by acpi_processor_hotadd_init().
>>>>
>>>> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
>>>
>>> I wonder what the status here is?  Did this patch go anywhere?
>> Hi Rafael,
>> 	It's still in review stage, hasn't been accepted by any
>> maintainer yet.
> 
> OK
> 
> Peter, are you fine with the patch below?
> 
> Rafael
> 
> 
>>>
>>>> ---
>>>>  arch/x86/kernel/acpi/boot.c |    8 ++++----
>>>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
>>>> index 6c0b43b..7625de9 100644
>>>> --- a/arch/x86/kernel/acpi/boot.c
>>>> +++ b/arch/x86/kernel/acpi/boot.c
>>>> @@ -614,10 +614,10 @@ static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
>>>>  	int nid;
>>>>  
>>>>  	nid = acpi_get_node(handle);
>>>> -	if (nid == -1 || !node_online(nid))
>>>> -		return;
>>>> -	set_apicid_to_node(physid, nid);
>>>> -	numa_set_node(cpu, nid);
>>>> +	if (nid != -1) {
>>>> +		set_apicid_to_node(physid, nid);
>>>> +		numa_set_node(cpu, nid);
>>>> +	}
>>>>  #endif
>>>>  }
>>>>  
>>>>
>>>
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Patch v1] ACPI, x86: fix bug in associating hot-added CPUs with corresponding NUMA node
  2014-02-13  2:32       ` Jiang Liu
@ 2014-02-13  3:37         ` H. Peter Anvin
  0 siblings, 0 replies; 6+ messages in thread
From: H. Peter Anvin @ 2014-02-13  3:37 UTC (permalink / raw)
  To: Jiang Liu, Rafael J. Wysocki
  Cc: Rafael J . Wysocki, Toshi Kani, Yinghai Lu, Yijing Wang,
	Len Brown, Pavel Machek, Thomas Gleixner, Ingo Molnar, x86,
	linux-acpi, linux-hotplug, linux-kernel, linux-pm

On 02/12/2014 06:32 PM, Jiang Liu wrote:
> Ping...

Sorry, will look at it tomorrow.

	-hpa



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-02-13  3:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-20  2:31 [Patch v1] ACPI, x86: fix bug in associating hot-added CPUs with corresponding NUMA node Jiang Liu
2014-02-05  0:14 ` Rafael J. Wysocki
2014-02-07  9:17   ` Jiang Liu
2014-02-07 12:03     ` Rafael J. Wysocki
2014-02-13  2:32       ` Jiang Liu
2014-02-13  3:37         ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).