Message ID | 3124e8c276a1f513c1a415dc839ca4181b3c8bc8.1680522545.git.robin.murphy@arm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2243345vqo; Mon, 3 Apr 2023 05:00:46 -0700 (PDT) X-Google-Smtp-Source: AKy350YXzIr6qN+bAHewuAPiFICSXbEKof+FEoUhhBYsFnp74CozOgkbt6BaidR6cILAxTrL0RDM X-Received: by 2002:a17:906:688b:b0:92f:f655:cc78 with SMTP id n11-20020a170906688b00b0092ff655cc78mr34312935ejr.53.1680523246159; Mon, 03 Apr 2023 05:00:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680523246; cv=none; d=google.com; s=arc-20160816; b=nRrKRC/CizVpWYZZ7vTzr9nAf4IPugeL409Aqm+Vhj/rqkfOG/mjdOHVZaUo3u3gpz xHqMXdNFxNI3tGa2LdJ8w4Dc++afwZvjqUICkqO+rLaUCQ7hsJXx6ll3e9FsjVT4Wlr1 KZcUjth10ao87M4u/wZVl8+7Vu6+SQMeGTfuMpmsHTd7zMyHTh5/fbJIZ/fFqVe7hK12 StNZvWHhnNrkHeHJGjN02y1+Se/plqukQzFxI7cDIVyedl9CxnyWQs04O3Um3qq0jpU0 o6GSS/LLOG89Yfe2yck1MxCa4JCQ9LwJWUlWgPGKDLA4KyLqVy77Obyq1x3uUlkLoOcV kuiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=+9NEJKutNQRC3lO0K69vzyz/epgSipU/RnoPt0dhY6o=; b=idS46qaoKybVkQAuvexwSGuLKSbSrVxkiw75ghrgXwfD4h0kJ3ZGKnJeqYhOyE8Cdm DZRZnUkTwL2Kr4xdxe25JPpiuUylmIDbtnzJe8p8Aeq1eqBftxi6I2kNsb3B6xhKHcWv jXsguPz7fDYXD2hqkDZrl37YvoRQxSBNO7RwCHZGJmyUrx6chDSlM4FWGCHCd4aTqTYu KBYJhb+5zdAK4gjUe2gCv0YnGlalpdHjTRqxxWvnpW1oa7utmM6EKPNIvH67RawETqSr WxjPQnU+uAb8EaTPZOfrgepq2oNopf6mRyMhiPnxvhDnqTFRBwkOdPs1Jt/6Ui1vk5a3 mqAA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k3-20020a1709063e0300b0092451ed6ef8si4095232eji.932.2023.04.03.05.00.21; Mon, 03 Apr 2023 05:00:46 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232066AbjDCLtO (ORCPT <rfc822;zwp10758@gmail.com> + 99 others); Mon, 3 Apr 2023 07:49:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231549AbjDCLtM (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 3 Apr 2023 07:49:12 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DE41030F6 for <linux-kernel@vger.kernel.org>; Mon, 3 Apr 2023 04:49:10 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 275091063; Mon, 3 Apr 2023 04:49:55 -0700 (PDT) Received: from e121345-lin.cambridge.arm.com (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id F37DF3F6C4; Mon, 3 Apr 2023 04:49:09 -0700 (PDT) From: Robin Murphy <robin.murphy@arm.com> To: will@kernel.org Cc: mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] perf/arm-cmn: Validate cycles events fully Date: Mon, 3 Apr 2023 12:49:05 +0100 Message-Id: <3124e8c276a1f513c1a415dc839ca4181b3c8bc8.1680522545.git.robin.murphy@arm.com> X-Mailer: git-send-email 2.39.2.101.g768bb238c484.dirty MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762156343771256340?= X-GMAIL-MSGID: =?utf-8?q?1762156343771256340?= |
Series |
perf/arm-cmn: Validate cycles events fully
|
|
Commit Message
Robin Murphy
April 3, 2023, 11:49 a.m. UTC
DTC cycle count events don't have anything to validate or initialise in
themselves, but we should not forget to still validate their whole group
context. Otherwise, we may fail to correctly reject a contrived group
containing an impossible number of cycles events.
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
drivers/perf/arm-cmn.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Mon, 3 Apr 2023, Robin Murphy wrote: > DTC cycle count events don't have anything to validate or initialise in > themselves, but we should not forget to still validate their whole group > context. Otherwise, we may fail to correctly reject a contrived group > containing an impossible number of cycles events. > > Signed-off-by: Robin Murphy <robin.murphy@arm.com> Looks good to me and works as expected. Cheers, Ilkka > --- > drivers/perf/arm-cmn.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c > index 367d41c5d983..45819528facb 100644 > --- a/drivers/perf/arm-cmn.c > +++ b/drivers/perf/arm-cmn.c > @@ -1558,7 +1558,7 @@ static int arm_cmn_event_init(struct perf_event *event) > type = CMN_EVENT_TYPE(event); > /* DTC events (i.e. cycles) already have everything they need */ > if (type == CMN_TYPE_DTC) > - return 0; > + return arm_cmn_validate_group(cmn, event); > > eventid = CMN_EVENT_EVENTID(event); > /* For watchpoints we need the actual XP node here */ > -- > 2.39.2.101.g768bb238c484.dirty > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel >
On Mon, 3 Apr 2023 12:49:05 +0100, Robin Murphy wrote: > DTC cycle count events don't have anything to validate or initialise in > themselves, but we should not forget to still validate their whole group > context. Otherwise, we may fail to correctly reject a contrived group > containing an impossible number of cycles events. > > Applied to will (for-next/perf), thanks! [1/1] perf/arm-cmn: Validate cycles events fully https://git.kernel.org/will/c/23b2fd839489 Cheers,
diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c index 367d41c5d983..45819528facb 100644 --- a/drivers/perf/arm-cmn.c +++ b/drivers/perf/arm-cmn.c @@ -1558,7 +1558,7 @@ static int arm_cmn_event_init(struct perf_event *event) type = CMN_EVENT_TYPE(event); /* DTC events (i.e. cycles) already have everything they need */ if (type == CMN_TYPE_DTC) - return 0; + return arm_cmn_validate_group(cmn, event); eventid = CMN_EVENT_EVENTID(event); /* For watchpoints we need the actual XP node here */