mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Toshi Kani <toshi.kani@hp.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-acpi@vger.kernel.org
Subject: Re: possible_cpus broken in linux-next
Date: Wed, 29 May 2013 12:35:57 -0600	[thread overview]
Message-ID: <1369852557.16819.54.camel@misato.fc.hp.com> (raw)
In-Reply-To: <51A6367E.1060400@intel.com>

On Wed, 2013-05-29 at 10:10 -0700, Dave Hansen wrote:
> If I boot with: maxcpus=2 possible_cpus=4, I get
> 
> 	# grep . /sys/devices/system/cpu/cpu[0-9]*/online'
> 	/sys/devices/system/cpu/cpu1/online:1
> 	/sys/devices/system/cpu/cpu2/online:1
> 	/sys/devices/system/cpu/cpu3/online:1
> 
> on bad kernels, and this on working ones:
> 
> 	/sys/devices/system/cpu/cpu1/online:1
> 	/sys/devices/system/cpu/cpu2/online:0
> 	/sys/devices/system/cpu/cpu3/online:0
> 
> 
> I also get -EINVAL if I try to re-offline them in this state.  2 and 3
> don't show up in /proc/cpuinfo, so sysfs just looks broken here.  This
> happens in a KVM guest, so it should be dirt-simple for anyone to reproduce.
> 
> I bisected it down to:
> 
> > commit 0902a9044fa5b7a0456ea4daacec2c2b3189ba8c
> > Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > Date:   Fri May 3 00:25:49 2013 +0200
> > 
> >     Driver core: Use generic offline/online for CPU offline/online
> >     
> >     Rework the CPU hotplug code in drivers/base/cpu.c to use the
> >     generic offline/online support introduced previously instead of
> >     its own CPU-specific code.
> >     
> >     For this purpose, modify cpu_subsys to provide offline and online
> >     callbacks for CONFIG_HOTPLUG_CPU set and remove the code handling
> >     the CPU-specific 'online' sysfs attribute.
> >     
> >     This modification is not supposed to change the user-observable
> >     behavior of the kernel (i.e. the 'online' attribute will be present
> >     in exactly the same place in sysfs and should trigger exactly the
> >     same actions as before).
> >     
> >     Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >     Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> >     Reviewed-by: Toshi Kani <toshi.kani@hp.com>


Thanks for the report.  The following patch fixes the problem.
-Toshi

====
From: Toshi Kani <toshi.kani@hp.com>
Subject: [PATCH] ACPI: Fix sysfs cpu/online of offlined cpus

As reported by Dave Hansen, sysfs cpu/online shows 1 for
offlined cpus at boot.
https://lkml.org/lkml/2013/5/29/403

Fix this problem by initializing dev.offline with cpu_online()
when registering a cpu.

Reported-by: Dave Hansen <dave.hansen@intel.com>
Signed-off-by: Toshi Kani <toshi.kani@hp.com>
---
 drivers/base/cpu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 130ba0b..b9f0eec 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -281,6 +281,7 @@ int __cpuinit register_cpu(struct cpu *cpu, int num)
 	cpu->dev.bus = &cpu_subsys;
 	cpu->dev.release = cpu_device_release;
 	cpu->dev.offline_disabled = !cpu->hotpluggable;
+	cpu->dev.offline = !cpu_online(num);
 #ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE
 	cpu->dev.bus->uevent = arch_cpu_uevent;
 #endif
-- 
1.8.1.4




  reply	other threads:[~2013-05-29 18:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-29 17:10 Dave Hansen
2013-05-29 18:35 ` Toshi Kani [this message]
2013-05-29 18:50   ` Toshi Kani
2013-05-29 19:02     ` Rafael J. Wysocki
2013-05-29 22:14       ` Dave Hansen
2013-05-29 22:46         ` Rafael J. Wysocki

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=1369852557.16819.54.camel@misato.fc.hp.com \
    --to=toshi.kani@hp.com \
    --cc=dave.hansen@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=sfr@canb.auug.org.au \
    /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

Powered by JetHome