Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp406178pxa; Wed, 12 Aug 2020 05:18:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoVFHYa5iPDequK99nhivZ/VwMEJB5ChzH/icey2hV7Fgsw3RNeNvEuKPtxyuAEw3Rbmzr X-Received: by 2002:aa7:d70a:: with SMTP id t10mr29978563edq.68.1597234692989; Wed, 12 Aug 2020 05:18:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597234692; cv=none; d=google.com; s=arc-20160816; b=xsmA4Lt1NIXELUam8c1WzuIIGEZKCsAhAqCbkFG6kTj0F9ecsFpCcrfGeuLhyGpEp4 jgbJExnW9ekX80wTuCLpDef/f3pWxAM0WCO6LcE2FLD6GOigYjmnCOxV+NPP/gefRA5I 0d/6USSuP0zhl+b02qHbFD3abKo822bb5EvLOICzXVh98hbTMs03YqpGhGUIqXre4ugD 56mz0uSrTVxULZQwQpkCdtH+k9SOsv0MqjQ7hOXbCLkIik4kyb3J6j6UUQKh7cON4Iqh 3ha7jQAzYY7FJOYGKOyXCPIAZgMIwL/Df2fi6jliGOi2efPC1NvsW8T/IlkCpS3h6AI9 nTmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=wdyh3B1hyxCrKW4L3k9r6dpV7hkwtrsofcOc57p4idM=; b=Sj9sXmbddn8HAI+TsDbTBXaX4VowJI35pc5IlC3EFwCWMk3NmejXJK5/1R5xf+VqzC wtkTl99FfkYct9sBByn2q31rNp4P/UNXuP9DFI6ye8X/KCuJdkPLNY29tEs7wOTLPJNA 0moJ2oFGuR//X0L9qY71KDExayo3QobFHuVwyZXRodllPHAz7GNTdeuZJROh0M2difpz 7DmpELipOjLLuLjhatLrceBiLXp9T1e7c70SMOEv1BbBjl9TLNRB6UmiwVlXxbbTGbyn ZYVZx3gHf4Tz/KDf6d2dIQF5szLo7QLWAlPKk9rdxmipUEKKF+TGA+HqKhcaq9gJg93r aItQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dI4uMAk1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b6si1152708eja.559.2020.08.12.05.17.49; Wed, 12 Aug 2020 05:18:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dI4uMAk1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726946AbgHLMPH (ORCPT + 99 others); Wed, 12 Aug 2020 08:15:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:38814 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726453AbgHLMPH (ORCPT ); Wed, 12 Aug 2020 08:15:07 -0400 Received: from quaco.ghostprotocols.net (179.176.8.134.dynamic.adsl.gvt.net.br [179.176.8.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A55BA207F7; Wed, 12 Aug 2020 12:15:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597234506; bh=mm82WzoLjrVa6avpvteLu66NhBbfGWCUMUSbAG+RWYg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dI4uMAk1/dvf6uOjAMb7HPjOntYOGanWXwzVMoSFZDi0pEEYyPqQ2l0MH2rm5sk43 +wp0zeftgpQeKIgm5+bsUSa1pIdgIGUVKCMPvqyfnG7jTfLxIoPGexzAA2sNabcxyQ uRXQRbJOk84Rq24Gm30d1j58fNhy9xT+4Tx2FguE= Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id B307E403C6; Wed, 12 Aug 2020 09:15:04 -0300 (-03) Date: Wed, 12 Aug 2020 09:15:04 -0300 From: Arnaldo Carvalho de Melo To: Jin Yao Cc: jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com, like.xu@linux.intel.com Subject: Re: [PATCH] perf parse-events: Set exclude_guest for user-space counting Message-ID: <20200812121504.GE13995@kernel.org> References: <20200812065953.22143-1-yao.jin@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200812065953.22143-1-yao.jin@linux.intel.com> X-Url: http://acmel.wordpress.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Wed, Aug 12, 2020 at 02:59:53PM +0800, Jin Yao escreveu: > Currently if we run 'perf record -e cycles:u', exclude_guest is 0. > > But it doesn't make sense that we request for user-space counting > but we also get the guest report. > > To keep perf semantics consistent and clear, this patch sets > exclude_guest for user-space counting. Applied, and also added this, that you should consider doing in the future (modulo the "Committer testing:" header :) ): Committer testing: Before: # perf record -e cycles:u ^C[ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 1.231 MB perf.data (91 samples) ] # # perf evlist -v cycles:u: size: 120, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|ID|CPU|PERIOD, read_format: ID, disabled: 1, inherit: 1, exclude_kernel: 1, exclude_hv: 1, freq: 1, sample_id_all: 1 # After: # perf record -e cycles:u ^C[ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 1.263 MB perf.data (403 samples) ] # # perf evlist -v cycles:u: size: 120, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|ID|CPU|PERIOD, read_format: ID, disabled: 1, inherit: 1, exclude_kernel: 1, exclude_hv: 1, freq: 1, sample_id_all: 1, exclude_guest: 1 # ---- I.e. show actual command output before and after that demonstrates the problem and then the solution. > Signed-off-by: Jin Yao > --- > tools/perf/util/parse-events.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c > index 9f7260e69113..4d809f1fe269 100644 > --- a/tools/perf/util/parse-events.c > +++ b/tools/perf/util/parse-events.c > @@ -1794,6 +1794,8 @@ static int get_event_modifier(struct event_modifier *mod, char *str, > if (*str == 'u') { > if (!exclude) > exclude = eu = ek = eh = 1; > + if (!exclude_GH) > + eG = 1; > eu = 0; > } else if (*str == 'k') { > if (!exclude) > -- > 2.17.1 > -- - Arnaldo