From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.6 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69703C433E0 for ; Fri, 5 Feb 2021 13:52:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0DE6064DF6 for ; Fri, 5 Feb 2021 13:52:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231535AbhBENwN (ORCPT ); Fri, 5 Feb 2021 08:52:13 -0500 Received: from mga05.intel.com ([192.55.52.43]:15641 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231449AbhBENsO (ORCPT ); Fri, 5 Feb 2021 08:48:14 -0500 IronPort-SDR: VhsCdSkz5nl2OhlnVTwR6p1AxrMnCskjHnyx/grJ5Y0W4CUjxZSu9EWENgqv90/fnfLB2oPTqU ZiwC52/bVjKQ== X-IronPort-AV: E=McAfee;i="6000,8403,9885"; a="266261858" X-IronPort-AV: E=Sophos;i="5.81,154,1610438400"; d="scan'208";a="266261858" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2021 05:46:02 -0800 IronPort-SDR: DoTquzvhTq1CvAtbZbu34YKcrxqL0urd3JEIlGJA+/8eofvvXYPZly4DXny7ENvBwEsC49H7Bc P5Mw3hx2nZ1w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,154,1610438400"; d="scan'208";a="373396890" Received: from linux.intel.com ([10.54.29.200]) by orsmga002.jf.intel.com with ESMTP; 05 Feb 2021 05:46:01 -0800 Received: from [10.254.80.1] (kliang2-MOBL.ccr.corp.intel.com [10.254.80.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by linux.intel.com (Postfix) with ESMTPS id 703AB580689; Fri, 5 Feb 2021 05:46:00 -0800 (PST) Subject: Re: [PATCH V3 1/5] perf/core: Add PERF_SAMPLE_WEIGHT_STRUCT To: Namhyung Kim Cc: Peter Zijlstra , Arnaldo Carvalho de Melo , Ingo Molnar , linux-kernel , Stephane Eranian , Jiri Olsa , Andi Kleen , Yao Jin , Michael Ellerman , maddy@linux.vnet.ibm.com References: <1611873611-156687-1-git-send-email-kan.liang@linux.intel.com> <1611873611-156687-2-git-send-email-kan.liang@linux.intel.com> <4723a1de-9caa-e192-7b0d-8aced00b8f50@linux.intel.com> From: "Liang, Kan" Message-ID: <8d8b7323-7e99-b8c6-fbc1-813ecff0e844@linux.intel.com> Date: Fri, 5 Feb 2021 08:45:59 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/5/2021 5:43 AM, Namhyung Kim wrote: > On Fri, Feb 5, 2021 at 12:24 AM Liang, Kan wrote: >> >> On 2/4/2021 9:00 AM, Namhyung Kim wrote: >>> Hi Kan, >>> >>> On Sat, Jan 30, 2021 at 2:25 AM Liang, Kan wrote: >>> [SNIP] >>>> diff --git a/include/uapi/linux/perf_event.h >>>> b/include/uapi/linux/perf_event.h >>>> index b15e344..c50718a 100644 >>>> --- a/include/uapi/linux/perf_event.h >>>> +++ b/include/uapi/linux/perf_event.h >>>> @@ -145,12 +145,14 @@ enum perf_event_sample_format { >>>> PERF_SAMPLE_CGROUP = 1U << 21, >>>> PERF_SAMPLE_DATA_PAGE_SIZE = 1U << 22, >>>> PERF_SAMPLE_CODE_PAGE_SIZE = 1U << 23, >>>> + PERF_SAMPLE_WEIGHT_STRUCT = 1U << 24, >>>> >>>> - PERF_SAMPLE_MAX = 1U << 24, /* non-ABI */ >>>> + PERF_SAMPLE_MAX = 1U << 25, /* non-ABI */ >>>> >>>> __PERF_SAMPLE_CALLCHAIN_EARLY = 1ULL << 63, /* non-ABI; internal use */ >>>> }; >>>> >>>> +#define PERF_SAMPLE_WEIGHT_TYPE (PERF_SAMPLE_WEIGHT | >>>> PERF_SAMPLE_WEIGHT_STRUCT) >>> >>> I'm not sure you want to expose it in the uapi header as it's not >>> intended to be used IMHO. >>> >> >> I'm not sure I understood, but it's indeed used in the tool patch set. >> >> https://lore.kernel.org/lkml/1612296553-21962-6-git-send-email-kan.liang@linux.intel.com/ > > Well, it's not a big deal.. but I just worried if some users might do > > event.attr.sample_type = PERF_SAMPLE_WEIGHT_TYPE; > Yes, it's possible. For this case, Kernel returns -EINVAL. Actually, even without the macro, users may still set PERF_SAMPLE_WEIGHT | PERF_SAMPLE_WEIGHT_STRUCT manually. We cannot control what a user sets. I don't think it's a problem as long as the kernel can handle it properly. Thanks, Kan