From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753261AbdDFIV0 (ORCPT ); Thu, 6 Apr 2017 04:21:26 -0400 Received: from mga06.intel.com ([134.134.136.31]:23073 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752465AbdDFIVL (ORCPT ); Thu, 6 Apr 2017 04:21:11 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,283,1488873600"; d="scan'208";a="842562750" Subject: Re: [PATCH v1 1/5] perf/core: Define the common branch type classification To: Peter Zijlstra , Arnaldo Carvalho de Melo Cc: Jiri Olsa , linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com, Alexander Shishkin , Ingo Molnar References: <1490973522-5499-1-git-send-email-yao.jin@linux.intel.com> <1490973522-5499-2-git-send-email-yao.jin@linux.intel.com> <20170404141805.GA12903@kernel.org> <20170406065850.kziehynhayizgtk2@hirez.programming.kicks-ass.net> From: "Jin, Yao" Message-ID: Date: Thu, 6 Apr 2017 16:21:06 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: <20170406065850.kziehynhayizgtk2@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/6/2017 2:58 PM, Peter Zijlstra wrote: > On Tue, Apr 04, 2017 at 11:18:05AM -0300, Arnaldo Carvalho de Melo wrote: >> Adding the perf kernel maintainers to the CC list. > Thanks. > >> Em Fri, Mar 31, 2017 at 11:18:38PM +0800, Jin Yao escreveu: >>> It is often useful to know the branch types while analyzing branch >>> data. For example, a call is very different from a conditional branch. >>> >>> Currently we have to look it up in binary while the binary may later >>> not be available and even the binary is available but user has to take >>> some time. It is very useful for user to check it directly in perf >>> report. >>> >>> Perf already has support for disassembling the branch instruction >>> to get the branch type. The branch type is defined in lbr.c. >>> >>> To keep consistent on kernel and userspace and make the classification >>> more common, the patch adds the common branch type classification >>> in perf_event.h. >>> >>> Since the disassembling of branch instruction needs some overhead, >>> a new PERF_SAMPLE_BRANCH_TYPE_SAVE is introduced to indicate if it >>> needs to disassemble the branch instruction and record the branch >>> type. > I don't get it. Why is the kernel interface mucked with for a user-space > feature? > > That's wrong. Hi, otherwise we have to maintain 2 branch type copies between kernel and user-space. For example, currently X86_BR_* are defined in lbr.c. To display the branch type in user-space, the user-space has to maintain the same copy for X86_BR_*. I didn't get a better idea. Thanks Jin Yao