Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932905Ab1EJQES (ORCPT ); Tue, 10 May 2011 12:04:18 -0400 Received: from casper.infradead.org ([85.118.1.10]:40198 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932860Ab1EJQEQ (ORCPT ); Tue, 10 May 2011 12:04:16 -0400 Subject: Re: [PATCH 1/3] perf, core: Introduce attrs to count in either host or guest mode From: Peter Zijlstra To: "Roedel, Joerg" Cc: Paul Mackerras , Ingo Molnar , Arnaldo Carvalho de Melo , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" In-Reply-To: <20110510153855.GE30996@amd.com> References: <1305038132-5080-1-git-send-email-joerg.roedel@amd.com> <1305038132-5080-2-git-send-email-joerg.roedel@amd.com> <1305038746.2914.94.camel@laptop> <20110510145902.GA30996@amd.com> <1305040709.2914.99.camel@laptop> <20110510153855.GE30996@amd.com> Content-Type: text/plain; charset="UTF-8" Date: Tue, 10 May 2011 18:07:18 +0200 Message-ID: <1305043638.2914.113.camel@laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1758 Lines: 39 On Tue, 2011-05-10 at 17:38 +0200, Roedel, Joerg wrote: > On Tue, May 10, 2011 at 11:18:29AM -0400, Peter Zijlstra wrote: > > On Tue, 2011-05-10 at 16:59 +0200, Roedel, Joerg wrote: > > > On Tue, May 10, 2011 at 10:45:46AM -0400, Peter Zijlstra wrote: > > > > On Tue, 2011-05-10 at 16:35 +0200, Joerg Roedel wrote: > > > > > + /* Can't exclude counting in guest and in host mode */ > > > > > + if (attr.exclude_host && attr.exclude_guest) > > > > > + return -EINVAL; > > > > > > > > Why not? > > > > > > By definition the counter won't count at all. The hardware just ignores > > > the bits if they are both set. My rationale here was that it does not > > > makes sense to setup a counter and exclude guest and host mode. > > > > I would expect it to 'work' but simply return 0. If that isn't what the > > AMD hardware does you need to fix that in the AMD driver. > > By 'work' you mean that userspace can set it up but it doesn't count at > all in this situation? Right. > This would certainly be consistent behavior but I > can't imagine any use-case for it so that this code assumes that such a > situation is most likely a bug. > I can certainly change that if wanted, but I think its better to inform > userspace if we get weird values? The eternal how much rope to give and what knots to teach argument I guess. As it is, I think we allow people to exclude both user- and kernel-space, giving a similar situation, so allowing to exclude both host and guest is consistent. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/