From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756165AbcARSGV (ORCPT ); Mon, 18 Jan 2016 13:06:21 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:41493 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755996AbcARSGT (ORCPT ); Mon, 18 Jan 2016 13:06:19 -0500 Date: Mon, 18 Jan 2016 19:06:14 +0100 From: Peter Zijlstra To: Andi Kleen Cc: acme@kernel.org, jolsa@kernel.org, eranian@google.com, linux-kernel@vger.kernel.org, mingo@kernel.org, Andi Kleen Subject: Re: [PATCH 09/11] x86, perf: Support sysfs files depending on SMT status Message-ID: <20160118180614.GV6357@twins.programming.kicks-ass.net> References: <1452906773-7581-1-git-send-email-andi@firstfloor.org> <1452906773-7581-10-git-send-email-andi@firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1452906773-7581-10-git-send-email-andi@firstfloor.org> 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 Fri, Jan 15, 2016 at 05:12:51PM -0800, Andi Kleen wrote: > +ssize_t events_ht_sysfs_show(struct device *dev, struct device_attribute *attr, > + char *page) > +{ > + struct perf_pmu_events_ht_attr *pmu_attr = > + container_of(attr, struct perf_pmu_events_ht_attr, attr); > + > + /* > + * Report conditional events depending on Hyper-Threading. > + * > + * This is overly conservative as usually the HT special > + * handling is not needed if the other CPU thread is idle. > + * > + * Note this does not (cannot) handle the case when thread > + * siblings are invisible, for example with virtualization > + * if they are owned by some other guest. The user tool > + * has to re-read when a thread sibling gets onlined later. > + */ > + > + return sprintf(page, "%s", > + x86_pmu.ht_on ? > + pmu_attr->event_str_ht : > + pmu_attr->event_str_noht); > +} So one obvious problem with this is that a concurrent hotplug operation can toggle ht_on resulting in bogus measurements. I'm not sure there's anything we can do about that, other than WARN in the tool if it finds inconsistent results; does it?