From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755194AbcIHNpa (ORCPT ); Thu, 8 Sep 2016 09:45:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50368 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752842AbcIHNp3 (ORCPT ); Thu, 8 Sep 2016 09:45:29 -0400 Message-ID: <57D16B76.2070303@redhat.com> Date: Thu, 08 Sep 2016 09:45:26 -0400 From: Prarit Bhargava User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Peter Zijlstra CC: linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Greg Kroah-Hartman , Len Brown , Borislav Petkov , Andi Kleen , Jiri Olsa , Juergen Gross Subject: Re: [PATCH 2/2] cpu hotplug, add CONFIG_PERMANENT_CPU_TOPOLOGY References: <1473248657-17359-1-git-send-email-prarit@redhat.com> <1473248657-17359-3-git-send-email-prarit@redhat.com> <20160908074542.GY10138@twins.programming.kicks-ass.net> In-Reply-To: <20160908074542.GY10138@twins.programming.kicks-ass.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 08 Sep 2016 13:45:28 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/08/2016 03:45 AM, Peter Zijlstra wrote: > On Wed, Sep 07, 2016 at 07:44:17AM -0400, Prarit Bhargava wrote: >> The information in /sys/devices/system/cpu/cpuX/topology >> directory is useful for userspace monitoring applications and in-tree >> utilities like cpupower & turbostat. >> >> When down'ing a CPU the /sys/devices/system/cpu/cpuX/topology directory is >> removed during the CPU_DEAD hotplug callback in the kernel. The problem >> with this model is that the CPU has not been physically removed and the >> data in the topology directory is still valid and the cpu's location is >> now lost to userspace. >> >> This patch adds CONFIG_PERMANENT_CPU_TOPOLOGY, and is Y by default for >> x86, an N for all other arches. When enabled the kernel is modified so >> that the topology directory is added to the core cpu sysfs files so that >> the topology directory exists while the CPU is physically present. When >> disabled, the behavior of the current kernel is maintained (that is, the >> topology directory is removed on a soft down and added on an soft up). >> Adding CONFIG_PERMANENT_CPU_TOPOLOGY may require additional architecture >> so that the cpumask data the CPU's topology is not cleared during a CPU >> down. > > So how do you physically remove things and how does the information then > get removed? > Physical hotremove was done with a toggle switch enabled test box. The topology directory gets removed when either common_cpu_attr_groups (!CONFIG_HOTPLUG_CPU) or hotplugable_cpu_attr_groups (CONFIG_HOTPLUG_CPU) are destroyed. The cpu device's attributes are set in register_cpu() and the device is destroyed in unregister_cpu(). IOW, the patch expands the lifetime of the topology directories to match that of the device. > Also, why is that an x86 only feature? The only arch that I could test on was x86 and I wasn't able to test to see if topology fields are valid for other arches on a soft remove. So x86 by default for now and other arches can make their decisions. P.