From patchwork Mon Jan 9 17:02:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 40990 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2268733wrt; Mon, 9 Jan 2023 09:05:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXsEAwfD6PqFP2nsa0iCyunBcvFWCWyTUDXcHGVvjjQGskdkc7sPiLJfgNuEHqAzgK459TN3 X-Received: by 2002:a17:906:1410:b0:7c0:dfb7:4476 with SMTP id p16-20020a170906141000b007c0dfb74476mr52982545ejc.57.1673283929200; Mon, 09 Jan 2023 09:05:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673283929; cv=none; d=google.com; s=arc-20160816; b=e9k5is9dnOhQxGYcmMoX9DrbKP/qBdtHjlm4gQpNzQnm2NOtFgUWKb/pJNnwn04vZJ 8ILnJn1Dk6V8pCfMNqeN3ZRgDGgcqWBWaxuVmNpb57NPQ1a1nc3vMgLA+04o/49lKIsR 4zaI/EkETqFyi+qFTrAT5Q8MJhD8XH0XgV/m2QLUQHxNDWVdYaPTTSSXbdSLy2nHDjSZ KSpMOOqWCvp5m6TpCicntFMUrfY5VvvKmRpL9QBtBwwizsLNzPl48g8Mt52iIg59XHAQ x4s4Mj8OAMsuu+Ps+RpQGXNMCPp9Sv9QaiSA4c29xC3gTl91DTvb6NeG6rujLl7RZaJI wdGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=EZm38wdW5+QOVUucpdsdwwl/TOi/yt5E1upu2Li1qCY=; b=QrrBUJ0PSCoyw+Ppe1hpxJQ67crPFf2etdLXA4j1AceYwHb7+d/0WRMz1024gODFlq 8VByRPmwMDPE2/pDgl9G8GBzGyvxSiElFXR3FQyFgXVv/ZUTO3jBSP7M1dvd04f6efUr T1acp90Xgh2XR6yLrvmG+xkXEgBU3MGGYb8k3eJpxpzz1E4mr0gxmbswubbpaLNHYqAE 1GsJh3w47Kh2yJ5UdPWcUef52HhoOoCWCim9Ar308wQkvRM6MKS7wCPmt4XhN9o37T0Y C19+FJnsxxD0PqszsNQ9ew7KBpbQSo/FXIsiqKL03A7UUOlC/27Ouz623Kn8FsqxW9/6 N02A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=cCBUL4x8; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hx9-20020a170906846900b007c4efab5f0asi7650091ejc.920.2023.01.09.09.05.06; Mon, 09 Jan 2023 09:05:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=cCBUL4x8; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235113AbjAIRDG (ORCPT + 99 others); Mon, 9 Jan 2023 12:03:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237230AbjAIRCP (ORCPT ); Mon, 9 Jan 2023 12:02:15 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87E2F4102D; Mon, 9 Jan 2023 09:02:12 -0800 (PST) Date: Mon, 09 Jan 2023 17:02:09 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1673283729; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EZm38wdW5+QOVUucpdsdwwl/TOi/yt5E1upu2Li1qCY=; b=cCBUL4x8HGnC62fOlgO8uitWTXVGHQWj/puqUAxMxTsQXYmLfMfE8iFyBS/45oFCJBGPYz XdaR43tfZ7Ew3w/kWtP0RGav70RY7Fq4ZRyIKlTRpfJbF3EwoZesH55um+9MwJ2jNISZ/t Ofqm1aR25afDcAmYm1NdRLramtcTlNdCPzqibjTIIqoVeeYBSS46Ve3IAgbL6DOBvDTy0Z fFmwjX9ywPn0ENlKZlAqIPa9cpBmT3589I4HELpI0Ur1gcfD9A4LngpWVWgmnOfguR+S9q jY4uCQDg3zSlLfTuZ/yKHpdYSpoMcKfpCECSdn6Qt3/enOF0BQnv6odzfZQmzA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1673283729; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EZm38wdW5+QOVUucpdsdwwl/TOi/yt5E1upu2Li1qCY=; b=Rr4qhwltgqwkvwPOscWkOznZ3pv9gLBkWOA6fZcDQGmI8uRgkdHRBsbqq2J8iqK6mRmJAr 0aChjyrPlkdWsTAw== From: "tip-bot2 for Kan Liang" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf: Add PMU_FORMAT_ATTR_SHOW Cc: Kan Liang , Ingo Molnar , Peter Zijlstra , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230104201349.1451191-1-kan.liang@linux.intel.com> References: <20230104201349.1451191-1-kan.liang@linux.intel.com> MIME-Version: 1.0 Message-ID: <167328372960.4906.10711570935052964699.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754124329570707684?= X-GMAIL-MSGID: =?utf-8?q?1754565369692119272?= The following commit has been merged into the perf/core branch of tip: Commit-ID: b6c00fb9949fbd073e651a77aa75faca978cf2a6 Gitweb: https://git.kernel.org/tip/b6c00fb9949fbd073e651a77aa75faca978cf2a6 Author: Kan Liang AuthorDate: Wed, 04 Jan 2023 12:13:41 -08:00 Committer: Ingo Molnar CommitterDate: Mon, 09 Jan 2023 12:22:07 +01:00 perf: Add PMU_FORMAT_ATTR_SHOW The macro PMU_FORMAT_ATTR facilitates the definition of both the "show" function and "format_attr". But it only works for a non-hybrid platform. For a hybrid platform, the name "format_attr_hybrid_" is used. The definition of the "show" function can be shared between a non-hybrid platform and a hybrid platform. Add a new macro PMU_FORMAT_ATTR_SHOW. No functional change. The PMU_FORMAT_ATTR_SHOW will be used in the following patch. Signed-off-by: Kan Liang Signed-off-by: Ingo Molnar Acked-by: Peter Zijlstra Link: https://lore.kernel.org/r/20230104201349.1451191-1-kan.liang@linux.intel.com --- include/linux/perf_event.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index c6a3bac..ad92ad3 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -1724,7 +1724,7 @@ static struct perf_pmu_events_attr _var = { \ .id = _id, } \ })[0].attr.attr) -#define PMU_FORMAT_ATTR(_name, _format) \ +#define PMU_FORMAT_ATTR_SHOW(_name, _format) \ static ssize_t \ _name##_show(struct device *dev, \ struct device_attribute *attr, \ @@ -1733,6 +1733,9 @@ _name##_show(struct device *dev, \ BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \ return sprintf(page, _format "\n"); \ } \ + +#define PMU_FORMAT_ATTR(_name, _format) \ + PMU_FORMAT_ATTR_SHOW(_name, _format) \ \ static struct device_attribute format_attr_##_name = __ATTR_RO(_name)