From patchwork Wed May 29 18:35:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Toshi Kani X-Patchwork-Id: 2632051 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 60FE5DF24C for ; Wed, 29 May 2013 18:36:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757289Ab3E2SgD (ORCPT ); Wed, 29 May 2013 14:36:03 -0400 Received: from g1t0028.austin.hp.com ([15.216.28.35]:9269 "EHLO g1t0028.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754206Ab3E2SgC (ORCPT ); Wed, 29 May 2013 14:36:02 -0400 Received: from g1t0038.austin.hp.com (g1t0038.austin.hp.com [16.236.32.44]) by g1t0028.austin.hp.com (Postfix) with ESMTP id 1D7DC1C147; Wed, 29 May 2013 18:36:00 +0000 (UTC) Received: from [16.71.12.41] (misato.fc.hp.com [16.71.12.41]) by g1t0038.austin.hp.com (Postfix) with ESMTP id 4416A30009; Wed, 29 May 2013 18:35:57 +0000 (UTC) Message-ID: <1369852557.16819.54.camel@misato.fc.hp.com> Subject: Re: possible_cpus broken in linux-next From: Toshi Kani To: Dave Hansen Cc: "Rafael J. Wysocki" , Stephen Rothwell , Greg Kroah-Hartman , LKML , linux-acpi@vger.kernel.org Date: Wed, 29 May 2013 12:35:57 -0600 In-Reply-To: <51A6367E.1060400@intel.com> References: <51A6367E.1060400@intel.com> X-Mailer: Evolution 3.6.4 (3.6.4-3.fc18) Mime-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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 > > 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 > > Acked-by: Greg Kroah-Hartman > > Reviewed-by: Toshi Kani Thanks for the report. The following patch fixes the problem. -Toshi Tested-by: Dave Hansen ==== From: Toshi Kani 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 Signed-off-by: Toshi Kani --- 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