From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752832AbcD1IR4 (ORCPT ); Thu, 28 Apr 2016 04:17:56 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:56069 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751907AbcD1IRx (ORCPT ); Thu, 28 Apr 2016 04:17:53 -0400 Date: Thu, 28 Apr 2016 10:17:48 +0200 From: Peter Zijlstra To: Andi Kleen Cc: acme@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen , Thomas Gleixner , "H. Peter Anvin" , Ingo Molnar Subject: Re: [PATCH 01/11] x86, perf: Support sysfs files depending on SMT status Message-ID: <20160428081748.GP24771@twins.programming.kicks-ass.net> References: <1461787251-6702-1-git-send-email-andi@firstfloor.org> <1461787251-6702-2-git-send-email-andi@firstfloor.org> <20160428080609.GU3430@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160428080609.GU3430@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 28, 2016 at 10:06:09AM +0200, Peter Zijlstra wrote: > On Wed, Apr 27, 2016 at 01:00:41PM -0700, Andi Kleen wrote: > > From: Andi Kleen > > > > Add a way to show different sysfs events attributes depending on > > HyperThreading is on or off. This is difficult to determine > > early at boot, so we just do it dynamically when the sysfs > > attribute is read. > > Thomas would like to have this in the general (x86) topology bits. > > Because having SMT enabled (or not) is not something perf specific (nor > Intel, because apparently AMD is going to do proper SMT too with their > Zen micro-arch), and might very well be useful for other thingies to > know. > > So I suppose it should end up somewhere around: > > /sys/devices/system/cpu/ FWIW I think we already can tell if SMT is enabled by doing something like: for i in /sys/devices/system/cpu/cpu*/topology/thread_siblings_list; do SMT=`cat $i | awk --field-separator "," '{print NF}'`; if [ $SMT -gt 1 ] ; then echo ENABLED; break; fi; done With pretty much the same races as this interface has, no? In any case, a single value is certainly easier than the above.