Skip to contentSkip to conversation

HOTPLUG CPU Support for SMT

DISCUSSION jayush luniya 4 participants 5 messages May 30, 2005 – May 31, 2005

lore
Share & tools
lore
#0 lore raw

Hi,

I have been looking at the CONFIG_HOTPLUG_CPU option in the Linux Kernel. The option works for IA64, PPP64, S390 architectures. I am doing my research on SMT architecture and want to write a kernel module that can dynamically enable/disable SMT, so that I can switch between uniprocessor mode and SMT mode. So is it possible to use the CONFIG_HOTPLUG_CPU option to dynamically enable/disable a logical processor by performing a logical removal of the CPU since the hardware does not support CPU hotplugging? Also I would like to know how efficient such an implementation would be?

I would really appreciate if anyone could provide me suggestions and any specific patches related to this work.

Regards,
Jayush.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

#1 lore raw
Quoted 13 lines · jayush luniya

I have been looking at the CONFIG_HOTPLUG_CPU option in the Linux Kernel. The option works for IA64, PPP64, S390 architectures. I am doing my research on SMT architecture and want to write a kernel module that can dynamically enable/disable SMT, so that I can switch between uniprocessor mode and SMT mode. So is it possible to use the CONFIG_HOTPLUG_CPU option to dynamically enable/disable a logical processor by performing a logical removal of the CPU since the hardware does not support CPU hotplugging? Also I would like to know how efficient such an implementation would be?

Quoted 3 lines

I would really appreciate if anyone could provide me suggestions and any specific patches related to this work.

Yes, older 2.6-mm kernel (2.6.10-mm) trees have the "toy" i386 hotplug cpu implementation which does what you want.

#2 lore raw
Quoted 2 lines · Zwane Mwaikambo

Yes, older 2.6-mm kernel (2.6.10-mm) trees have the "toy" i386 hotplug cpu implementation which does what you want.

AFAIK in the i386 "toy" implementation, when a CPU is offlined, it stops taking interrupts and stops running tasks, but it _still_ executes a while loop in the context of its idle task (with IRQs disabled). The loop is exited when we have to bring online the CPU again. What this means is I don't think by offlining the CPU, we are removing any activity associated with the corresponding h/w thread.

Maybe the toy implementation could be modified to take care of it? Something like lowering the priority of the h/w thread so that it consumes minimal CPU resources to execute its while loop.

Signature · 5 lines
Thanks and Regards,
Srivatsa Vaddagiri,
Linux Technology Center,
IBM Software Labs,
Bangalore, INDIA - 560017
#3 lore raw
Quoted 11 lines · Srivatsa Vaddagiri
Quoted 2 lines · Zwane Mwaikambo

Yes, older 2.6-mm kernel (2.6.10-mm) trees have the "toy" i386 hotplug cpu implementation which does what you want.

AFAIK in the i386 "toy" implementation, when a CPU is offlined, it stops taking interrupts and stops running tasks, but it _still_ executes a while loop in the context of its idle task (with IRQs disabled). The loop is exited when we have to bring online the CPU again. What this means is I don't think by offlining the CPU, we are removing any activity associated with the corresponding h/w thread.

Quoted 3 lines

Maybe the toy implementation could be modified to take care of it? Something like lowering the priority of the h/w thread so that it consumes minimal CPU resources to execute its while loop.

A cpu_relax() there would help greatly and essentially "drops" the priority of the processor executing it (since 'pause' is a hint that that logical processor would like to yield execution resources), although there would still be traffic due to accessing get_cpu_var, which should be minimal as it'll be at most 1 non shared cacheline so you could account for it in the statement of errors. I used to have a personal implementation for one of the systems i use which does a hlt in that loop and i wake up the procsesor via IPI. So perhaps some kernel hacking might be required (albeit minimal) ;)

Zwane

#4 lore raw
In reply to jayush luniya
Quoted 15 lines · jayush luniya

Hi,

I have been looking at the CONFIG_HOTPLUG_CPU option in the Linux Kernel. The option works for IA64, PPP64, S390 architectures. I am doing my research on SMT architecture and want to write a kernel module that can dynamically enable/disable SMT, so that I can switch between uniprocessor mode and SMT mode. So is it possible to use the CONFIG_HOTPLUG_CPU option to dynamically enable/disable a logical processor by performing a logical removal of the CPU since the hardware does not support CPU hotplugging? Also I would like to know how efficient such an implementation would be?

Quoted 3 lines

I would really appreciate if anyone could provide me suggestions and any specific patches related to this work.

An easy way would be to use sched_setaffinity() and bind all processes to one processor.

Signature · 1 line
Rutger Nijlunsing