From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.170 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796044676; b=tbbUtg3/FNWIZZ/wmGAHRs+mPz1BGCWAtwq09+O5afy6NPn6ZNoIacg5ogl672c1dfZs wpma64XkSPDBkMAnFseM8a3qlS0cwb5oDk4p/qR/Q7Z7xKU8zAVi7A1+x6FcEzBkWOGL3 zt6apn9JL6uieXGUd9WPKu06vzutmQv/4h4R5jmW9xkCtgEol/gGRPgChf2zc5w1QRcSS kENKb53nXrKH5hwjGDV4wgBfEZwPCmW4zP2ukTtSyg1qezmoyz0ZyLV4fC/YZk4Uy9sLj SsXZL/LtP2zupwBtmugyv93au3nkfuBqYnrcLUTwDV7LrTL/LvCl06nQ3ZR9PT5+PTw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796044676; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=XgGnDQl5Oxy5GXjm+XdGlci66/50Rko95zK0QviHLWg=; b=FjjK+M2Fr/nGVsaThf8XhL3aRqmhLdONWA27sx0d+HqlIOwuvzVnXZtULVgPyl/dSCvg vz6mIkENa2NMKy+CeCilabZ+bWh6M2kbRNYn+tjj2iNBkkd3R4VjBoGoUjDNxiH0pkUKK kubr+SolN6VYCHtYUaUCHvXfYtfsSEENnFOHU9KFqQfYvqI1EGtWmChod+Oe6idj/cyw0 tHSsMB0u7kIjUfMkKRctejam/ux5veZSV/4lYuClvA75CFvC3ysNaIudUj9cLkreGJyyz aYvNnPTVw7MsQ8W7DXHbfFLbZIje47AyzRSnILD7KPS14HIjIVJrcIBMa3Vi8lztaAw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=rAELcss3; arc=none smtp.remote-ip=209.85.214.170 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A5DD7606A32C for ; Mon, 30 Nov 2026 13:17:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A5DD7606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=rAELcss3 Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-2f01f296937so77169735ad.3 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=vger.kernel.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=rAELcss35OP5ST/ZKS1etByPyb6dDkl63Q0UbiKeEGciPmBgkmyPCixpKrymV4IHrS 7osOJsuDwIXAE93IXwF+342FqUGVgxyoC8zkGjiwQWChehzi5CcVd1GaCajpAiBA2mpK 1R4pOqxzAt+aT9qenQFK+snytUefKeUwohbt3LQqRhPFhqwBgWWTeF3Rma5uD4kkmJtD i+UHycy0M1nVeTbw42YTpZyrkpUxME70i28uglUG5dRy3uPEy6mHU/UncopNLzrKytzY rw87awBH+Vh6VINC9WxV+ZIoxNLvfHXndAg//D5nVdMviDmLVlxVr7jWglAVztKF06G0 72kQ== 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=M/Pm/nnfcvBA1bW1HIEbdOjgFsrihV3FC/oRpL+mJb+l/61us02HV6kNPlBHLFfEZd L7HknJkJ6yEvDS7U3Mc94v7dLzQZvNnFeJcw/59lcfoKj1V9cotcnQvV1n4waY72EDOz T3S/ej6j1PwC6uRra7KMnSp0ets4zrmoNeT95eeu/kMt4i8i36MMX6wnQr4L0aaOuU3u aBlM+9hG5E72lmW0tCG0KVye3R8pMGaENlsI3051sFwFK6mcrb7Se/jUPjOUZAByUmRY GVJq+dl2AN5VPgMTUGt+pcw0Pl8yQGzRNUmDE3Ld3uigJPdvXgw6dTGfyqeqwsmIFzXj JiDw== X-Forwarded-Encrypted: i=1; AL+hErHCHf3bzlgR+ihB4KPrgjiQcJ+PFD5W3NVqinvzcoAfg0xtoEjcnsKqz1f59XtxPWwBSMRe6YIhjLEZgPA=@vger.kernel.org X-Gm-Message-State: APuU4Z9KVk4PSnsMIgi4GqW9iEgzkerytIl70HagTHVflM51vSM4O/z2 x68dxRgUaO28Y9DklAILThVMJlf1u25HuTepGzg3gGDHOIaeJA85qtYR X-Gm-Gg: AZFdTZcwM4774H5c0v5hTYqhgdNoX0OsXaIMzPCDQlwj3j4N5K8rmJQCGspL8QcbErR 0/68rOlsAJzoT34WDttrXnU6ibi3/qsaFJCMo0TtrCquxGeF5kVxBLDnJNA/v1Fh/dScPrDgiaO IHkENypZfNJN4Yhu4gtivxNa0EBoNU4IaqYZFbZVftWwJIcNPpFZijt3xdaxyCDq/aOkuOAzx7u Fj6bArYpPNNTOC5OPAl4rMpIS9wKCJMWWIOz05TNhFGAaQ60CDht9j4Y333tdv3OsvI3VSxyb+x lo1y9awYNcMIY3aHDOPm8mzf8r1G7J2qu9ESzW0Hl5gLxiDzxZVVUl/XJSsODhfG7n/IIdgxUZy fgNxH5RoiByHuO2fs5RW0YiMWLRAwcibTDnD5ZDWMUre7YeHVYEolgWvmB+qF4Vo5ywrll3fn/l GBUrP7kiEgfajbd1m1OrrXHngnCo3bTbXR2/9tuY8B37M8iFFJnx7gbP6PXC03jyQmkpZbkXm5U FsWWtExnNwRCYPu3oEa/4Yz6pZS+AJFu9CyK21Od2rB+qKqYL/DN68y5u9BEbKW65bjguRtFTVj 5uyrBvvWnX7kYdQyRpxhnCosltgc4H3/P+g= 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-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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