From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934137AbcIUNj3 (ORCPT ); Wed, 21 Sep 2016 09:39:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54648 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934107AbcIUNj0 (ORCPT ); Wed, 21 Sep 2016 09:39:26 -0400 Message-ID: <57E28BFF.8060107@redhat.com> Date: Wed, 21 Sep 2016 09:32:47 -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: Borislav Petkov CC: linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Greg Kroah-Hartman , Peter Zijlstra , Len Brown , Andi Kleen , Jiri Olsa , Juergen Gross Subject: Re: [PATCH 0/2 v3] cpu hotplug: Preserve topology directory after soft remove event References: <1474457973-19536-1-git-send-email-prarit@redhat.com> <20160921130428.2e7bprll64vs6h2r@pd.tnic> In-Reply-To: <20160921130428.2e7bprll64vs6h2r@pd.tnic> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 21 Sep 2016 13:32:49 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/21/2016 09:04 AM, Borislav Petkov wrote: > On Wed, Sep 21, 2016 at 07:39:31AM -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. IOW, the cpu is still >> present but the kernel has removed the topology directory making it >> very difficult to determine exactly where the cpu is located. > > So I'm afraid I still don't understand what the problem here is. > > And the commit message of 2/2 doesn't make it any clearer. Can you > please give a concrete example what the problem is and what you're > trying to achieve. Sorry, I'll try again.... Right now, if you removed thread 29 from your system you would do: echo 0 > /sys/devices/system/cpu/cpu29/online >>From the userspace side, this results in the removing of the /sys/devices/system/cpu/cpu29/topology directory. This is not the right thing to do [1]. The topology directory should exist as long as the thread is present in the system. The thread (and its core) are still physically there, it's just that the thread is not available to the scheduler. The topology of the thread hasn't changed due to it being soft offlined this way. turbostat was modified to deal with the missing topology directory, and in tree utility cpupower prints out significantly less information when a thread is offline. ISTR a powertop bug due to hotplug too. This makes these monitoring utilities a problem for users who want only one thread per core. The patchset does two things. The first patch unifies the topology.c and cpu.c code. The second patch introduces a config option to change the lifetime of the topology directory to exist as long as the thread's device struct exists in the device subsystem. This now means that echo 0 > /sys/devices/system/cpu/cpu29/online will result in the thread's topology directory staying around until the struct device associated with it is destroyed upon a physical socket hotplug event. This patchset will result in cleanups to turbostat, and make fixes to cpupower *much* easier to deal with. [1] I cannot say with any certainty that other arches do or do not require this change. That is the only reason the change is restricted to x86 right now. P. > > Thanks. >