From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935411AbdDFOnk (ORCPT ); Thu, 6 Apr 2017 10:43:40 -0400 Received: from mga02.intel.com ([134.134.136.20]:34474 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755841AbdDFOnX (ORCPT ); Thu, 6 Apr 2017 10:43:23 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,160,1488873600"; d="scan'208";a="1152120636" Subject: Re: [PATCH v1 1/5] perf/core: Define the common branch type classification To: Peter Zijlstra Cc: Arnaldo Carvalho de Melo , 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> <20170406092532.4zpuvqawrxjvadm6@hirez.programming.kicks-ass.net> From: "Jin, Yao" Message-ID: <57af142d-92d0-5d0f-1ddb-f27f122ae752@linux.intel.com> Date: Thu, 6 Apr 2017 22:43:19 +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: <20170406092532.4zpuvqawrxjvadm6@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 5:25 PM, Peter Zijlstra wrote: > On Thu, Apr 06, 2017 at 04:21:06PM +0800, Jin, Yao wrote: >> 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. > I still don't understand what you want; or why it would matter. > > Those specific macros are for hardware LBR filter emulation/fixup. What > does that have to do with any userspace crud? I just want to provide a new feature that the user can directly check branch type in perf report, instead of looking it up in the binary. Binary could be not available later, so it's possible that userspace can't get the branch type. The X86_BR are generated when disassembling the branch instruction in kernel. They can be considered as the x86 branch types. It's easy to let kernel return the x86 branch types to userspace, and then userspace shows the branch type in perf report. While kernel and userspace have to maintain the X86_BR definitions. One copy is in kernel and the other copy is in userspace. To avoid the duplicate definitions , I define the common branch type in perf_event.h to share between kernel and userspace. That's why I do that. Thanks Jin Yao