* [PATCH] core: Fix maxcpus boot option broken
@ 2013-05-30 4:00 Youquan Song
2013-05-31 21:52 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Youquan Song @ 2013-05-30 4:00 UTC (permalink / raw)
To: gregkh, akpm, torvalds, linux-kernel; +Cc: Youquan Song, Youquan Song
maxcpus boot option to limit maximum number of CPUs on system, but this option
is broken at recent kernel. Though we use maxcpus to limit CPUs number, but
current kernel will register all of present CPUs in sysfs.
udev will enumerate all registered cpu at sysfs, and it will bring up the CPU
if the CPU is offline. So the maxcpus option is broken.
This patch will only register the CPU which is not over limitation of maxcpus
option in sysfs. So it will keep the maxcpus limitation when udev enumeration
or other intention of bring up CPUs over the limitation by method like
echo 1 > /sys/devices/system/cpu/online
Signed-off-by: Youquan Song <youquan.song@intel.com>
---
drivers/base/cpu.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 3d48fc8..c7d603a 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -272,6 +272,10 @@ int __cpuinit register_cpu(struct cpu *cpu, int num)
{
int error;
+ /* return when cpu number greater than maximum number of CPUs */
+ if (num >= setup_max_cpus)
+ return 0;
+
cpu->node_id = cpu_to_node(num);
memset(&cpu->dev, 0x00, sizeof(struct device));
cpu->dev.id = num;
--
1.7.7.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] core: Fix maxcpus boot option broken
2013-05-30 4:00 [PATCH] core: Fix maxcpus boot option broken Youquan Song
@ 2013-05-31 21:52 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2013-05-31 21:52 UTC (permalink / raw)
To: Youquan Song; +Cc: gregkh, torvalds, linux-kernel, Youquan Song
On Thu, 30 May 2013 00:00:06 -0400 Youquan Song <youquan.song@intel.com> wrote:
> maxcpus boot option to limit maximum number of CPUs on system, but this option
> is broken at recent kernel.
Can you help us identify which kernel versions have this bug?
Identifying the offending commit would be best. Thanks.
> Though we use maxcpus to limit CPUs number, but
> current kernel will register all of present CPUs in sysfs.
> udev will enumerate all registered cpu at sysfs, and it will bring up the CPU
> if the CPU is offline. So the maxcpus option is broken.
>
> This patch will only register the CPU which is not over limitation of maxcpus
> option in sysfs. So it will keep the maxcpus limitation when udev enumeration
> or other intention of bring up CPUs over the limitation by method like
> echo 1 > /sys/devices/system/cpu/online
>
> ...
>
> --- a/drivers/base/cpu.c
> +++ b/drivers/base/cpu.c
> @@ -272,6 +272,10 @@ int __cpuinit register_cpu(struct cpu *cpu, int num)
> {
> int error;
>
> + /* return when cpu number greater than maximum number of CPUs */
> + if (num >= setup_max_cpus)
> + return 0;
> +
> cpu->node_id = cpu_to_node(num);
> memset(&cpu->dev, 0x00, sizeof(struct device));
> cpu->dev.id = num;
> --
> 1.7.7.4
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-05-31 21:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-30 4:00 [PATCH] core: Fix maxcpus boot option broken Youquan Song
2013-05-31 21:52 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®