From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.176 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796044675; b=I+Vpku7Npca43JIxjyWVWm8/QMmnL4n/kAoOTjPH2OZ2Z0G3LMHd4pNlo8vFNcddyQIS Ix8n1MHosS0p65JF5vklQllRjf/i9RWxvxzk9IYJVYQ0COutM2OE5xW7yTiGXm+WfmynW GLBRxA8C/V0eVIhvl7anz1kYBdGQcdNbQZwbSghgnLlf3EDDXjoVN+Nxo8R0j1wqyv0QP OXrI+kxZeisi2G5SNhRXYibxpJdqCG+yiu6KLEZU8XYlKdHE+InLrJguU0uhzzFzMIW5O 7A4raizcURwj69DWYW7D/q5a0cAuCFlOuJ+dBTRmBi3J/X0XXScwPaOItN1ZtJII6Pw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796044675; 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=GBGw1Zuifk2CYaBx3Xf/QKVYIUkr+aW8HHRC88GdprOMTFGONSYyBxVIjH0WlfCwcS6J jmYIA9bmO7PB9qF2aV2B4E6fK45QHk9udzS2wPoB1mNwaKhEYT4QcyL+UU4OWkdV7crMj qo6OubJpVmoS+ALCUfX4pIopZl2SvIDIHCkHRdsCoTfL5qOM3AyLXcMDwR0tJ27QS6Z1Z YZl07JSsy1MlxwgdmJCBMxu+yKLfLpnbhkzBA0d2GGbwm2EwRLZUTWc2iuN2wtrdBCt7Y l0hNsT7lIk4enGzbkNC9kzeeDpNjp6UKF+2MlwFHNZhbl3Ux7bj5RXoVvISs1Nb33MA== 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.176 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 83B17606A320 for ; Mon, 30 Nov 2026 13:17:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 83B17606A320 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-f176.google.com with SMTP id d9443c01a7336-2f02f04a426so81494235ad.1 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=HRWypIxfGDXiFoW56VWpkH5BSjh18Qoi0eQlqqbUjmmu1O4x7jz9zirFhinh5odlsU OpM+oeqc4FYF3yrLKnwkcZf6itz24ipo93YKggBC5LAhyRBbu8HXhb3ONIc1u8kUZeUJ 1jWs1nbsd6gqgk0c73gaCrmTOyyPk7GO33UPb1EFfPqkylOkLAaX1HPV9LAZInu9e66W zkhammZPxedHHq/y+iyGFTbeu/aGX5lCk+hE70lQWv9itWuaTYCUlNHhe8HySeUJqh8+ 1D5P6xpey5BDWjHtgFplgLwE3Y1P40j6JL2OKdBZSy2YjKX3bVp5UHHojzUJ8FmgqPME BxgA== X-Forwarded-Encrypted: i=1; AL+hErHs1kmhXxthiai7wUcbaDFojX7y0zHMKDaZf8Mu+dJkEKOp0bYQmVd6y5JU0UhsEbI5O/ueFuoj89xqWSdzqiAT@vger.kernel.org X-Gm-Message-State: APuU4Z83zV9XsFoECDWB54KbsMogEqON7XkceYPv8Y2Lsa2w0HKIPMU/ MJnDEPfCKlSkdifdSFe3t891Rwu9EH2aw/LqCt/CQuvsrDbaJhwpcjNz X-Gm-Gg: AZFdTZenIVPV4en2OUf+zOPWU4Uo/BN/i/VZAB3SL56ab093zGc+rJwi3/bXC/JV93+ OnRqlmoCRXsgozlC6bios8l9XAZUejjwewuQ/lbV8jQMrTapehT3oo8mE7qDklzlZ4Kzst7ej+O jjlabblsph88bK/HMjqjAtHTPlkcXeCW7PftMP9y9v1GYnNJ1T1haJ6NehbIZhpzkcOtTNBTr7b 3Kl0RFuL7q/V1++Z7EZaV2RQGqjMIEIPqaw8KFMmpc+T11Z4eIStvk438BGN4truSPIuYQbHqjV Yd22LV8rpjbtPFvm8m6/+sRThmcL5vipCokddptDexd2tImU1vFn7HTKiKeR3fRES2ZMF8xuc8w 8lUkozb6NBKgUcEaWGBTm0gKsSGo4vILU6vlsV1JjWf97RU6UCvhYGJgsELdDg58LIf/vMsj8SQ honvJ/2+y2WpDYpBRQkGRvSeAjHHYlYouDR5MfYDKVkTeV2Pw6LijZ203Rg6nwNtAX41mGwnOpX fOKLsU+3Yd+SrX3sZutpQ3wkGz/39cGYry5GdT6Yr9QsGBeYkPtk4RT/5I0wO709Lzx0hsINNYu r45LISCgJY6TNqYIMhSQ3y83lYFVZf+aSxY= 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-perf-users@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