Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1879396ybv; Sun, 23 Feb 2020 17:29:27 -0800 (PST) X-Google-Smtp-Source: APXvYqzg5d7c6jbP1X4VvVvzUJr49H3sxAi8Nxv6p4iit/1w5g4xGvOtxBo3FXpleEATF63Y6977 X-Received: by 2002:a9d:7304:: with SMTP id e4mr35315270otk.99.1582507767100; Sun, 23 Feb 2020 17:29:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582507767; cv=none; d=google.com; s=arc-20160816; b=Clie+L5CXhxPzobdpH3w/V8Jxfa5lKu8TEvdSU2rXPmh2G2PBREdIvxz3ug1node+e TXBTWH/bx7jdc849uqYuQEUeV8jN1j+tUueyXEfHDXKOMlyksTHvhNzD+pKepGpkkWtr IuHKWf05pUIXnlKq4A/ch13lwqK6h7CvNKYHY6ONe57klcmb6Z//H2S9zHTlDq0O6j4C 7YO95FVMMXZCSclh4pgxdJRqbncvq99GtSVwZC5mD4WE4M8ENSz4RyyJg5/aK5QjWN+d sqZWfI0mhFZn3OHZ502PXMyDvq3fzjVloVWYBsSIlgCQ8ANo55sdHE5TD+eEjg291y59 JixQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:to:subject:reply-to; bh=o8NLiethFY1nl1XzydG2H9BlhZrD6RzEUmnQ7HyVgXw=; b=lGU/EiUQFCofMlQs+GviJbJAvgSisc6XowZ7f2bjyRK7F82ngWk9vXrJADsxCpnJlK TQbvoRjdQWpFNLVvKewj6veLt7mDPp6mPdybbtrRV3rq9/ZhIJgrKgepegW1vbVQveX3 tDgx/paSW+Q9SxDSecWeMJZcRcjn0b+PDucfeAF66wXE35RrlAeZxjUYU0Li+hhMNnel OFCvwDzMFCQ+IJqh3QXyxfJ7ocvB1g3yPMYz0MiBgDw4W67uuieCLIxuYxO+nd6oP53/ f8GKxC16wFQ5wWCA9HVy4pQWdbP+JwiuUdzxTmrA5u2hV0eXO3eSWeUDKOMbQV37oG7S CymA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d20si5434339oti.311.2020.02.23.17.29.15; Sun, 23 Feb 2020 17:29:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727193AbgBXB2i (ORCPT + 99 others); Sun, 23 Feb 2020 20:28:38 -0500 Received: from mga07.intel.com ([134.134.136.100]:16750 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727151AbgBXB2h (ORCPT ); Sun, 23 Feb 2020 20:28:37 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Feb 2020 17:28:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,478,1574150400"; d="scan'208";a="255428790" Received: from unknown (HELO [10.238.4.82]) ([10.238.4.82]) by orsmga002.jf.intel.com with ESMTP; 23 Feb 2020 17:28:36 -0800 Reply-To: like.xu@intel.com Subject: Re: [Ask for Help]LBR usage in kernel To: =?UTF-8?B?6ZmI5byL5466?= , linux-kernel@vger.kernel.org, linux-x86_64@vger.kernel.org References: <3dad7270.821a.17062dfcb99.Coremail.jasoncyx@163.com> From: "Xu, Like" Organization: Intel OTC Message-ID: Date: Mon, 24 Feb 2020 09:28:35 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <3dad7270.821a.17062dfcb99.Coremail.jasoncyx@163.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi 弋玺, On 2020/2/20 21:53, 陈弋玺 wrote: > Hi experts, > We want to try to retreive callchains of some perf events from LBR rather than frame stacks, as the information in frame stacks would be optimized by compiler. After investigating the usage of LBR in kernel, we found that LBR can only operated via Intel PMU, The default driver to operate LBR on the Linux is the PMU deriver, which is one of perf feature ofs and I assume you know about its basic usages.     perf record -b ./workload     perf record --call-graph lbr ./workload Other performance monitoring tools like Emon, VTune and other non-opensource commercial tools in Ring 0 could operate LBR as well. > that means for now only callchains of hardware events can be retrieved from LBR. Is that correct? the callchains and the basic branch records in sampling mode. > > If yes, I wonder if callchains of other perf events(eg. tracepoint, software events) can be retrieved from LBR? Software events like trace points are not retrieved from LBR, but you could wrapper them with intentional branch instructions changes. > Or only callchains of events on PMU can be retrieved from LBR as there are some hardware restrictions? I won't say its hardware restrictions but intentional behavior. It's all about your innovative ideas to operate LBR for your purpose. Thanks, Like Xu > > Thanks for any help you can offer! > > Best Regards, > Yixi Chen