Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1277741pxb; Fri, 21 Jan 2022 14:09:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJx8F+YS/c5FWhAHlztHhuLHprKIQs1XHEqXMjDhvDRscdFzT5B5boz0JT/fGgjw7MXwbOUr X-Received: by 2002:a05:6a00:124c:b0:4ba:1288:67dc with SMTP id u12-20020a056a00124c00b004ba128867dcmr5507781pfi.43.1642802946177; Fri, 21 Jan 2022 14:09:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642802946; cv=none; d=google.com; s=arc-20160816; b=vlYT/pSY1SWD7fZpFav1WXJAJ8pchy4JX4j4KUFRnm4vS6E0ktoHN7Yf1OFrZszO5o HEW2/oMx6IrN89KxVAq5ozdoxaWcHrmUcXOQCCSz49FjrQWzJqzRuqZ400xk8t8b43v0 67r3pmz9ybb0Qnj8BKkuPwBw689zgL9j/hilSDpfRRAHU/EFOPf7qGvmKrYdpl6k419K A39S8QqxcM9BmfMLxMxIwpAsN5rvUlQrYBrFiprXAUTKV6+dKhRoe1w8CDF1uaKeQixn EQw7rgXxmw68YK8E8/9+RxXp6U+3SKLllJUJFtHr8BrrAliA4yVqmemNA+yuDJqDCqMW FKqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=yUW2meWg5OLvz//LwavLlfc7na/3LKc5cqojegOb3/c=; b=Dny2x+UNz+r8bN7oluoqGLI4Y2py2HdDavUDUl1X9Ke+TCdAlvYvRH95Vf8Ht4x199 2STRT3SwzHxzkiNJrflYj7E45BrzGuTGOl9Z//xnT+12eNL1dEiefSxJZEVnE17yzCoJ BhmxiLT+YgskxVY7I6zk60IvUbgZtUaspSOQj2ZnCsWIrRBNO/u8iIxO4AkzO4L+Rs+Q qB5eYV4XmmgT9BT/8qETJbaSXghFP1iyNWXyorfbqsTHFmzDzZYMnonUlBrajh/DjNnL 4TnoW538hs/4u2nHg7VWzNKCaLhR6bVALNQRkMUKxPlPjMZnVy6U1kGJpMl1cBQP8zyT j1NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=WF7bL4I1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z14si7292715pgo.442.2022.01.21.14.08.53; Fri, 21 Jan 2022 14:09:06 -0800 (PST) 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=@sifive.com header.s=google header.b=WF7bL4I1; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238523AbiATNgN (ORCPT + 99 others); Thu, 20 Jan 2022 08:36:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229664AbiATNgL (ORCPT ); Thu, 20 Jan 2022 08:36:11 -0500 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B8EDC06173F for ; Thu, 20 Jan 2022 05:36:11 -0800 (PST) Received: by mail-pl1-x62b.google.com with SMTP id c3so5223944pls.5 for ; Thu, 20 Jan 2022 05:36:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yUW2meWg5OLvz//LwavLlfc7na/3LKc5cqojegOb3/c=; b=WF7bL4I14qBhW2FNg9LW9XFoQ0NYbf5Mr6wONjTv5s8d5RdkQ3IvuebvI5CvOmRbST 5ZUuICBHB6peiMKpjp6+vEeYj9aqw8wrRqPlbTSZaou3I1CE1qSkFGKopSd/3ZkOk/yU faEzmOFcYagv6d9wWzkOCd074azLgS72uNRSYbxsU/WRIj5Vh771BgpSxHMJ5zbZQY4y EkgsjojvKwyfuH6ENLTkREX9k0CS/mCDwrdGglke8LiQ4kff8uVNEcUSJzrJqvdt2RXM 9m3e8Jz5RFGLlVUPbJbLBIzIaEmuQoll0FY2sHlktkVH2cA1ZMelQ6T+NPoQ8q3vFkv8 UHfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yUW2meWg5OLvz//LwavLlfc7na/3LKc5cqojegOb3/c=; b=CzP0Tl20KVs3Iag01j6JL3qljz5zKLd8Vaf3kCBhj7xwvQze1PylH0H5A+zypfZeRL /BK066CShQaQgAVpVLR4hUGZwXi1OxCNF6CtgEpLS+ri9+OL5Ala+EkKoE1LCjOxsWzP OPj33Q1PI4vuhPBIKdE8onajGCEPBT0p1rznH7EyPBRbTcgiyOZoUIgw8S1V/iCkZFPI Roeyk77qIq2eiRpKc8TOyjr7b5Ic/gUypkgRdBi5A+1ixPNlpEffe6hE19zNFcPCp7PW i/NXWo/Obfg4rc5EavlsvvRLZWux2YMfghgjBhBwqp4jc9RE+eYXPWhFsQCLtP1nZrPj Xftg== X-Gm-Message-State: AOAM533O3lX3VCa4DbzHBcskgFWQk4UdadiAYzDz/qqQdKiKtu2Gpm8a 1lpjDngAEwDcg2wCDo+tkDgdGB4JN+KhoKkDWbi6bg== X-Received: by 2002:a17:902:e792:b0:14a:ff44:41c6 with SMTP id cp18-20020a170902e79200b0014aff4441c6mr5476077plb.111.1642685770783; Thu, 20 Jan 2022 05:36:10 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Eric Lin Date: Thu, 20 Jan 2022 21:35:59 +0800 Message-ID: Subject: Re: About perf tool set exclude_guest = 1 on guest environment To: Namhyung Kim Cc: linux-kernel , Jiri Olsa , Alexander Shishkin , Mark Rutland , Arnaldo Carvalho de Melo , Ingo Molnar , Peter Zijlstra , Yao Jin , Greentime Hu , Paul Walmsley , Vincent Chen Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Namhyung, On Wed, Jan 19, 2022 at 1:02 PM Namhyung Kim wrote: > > Hello, > > On Mon, Jan 17, 2022 at 8:05 PM Eric Lin wrote: > > > > Hi all, > > > > Currently, I run the perf command 'perf record -e branches:u ls' and > > 'perf record -e branches ls'. It will set exclude_guest = 1 as below: > > > > # perf record -e branches:u ls > > # perf evlist -v > > branches:u: .., exclude_kernel: 1, exclude_hv: 1,, exclude_guest: 1, .. > > > > # perf record -e branches ls > > # perf evlist -v > > branches: ..., exclude_guest: 1, ... > > > > As I understand it, set exclude_guest =1 will not include guest counting. > > May I ask if I run the above commands as a guest user, should the > > architecture implementation ignore this exclude_guest flags and still > > make perf can count guest events in Linux kernel? > > So do you want to run the command in the host? > Then you can use both 'H' and 'G' modifiers like > > # perf record -e branches:HG ls > > or (for user-mode only) > > # perf record -e branches:uHG ls > Actually, I want to run the commands in the guest. But when I run the commands "perf record -e branches:u ls" and "perf record -e branches ls", it will set exclude_guet = 1. According to the documentation[1] exclude_guest definition, it should not count guest events. So, if I run these commands as a guest user can I get the profile data? [1] https://man7.org/linux/man-pages/man2/perf_event_open.2.html Thanks, Eric Lin > Thanks, > Namhyung