Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1384440rwb; Wed, 7 Dec 2022 12:19:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf60snHIv+elBEvNC+0Q/iS115d4cxHTnHMLG5fL5jidGBmAfF3sDSK7Kfije9lz+X5wLehM X-Received: by 2002:a63:1920:0:b0:478:7e03:1ffe with SMTP id z32-20020a631920000000b004787e031ffemr25677604pgl.209.1670444369749; Wed, 07 Dec 2022 12:19:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670444369; cv=none; d=google.com; s=arc-20160816; b=Ly54l7zOH7DdvIe0eWxS42dAfUpaqxnxXK946Hjy8DLe4hY8bR5U57i5zaNf8neA3f nP3Aq1l7opfznyAr/MhBz7zahZXqXGEiPiY2fSOcX0ytMnG9bb7CO05IEH5oTmNIO+mG OIm4e64aBGVGoOua6GtoyAHK1FSzpqGLRE2J14k3l/vTtfAG/zL4FkwKd5sDxo3KJSBG wA9v3rtfwPYaRNpIK3huLNO5J3ZWzQcIcTpFZ9vtRAxldGbrc14kxo4f77p+Y0ghnJ7+ jcyfwTuMW50dOEER8RMj4q+ov9mSXOw0Aw26yeDHgh82QBwn+UuTDPUpzVu85K5vYQVW 7LLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=0mGRhoGtEKLWqaHD6WMLOg66RZV9tzU6Gk/wzO92dmM=; b=avofgx86I1ENxQXMHuei07PQDHg3F+O0MoS2IIghtsICQnIH7syEcoX5OT2tQML+hz jgFTTUnVypSsCCOpjVZwVUQ4Q1bnZvdJXY285kD/hein4NS2Uuf/+gvvzkHC7VFeeNRb Z0eEPsV2kvgf7w2VRyi/lTbhUSfx5rEXCSzcAoWUqukwQZL4vh925aPntzljeJI4Ov9Z 9Wsv9reskjU2HEc0W30DCtnOyxmmuAYBp9kicNw44RoJtg/9SIIQuN5jkr3OxZBmFVZV v5Za6FJrhg1ygOj2TUdMh+gEsbXn8ExKzh5JvTylE/p9s/TI13MFZgka+qsAlyVHbBin nxGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ObplL2g8; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t5-20020a63b245000000b00477ffa1aaf7si23785050pgo.50.2022.12.07.12.19.20; Wed, 07 Dec 2022 12:19: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=@kernel.org header.s=k20201202 header.b=ObplL2g8; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229589AbiLGT5J (ORCPT + 75 others); Wed, 7 Dec 2022 14:57:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbiLGT5G (ORCPT ); Wed, 7 Dec 2022 14:57:06 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1FDE5E3CD; Wed, 7 Dec 2022 11:57:05 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3C7D861BAF; Wed, 7 Dec 2022 19:57:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95CFCC433D7; Wed, 7 Dec 2022 19:57:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670443024; bh=AvmeQtrnl7xMXtEnD6viJTvtLqEQcfiUyyyKZl/KgUI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ObplL2g8TxTO5JJOjfNmVoA6K7NHMQs2vaoeQ8u0mEZIQu8gLeqCx6d8mgaTga/BN bc376wJENHG5Zx2mALAkvG9AD8eEcU2D2t+zU/g2gWfdHcB+YvjaUhf1eAM4ah9E6g HxlHuQI1pnrpq56qd7fAIykbUO5dDDDDSSM2TpXQ+cHruqik5wqddbEmqONurSgYoO iIs1QIs5quM6sNqIBbuV5a9PcQuIdKGKk2qlEiYFZqBY7GCJgFBA+/Q67aNSN+fjOe TkuSnoXCog3/5QBkPYZiRnsqQ73zm7umoQBu2qcR0AedfrMHeLNUMMMLfwy05q6xsL 0hLaOMGk22yRw== Received: by mail-vk1-f173.google.com with SMTP id z23so4818562vkb.12; Wed, 07 Dec 2022 11:57:04 -0800 (PST) X-Gm-Message-State: ANoB5pmXKTUU3z7RyEUdmyfNBWmcM12whZa7hI2gKV/vMGb8SyYDmGGX 2RbvxMiweIn/78pHXF2wYsHQRIsvgnNpOfCNEw== X-Received: by 2002:a1f:41ca:0:b0:3bd:ce89:f4e6 with SMTP id o193-20020a1f41ca000000b003bdce89f4e6mr4493288vka.26.1670443023467; Wed, 07 Dec 2022 11:57:03 -0800 (PST) MIME-Version: 1.0 References: <20220825-arm-spe-v8-7-v3-0-87682f78caac@kernel.org> <20220825-arm-spe-v8-7-v3-7-87682f78caac@kernel.org> <20221118164943.GA4872@willie-the-truck> <877czfujdj.fsf@ubik.fi.intel.com> In-Reply-To: From: Rob Herring Date: Wed, 7 Dec 2022 13:56:52 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 7/8] perf: Add perf_event_attr::config3 To: Mark Rutland Cc: Peter Zijlstra , Alexander Shishkin , Will Deacon , Arnaldo Carvalho de Melo , Ingo Molnar , Namhyung Kim , Jiri Olsa , Catalin Marinas , Marc Zyngier , Oliver Upton , Suzuki K Poulose , James Morse , Alexandru Elisei , kvmarm@lists.linux.dev, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, James Clark , Mark Brown , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 On Tue, Dec 6, 2022 at 10:28 AM Mark Rutland wrote: > > Peter, it looks like this series is blocked on the below now; what would you > prefer out of: > > (a) Take this as is, and look add adding additional validation on top. > > (b) Add some flag to indicate a PMU driver supports config3, and have the core > code check that, but leave the existing fields as-is for now (and hopefully > follow up with further validation later for the existing fields). That looks something like this: diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 853f64b6c8c2..845162b152ea 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -286,6 +286,7 @@ struct perf_event; #define PERF_PMU_CAP_NO_EXCLUDE 0x0080 #define PERF_PMU_CAP_AUX_OUTPUT 0x0100 #define PERF_PMU_CAP_EXTENDED_HW_TYPE 0x0200 +#define PERF_PMU_CAP_CONFIG3 0x0400 struct perf_output_handle; diff --git a/kernel/events/core.c b/kernel/events/core.c index aefc1e08e015..4414ae64432a 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -11314,6 +11314,9 @@ static int perf_try_init_event(struct pmu *pmu, struct perf_event *event) event_has_any_exclude_flag(event)) ret = -EINVAL; + if (!(pmu->capabilities & PERF_PMU_CAP_CONFIG3) && event->attr.config3) + ret = -EINVAL; + if (ret && event->destroy) event->destroy(event); }