From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E04D8606A325 for ; Mon, 30 Nov 2026 13:18:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=42fI+lvs; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=zuua/v0a DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=XgGnDQl5Oxy5GXjm+XdGlci66/50Rko95zK0QviHLWg=; b=42fI+lvsVPOBRd c12x2h2CxJsOuf118yNP5xhi9r4cbcy2vi+dYyEjBoIOUM9VjxGFlvDzhgY/6pMQb4dnPePkNCdHu fjgG6vidc4U20rcf4VuVaYGj5qRak+EAX843B7aNqN49WEsYf1IDMOU/IcHUiTExc7nPVVDFEaJCf G+uKlgLvcfmz/r8Mrvl1lYp7W8ijWAs6PlrGJ0J7H6mG4riAjPqVgvBT9MwpkNO+9Y9UlgtbRKfAZ qZl0+++nsq903yMXVpAQpR0rAb7CB/Ey0WTcjM4zn5PZHWpYY0xKYGMcFoGhByH3wZoTEm9XZgimv GQIWnfHMRyq+2gZjjSnQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xY1Ga-00000004gDG-3KRy; Mon, 30 Nov 2026 13:18:00 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xY1GV-00000004gBo-3sxo for linux-arm-kernel@lists.infradead.org; Mon, 30 Nov 2026 13:17:58 +0000 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-2f037bc348dso82008315ad.0 for ; Mon, 30 Nov 2026 05:17:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796044675; x=1796649475; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=XgGnDQl5Oxy5GXjm+XdGlci66/50Rko95zK0QviHLWg=; b=zuua/v0a5ke5U+Xpj9myQzfu2dwRGuu51BlxY2pR2BtxFV6IXAHzN3UervfHt9sddD wBT1nGnyQiO97IHDWkchG4PaTLRD1Jj+OD3ZQTl2nDumoQq8MaYnlGdfR+rVhXD2Yt1Y vdSGSTCAEeOyZrGP9LIAknpfbrifZdjWEvc5GB87QTznpq2W1PJlpWyuSnS2VBlmWbss OCDnjU/XvaYVz9U2e+PtFuAdX1eF/FnDNm8xLypikZJpr4L9doaKN0FA+m7A1rMbSTG4 fsLV9qmKODrfcwcCZDXDCER4PW3NVGfinx1DrVa81UUA/ndeuJLCY3OrWjGAraS1+O1R gxjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796044675; x=1796649475; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=XgGnDQl5Oxy5GXjm+XdGlci66/50Rko95zK0QviHLWg=; b=wcyRt8LCmjroXklVxKNyR+8FB53ZUFZR43atuJdYzrVfAZccHbtpNkxYg2aYxQvXJV +semaNsZScOT++/wCDcIOhSyGJKA0fE981RRjpmuqzhRLWtsjriJhNA22xKUxCP8vrCa voibHbzSEBbEilTL8S0ibGVbie8RaMW6sO/W+tBltWStE7JJXJW0o3FVepGuetqASR2v qFVAD/s6xW1CjRjwdYqybecjRJGqLIFpN19GA9QBzSpoXFCLZzQLTrqr3h0l8jwmPM7W 13f094ot6r/V3NzyMVgFbo96ziZYhAOcQnynwI9skwZUcSSmynyHu4Wiol5WDTS6JfO3 adjg== X-Forwarded-Encrypted: i=1; AL+hErGNxqo89HUCjyZq07Q8hV475gW0FeAIT83dCe3k5ww9lsXbZIOQeZzX+MeEKr0bXtKO4jrzChS7iu/JpQA0xtt1@lists.infradead.org X-Gm-Message-State: APuU4Z///wK7PAY1midDJC30u7OnNk+n3yVqkCJFQeZLdhR9kE3pDUYV f7Jh3qE9ylcR6vqFYog0YG/fXRZGpZE3U2cSkJ1mOaIBFExFhl9c4mQB X-Gm-Gg: AZFdTZebfvgLzusEo9GeCq/Fkx25OOGEbpkeOxZEiiG9mA3v8vB+7+T9lBeASsoYeqO js9lrL5SBfGisfepz4QxS7dILd0NWk7XFHPUr9mimBT6c+tOJ6wZ9JKjS3OKpQHvWhlyWJJPOjx UkO9H0jSK95YpEXK2RJq6qUq0he+KSrfHyk9IWdcIBIenZv1gHuvtSTQlzLH8E81sK3hx890nuk fQDvCAHfS8Quob7HsZefFiQckEZjuBJcpwT5inDe7o4LGc20c2yGPa7IDMXiCwaY8+b64MiT8VB UWfVL4rsdR8FJBtvcM/BZZdkskXOG3x9H3U7cBKc5bNig7PM1nbmFQkJJBLYHvEZQynXeFiGe5j Z7+3SxoV3tJUt7ZPCbwe2v8g/haJBElQTYrEkkxPp6Ud37GI/SX5Z/y8kZtooHBGc59VphBo2Tk 0KA4oSBfwqNr6Y5n3psNO9zEejZjU3VVScUgXFa3oI8JGrZzVR+HKhJzCdIcGiCafsArFbbl/XI cttASy1X1ICoOXoBYgyEWhZsQ/lmLXdBmhymc0Pk4fc9aHwtxs8Dp+Eb7ZxivIGCf+3fdT57208 Gp+kSK1E8jcqI2Lw5g8ngIRXhV+moBrHxaA= X-Received: by 2002:a17:902:ef4c:b0:2d9:4358:73ab with SMTP id d9443c01a7336-2f03f1cfb63mr338669775ad.19.1796044674786; Mon, 30 Nov 2026 05:17:54 -0800 (PST) Received: from server225.. ([39.170.101.209]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2f06c02a92esm146486645ad.40.2026.11.30.05.17.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 05:17:54 -0800 (PST) From: Ping Li To: leo.yan@arm.com Cc: leeonion.muyu@gmail.com, will@kernel.org, mark.rutland@arm.com, robh@kernel.org, james.clark@linaro.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] perf: arm_spe: Validate the data source filter per-bit Date: Mon, 30 Nov 2026 21:17:48 +0800 Message-Id: <20261130131748.1487948-1-leeonion.muyu@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <"20261130104035.GJ861809@e132581.arm.com"> References: <"20261130104035.GJ861809@e132581.arm.com"> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261130_051755_964080_72C87CC3 X-CRM114-Status: GOOD ( 13.59 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 From: leeonion.muyu@gmail.com Hi Leo, Thanks for looking at this. I actually spent quite a while on the direction when Sashiko first flagged it, so let me lay out my reasoning with a concrete config - happy to reshape if I have something wrong. Assume an implementation where PMSDSFR_EL1 implements bits 0-7 and bits 8-63 are RAZ/WI. Probing gives: write 0xffffffffffffffff, read back 0x00000000000000ff pmsdsfr_res0 = 0xffffffffffffff00 so bits 8-63 ignore writes and always read 0. Per DDI 0487 D17.5.4, a sampled load with data source DS is "recorded only if PMSDSFR_EL1[UInt(DS[5:0])] is 1", so while the filter is enabled, sources 8-63 are never recorded. Example: inv_data_src_filter=0x8 (exclude source 3, keep the rest) config4 = 0x0000000000000008 written to PMSDSFR_EL1 = ~config4 = 0xfffffffffffffff7 reg & pmsdsfr_res0 = 0xfffffffffffffff7 & 0xffffffffffffff00 = 0xffffffffffffff00 != 0 -> current check rejects: perf_event_open() fails with -EOPNOTSUPP ~reg & pmsdsfr_res0 = 0x0000000000000008 & 0xffffffffffffff00 = 0x0000000000000000 == 0 -> proposed check passes: the session runs, source 3 is excluded as requested, but sources 8-63 are silently missing although the config asked to include them The crux is the bits the user never explicitly set: with the inverted ABI, a cleared bit asks for the source to be included, so inv_data_src_filter=0x8 also asks for sources 8-63 to be included, and their bits are not implemented. That is what reg & pmsdsfr_res0 rejects, so the user knows up front instead of finding those sources missing afterwards. (A set bit is always honoured for free, and on a full implementation both checks are vacuous.) What do you think about exposing ~pmsdsfr_res0 as a caps entry, as you did for the event filter with caps/event_filter? The rejected config then becomes actionable: cat caps/data_src_filter # 0x00000000000000ff perf record -e arm_spe_0/inv_data_src_filter=0xffffffffffffff08/ with 0xffffffffffffff08 = 0x8 | ~0xff - excluding source 3 and the unfilterable sources, so it passes the check. Happy to go with your preference if you see it differently. Thanks, Ping