From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.176 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795755781; b=W2u8KwgHOFXBeyV7n4Wr4mM2sr3IvNPnCpVXTaWsyeX2RA1h5MfG7aSzv25FD11MibfH ku/Ck32lupKn+MJmb8SNUBiEc8Dvjakix0NBc2m3Z4iDuomilL0P+UfZzfsirq6E1VjPb V6d9N1owxXgo2z02K92MLUJ5xW/H/uH5sTQvRAxd4f61J7ROUYKptpSmAXf9lh7ZX2hQ8 kRQL8nbsyyaoVni9xh5toFRwDmfSh8u9ukEXpZYv9VcfWT7Tkx5cIgdLaGDwyZYbPDtmZ eDiAvUplGgApABsgYgbd0F1cHOPWgkDXFBMv6i+NdjrbaSgSpATJm4Q2c4Q/Y8BF5yg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795755781; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key; bh=KbI0rhMQhYQfeqR7VyDE1i5BNcfKuKWsIvq9RSQwXvs=; b=3MwzZrBzW9/y/Hw75kXnUeVTpjrhSHZh+byVFaiTB4XSHm5NPOlJs2vkd0L5N/RRlisG NzMdjbaFSY8rpbxktlqmQSA0HWWGt6rL/wha1HhurdXZPxuAjhJ2vUwcd5fkRtaSvCQaa GC5aRH0Ul/GNcfpksZF2x1DjUJJ0qD+hN4cG/dBrgi+8YtK69+3QotNjtPo2MDDleDwjw 1KnNOsiTckiXFhUaIs3eVfMaZnI8ciEvGjMvmYIzQYI4beczaZFvLPthUmv/YrVsDMWMs pBh16TShd4iDKQN6rtNbrd+ROVfHzfhFh8j+4lptjZjCYh3bxCP7i6L998CvLdIb8WA== 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=WJp4WUs+; arc=none smtp.remote-ip=209.85.128.176 Received: from mail-yw1-f176.google.com (mail-yw1-f176.google.com [209.85.128.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 58B3E606A334 for ; Fri, 27 Nov 2026 05:03:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 58B3E606A334 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=WJp4WUs+ Received: by mail-yw1-f176.google.com with SMTP id 00721157ae682-8b4c2da74c0so49939327b3.1 for ; Thu, 26 Nov 2026 21:03:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795755780; x=1796360580; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=KbI0rhMQhYQfeqR7VyDE1i5BNcfKuKWsIvq9RSQwXvs=; b=WJp4WUs+hOF9VG1QSWQYjioDKs+09y5DNP/Ts9/hhyycT9+bTSkJ0WIEbSqY2m96QF b9hxVesImOdMOpJJ6BrQM/nrFm4HsauxpvUq3KZ1GgTpr2PbZUhlc6aC1+YZOfIfi/nk qIaYgtqL/5Oz0yaI9cGxu9xPhxxhbbzRWAyICmQXRrLgZJS4Ek1lD2JeXxEXXhyXkUl0 V39WIPHbI6wVFBagnLWOzp1WR/YsMHem/2tHdo8IBCmUPVyP6yq7fAw2QWm9PipjBmq6 IYf/H2ni8xxQ8dvyMbivl2oS9K0KQgKqe1yOjxLRI0Yth2XA9ib6z3XxmZbQ1sRrVVJU lz7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795755780; x=1796360580; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=KbI0rhMQhYQfeqR7VyDE1i5BNcfKuKWsIvq9RSQwXvs=; b=ny3WpH+Sc38TMyWdXYMSSkGuUhodOQPYL5vHZDYRc8QIna7JZqWhwx6vMLWjbPj4UA V+ujEAHbEqsKOJFFIqyjtoT8cRbPZMN+WtgyVNCiQvhCbPdzrVeLES/KzdwC6Cc7F8Bc OaCGepm7lLXi+3+0n43LLaasq9jwCvobs5oyim3puqcG9kkUwC55RKYTB/eOybqkKjWh JLbreNxSYGiyyLZOkNnESt1NmN91vRVLF6OLZVt3Wgj/FmRgSyLKZ1LZAxjw8bwdPb0z UuIbOSiZaKpmgU0IOAM30AZXpjDZhNwSRnYowz+8+04F/TM8AviPAZLLDWf4yf4IlvIH bP9g== X-Forwarded-Encrypted: i=1; AL+hErHp+W551fp3XsI20pnhP7qPjvSjnXf1Frxol9mU8QX21HaTCBl/6QtCL0mKoCooaldXguEDCsTbl+hP4EU=@vger.kernel.org X-Gm-Message-State: APuU4Z+V0lDV8zMafen5qJvD6sy5TsaRIJZvzD3f7WcPGNnPZ/bIUNLO USsNFsci3NiN6izQQgA1v4nWrBnPill2DoR6CwZnNmNh18ZoxXSzmYb0 X-Gm-Gg: AZFdTZfq0NuFIfMpMOknO9jVGxeSyit1V3JchAiIpqKXlKikqNZQZz98Yu2K3/GFJ1C O0Ci8eBFSyu9/9FqnmzzA+0aUK39fmcysYItC1w+/eaNMZju3j1C47cBGOSt2AI43/Yr/ngwcgB Q03HKghKEpvolutZDP3FEMGLikgMOl3XCo/vunv6pRlldvsAw2/q9+6R2qTFOpe+pwKeUwRCNGJ DfT8JHD7ivEGd8j+tq9NGuXxqI6u/Fy+jgyV09/iXilvAwRa/zhMQaIojTuQe69fOaMWZfJZBVN R8250MPxyBk8u897rDi6KDmiE+oQhkwzqTrWSW2W6p7u3B0MJ1Ob4Puaoh2RwyryOqQ84f9ZIV9 iSqqTl+8Tu2IlYUGwQjMY7TpgmuentS1Dz/UK59ZzOZn6eazbERLU5yYFHeVO94PbjFNCi2Woxs OnDG3xi49pb9dZcxTAw3g1vdR94xYEF1vhU4q0zZTS6bLdJKkvmtM2qWPJUNgkueEVTfCdgzCSC JzD2ed3KQnmt3S97yn4HkUoJqLhxxW7drDGC2SPeOyLB0n69oCloFtesMOqCYSl2EpL1sMBMdlq dprUODzezBn/SEd3//iZKAwgUXQA3xosdWRWDMr37/6f0W0jzUGXah6jogtcSvgsoexkJCrLcjn jJuyyO4YhQMga8GMzqP84oLc+hVpRHvCL1F+mGExRLHk= X-Received: by 2002:a05:690c:4d4a:b0:8b3:ba8c:2e77 with SMTP id 00721157ae682-8b52047e4a7mr72735317b3.33.1795755779922; Thu, 26 Nov 2026 21:02:59 -0800 (PST) Received: from localhost ([2600:1702:7a90:6f9f:8bc4:8aec:108d:7a04]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8b52033c2d4sm90735777b3.36.2026.11.26.21.02.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Nov 2026 21:02:59 -0800 (PST) From: Matt Turner Date: Fri, 27 Nov 2026 00:02:54 -0500 Subject: [PATCH 1/7] parisc: perf: swap the PCX-U and PCX-W RDR tables 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261127-parisc-perf-pa8800-v1-1-4f3f077010ce@gmail.com> References: <20261127-parisc-perf-pa8800-v1-0-4f3f077010ce@gmail.com> In-Reply-To: <20261127-parisc-perf-pa8800-v1-0-4f3f077010ce@gmail.com> To: "James E.J. Bottomley" , Helge Deller , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark Cc: linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Matt Turner X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3931; i=mattst88@gmail.com; h=from:subject:message-id; bh=WSGfmKS9u083kTuUTG6vl0t/7ZIxmbwyYW67G7uEfhw=; b=owGbwMvMwCW25rVmCc8sv+mMp9WSGLI5+f61/3F/bFL7Url2tmbx8W+b/25RCHH7VZQi/zry6 xmjCU6bOz6yMIhxMcwUU2SJW6/IMqttx1Kf09K/YOawMoEMkRZpYAACFga+3MS8UiMdIz1TbUM9 QyBDxygeIqfHoJFZXFyaWqSbVlDkkJdfkliSmZ9XrJdfkJpXkF6gl5aZVpKRkV9UnAo0Qi8vtcT U1dHNyNDAxNLRwszJwtHUxNnZydDJzdHR2dXJyNLcxMDZ0tHE1dKcgYtTAOYa0waG/9lSdd5O2T e3Rn1bm3Fk/1fbsyn1/C0Cnn9vytfcjjcIMGJkWKT5/aDzWgfxg3aP3E9t5t718uiyCfq/GetMj n+YEeL5mR8A X-Developer-Key: i=mattst88@gmail.com; a=openpgp; fpr=3BB639E56F861FA2E86505690FDD682D974CA72A perf_rdr_tbl_W holds the PCX-U (PA-8000/PA-8200) RDR widths and perf_rdr_tbl_U holds the PCX-W (PA-8500/PA-8600) widths, and it has been that way since the driver was added. The driver's own code and data show it: - The CUDA (PCX-W) counter read takes four 32-bit counters, two doublewords, from RDR15. perf_rdr_tbl_W says RDR15 is 8 bits wide; perf_rdr_tbl_U says 128. - The ONYX (PCX-U) counter read takes the counters from bits 1398 to 1529 of RDR16, which needs RDR16 to be 1530 bits wide as in perf_rdr_tbl_W. perf_rdr_tbl_U says 1494. - perf_rdr_shift_in_W does nothing for RDR3, RDR7, RDR8, RDR9, RDR12 and RDR19, which are absent in perf_rdr_tbl_U. perf_rdr_tbl_W gives RDR3, RDR7, RDR9 and RDR12 non-zero widths. - The ONYX images write RDR7, which is absent in perf_rdr_tbl_U, and the CUDA images write RDR15, which is 8 bits in perf_rdr_tbl_W. - The images are laid out for the swapped tables. RDR data is left-justified, so the bits past each RDR's width are zero. Read with perf_rdr_tbl_U, none of the 22 cuda_images sets a bit past the width of any RDR; read with perf_rdr_tbl_W, every image does in about two thirds of its RDRs. The same holds the other way round for the 44 onyx_images. With the swapped tables both image families end in the same 9 Runway doublewords, and the CUDA images' Runway STATUS word then carries bits inside the 0x0013000000000000 mask that perf_write_image() applies. - The PA-8500/PA-8600 PDC firmware (from HP-UX 11.11 patch PHSS_25983) has an RDR description table whose widths equal perf_rdr_tbl_U in every entry. As a result every CUDA image write shifts each RDR by the wrong amount and loads RDR16 one doubleword early, the CUDA counter read returns 8 bits, and on PCX-U RDR7 is never written and the counters are taken from a misaligned RDR16. Swap the two tables' names, and correct the RDR20/21 and RDR22/23 widths in the perf_bitmasks comments. The RDR20/21 mask already covers 158 bits. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Matt Turner --- arch/parisc/kernel/perf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/parisc/kernel/perf.c b/arch/parisc/kernel/perf.c index 5e10f98ce7b5..8f9ae67270bd 100644 --- a/arch/parisc/kernel/perf.c +++ b/arch/parisc/kernel/perf.c @@ -67,8 +67,8 @@ static const int perf_rdrs_W[] = static const int perf_rdrs_U[] = { 0, 1, 4, 5, 6, 7, 16, 17, 18, 20, 21, 22, 23, 24, 25, -1 }; -/* RDR register descriptions for PCX-W */ -static const struct rdr_tbl_ent perf_rdr_tbl_W[] = { +/* RDR register descriptions for PCX-U */ +static const struct rdr_tbl_ent perf_rdr_tbl_U[] = { { 19, 1, 8 }, /* RDR 0 */ { 16, 1, 16 }, /* RDR 1 */ { 72, 2, 0 }, /* RDR 2 */ @@ -103,8 +103,8 @@ static const struct rdr_tbl_ent perf_rdr_tbl_W[] = { { 16, 1, 0 }, /* RDR 31 */ }; -/* RDR register descriptions for PCX-U */ -static const struct rdr_tbl_ent perf_rdr_tbl_U[] = { +/* RDR register descriptions for PCX-W */ +static const struct rdr_tbl_ent perf_rdr_tbl_W[] = { { 19, 1, 8 }, /* RDR 0 */ { 32, 1, 16 }, /* RDR 1 */ { 20, 1, 0 }, /* RDR 2 */ @@ -147,10 +147,10 @@ static const uint64_t perf_bitmasks[] = { 0x0000000000000000ul, /* first dbl word must be zero */ 0xfdffe00000000000ul, /* RDR0 bitmask */ 0x003f000000000000ul, /* RDR1 bitmask */ - 0x00fffffffffffffful, /* RDR20-RDR21 bitmask (152 bits) */ + 0x00fffffffffffffful, /* RDR20-RDR21 bitmask (158 bits) */ 0xfffffffffffffffful, 0xfffffffc00000000ul, - 0xfffffffffffffffful, /* RDR22-RDR23 bitmask (233 bits) */ + 0xfffffffffffffffful, /* RDR22-RDR23 bitmask (194 bits) */ 0xfffffffffffffffful, 0xfffffffffffffffcul, 0xff00000000000000ul -- 2.56.1