Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=113.46.200.218 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796456197; b=3ZMG/RcDZZ5IB5iS9BHwhKrxqCnxfynxqyh6s1wZ99b7nP28Stf4A1dbfJNMYyJgDNhc xs3YtQ24hFtJw15LoxFTNN3jBH/ZTWZERQJ8kn2OBgZMeo3ixXFPf56P4M5J6uUH75QZL yB4HdjiZzWOlgFMr21QdM6IEY/dUNck94aOBI2qncu2gYf6JehtBW/YjJR5r1EHITM9u/ HZ1m3fwPw3sPp/LQKaeLdXSyu1ksCyfFUWrRrcQoSDLrqoZoTNBeKqa78lxTRRVCdUWXR CeAwsLJBeO7J7SoSqwT1r/trGF5/yXTOAMU00qFtqYO0+UV9ldCgMV8D38YLziWPQDA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796456197; h=DMARC-Filter:dkim-signature:Received:Received:Received:Message-ID: Date:MIME-Version:User-Agent:Subject:To:CC:References:From: In-Reply-To:Content-Type:Content-Transfer-Encoding:X-Originating-IP: X-ClientProxiedBy; bh=CYvKDSXjoKvW5W1RHLm4ymcuSEMC3g9i9CH9Quqq3Ds=; b=eWdvS14ae26e9KOwz8FgZXjv9A2OiHCWg/khNpbN7iLT8GJVn1YS8cxX2e5rtByhvNoi pFq9SHlgpTLeJme+5jW9i3GfbpY3nfo6zeR6lrIYHR0GLJJTLnvE1B+pKhdkWZp/7E9IF ZadC9B5/FBgZVlevInksilbw4zlcCLeWgd95+DhWWqwwYIneAcJCVh+hF73lCE5bW3JUp qonfMnW/7nmj38vyV8GJgXbX0NZ8t3BKW4uDyw6UBCsTynq2d/87n8OqZa/sAyzMGelI2 Zi+jJW4uZuBFzyOkWCct9Xy7wjDENLaSzNLVDSeei/vvCdsERZ5fsTtGKveIWHjDaBQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b=arFVuZtF; arc=none smtp.remote-ip=113.46.200.218 Received: from canpmsgout03.his.huawei.com (canpmsgout03.his.huawei.com [113.46.200.218]) (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 6B07A606A322; Sat, 5 Dec 2026 07:36:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6B07A606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b=arFVuZtF dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=CYvKDSXjoKvW5W1RHLm4ymcuSEMC3g9i9CH9Quqq3Ds=; b=arFVuZtFseBVYXtcX9zeojWwmoHxJ3Kv3HyFV7PoBRpMOKJ1gFvcmsUpGZq1M7W/Osh1WlLVV s6uNnDP/4BLwL6AAXanLsGZMjscDm27kupvDIHw26YVyAxvOS9YTSF2Oe5MYKpZrnYVwUkN0/LV S2IUs85yu1QM7aKlWRI7sJM= Received: from mail.maildlp.com (unknown [172.19.162.140]) by canpmsgout03.his.huawei.com (SkyGuard) with ESMTPS id 4jhKrj2h5kzpStk; Sat, 5 Dec 2026 15:35:01 +0800 (CST) Received: from whupemo200004.china.huawei.com (unknown [7.152.184.18]) by mail.maildlp.com (Postfix) with ESMTPS id 5FDE920333; Sat, 5 Dec 2026 15:36:21 +0800 (CST) Received: from [10.67.120.233] (10.67.120.233) by whupemo200004.china.huawei.com (7.152.184.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.56; Sat, 5 Dec 2026 15:36:18 +0800 Message-ID: Date: Sat, 5 Dec 2026 15:36:17 +0800 X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 0/8] Enhance TLP packet decoder with field-level parsing and versioning To: Suzuki K Poulose CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Arnaldo Carvalho de Melo References: <20260908140509.2485649-1-liusizhe5@huawei.com> <4019452b-b25f-4c17-bc5c-570a28782bf1@huawei.com> <8b654253-c79d-46cf-9f80-220d36ec3226@arm.com> From: Sizhe Liu In-Reply-To: <8b654253-c79d-46cf-9f80-220d36ec3226@arm.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: kwepems100002.china.huawei.com (7.221.188.206) To whupemo200004.china.huawei.com (7.152.184.18) On 2026/12/1 0:03, Suzuki K Poulose wrote: > Hi Sizhe, > > On 11/09/2026 07:41, Sizhe Liu wrote: >> On 2026/9/9 5:02, Arnaldo Carvalho de Melo wrote: >>> On Tue, Sep 08, 2026 at 10:05:01PM +0800, Sizhe Liu wrote: >>>> The original hisi-ptt-decoder only prints raw hex values with >>>> generic field names for DW0/DW1/DW2/DW3, without classifying TLP >>>> types or decoding DW0/DW1/DW2/DW3 fields according to the hardware- >>>> defined packet format. >>>> >>>> This series enhances the HiSilicon PTT (PCIe Trace and Tuning) packet >>>> decoder in perf tool to provide detailed field-level parsing of TLP >>>> headers based on message type, and adds a versioning mechanism for >>>> backward compatibility both in hisi_ptt driver and perf tool. >>> >>> Series is sashiko clean by now, has a Reviewed-by, but it touches both >>> kernel and tools, I wouldn't have a problem if it was processed by whoever >>> maintains the kernel part. >>> >>> - Arnaldo >>> >> >> Hi Suzuki, >> >> The series is now Sashiko-clean and has Reviewed-by tags. It touches both >> driver and tools. Arnaldo is fine with the tools part. Would you mind >> reviewing the driver part and picking it up through your tree if it looks good? >> >> If there are any changes needed, please let me know. >> >> Link: https://lore.kernel.org/all/20260908140509.2485649-1- liusizhe5@huawei.com/ > > I ran AI review and it came up with the following. Now, I am not an > expert on the topic, so take it with a pinch of salt. Please could > you take a look ? > > For patch "perf hisi-ptt: Add field-level parsing for header DW0/DW1/DW2/DW3" > > > Under the documented TLP layout, MRd requests with TH=1 carry a steering tag in DW1’s low byte. Both new printers interpret this as byte enables. A synthetic request with DW1=0x123456a5 produces: > >      Tag<7:0> 56 Last DW BE a First DW BE 5 > >      It should report ST<7:0> a5. I reproduced this with both trace formats. Related cases include MWr with TPH, where the tag field carries ST, and AtomicOp requests, whose byte-enable fields are reserved when TH is clear. The decoder needs to retain TH >      and select the appropriate interpretation. See PCIe 6.0, §2.2.7.1 (https://courses.cs.washington.edu/courses/cse470/26sp/readings/PCI%20Express%20Base%20Specification%20Revision%206.0.pdf) > That's right, in non-flit mode, the mapping of ST[7:0] is different for Memory Requests. Per PCIe r7.0 sec 2.2.7.1.1 fig 2-43 and fig 2-44, The Steering Tag (ST[7:0]) reuses the Byte6 (Tag[7:0]) position in Memory Write Request Header; The ST[7:0] reuses the Byte7 (Last DW BE & First DW BE) position in Memory Read, DMWr, and AtomicOP Request Headers. I think it's ok for this patch series, because there is a more general representation of Memory Request Headers, per PCIe r7.0 sec 2.2.7.1 fig 2-36 and fig 2-37. AI brought up something worth optimizing, a more detailed division for Memory Requests of TPH scenario. I will consider it as the next patch work. Regards, Sizhe> > > Here is a test that it generated : > > $ cat decoder-test.py > > # SPDX-License-Identifier: GPL-2.0 > import pathlib > import random > import subprocess > import sys > > root = pathlib.Path(__file__).resolve().parent > > def decode(binary, words, pattern, header): >     args = [str(root / binary), str(words), str(pattern)] >     args += [hex(n) for n in header] >     return subprocess.check_output(args, text=True) > > rng = random.Random(12345) > for words in (4, 8): >     for _ in range(32): >         header = [rng.getrandbits(32) for _ in range(4)] >         before = decode("decoder-baseline", words, 0, header) >         after = decode("decoder-current", words, 0, header) >         assert before == after, (words, header, before, after) > print("PASS: legacy output matches origin/next for 64 pairs of packets") > > # PCIe memory read with a TPH Steering Tag (TH=1), not byte enables. > for words in (4, 8): >     head0 = (1 << 22) if words == 4 else (1 << 16) >     output = decode("decoder-current", words, 1, [head0, 0x123456a5, 0x1000, 0]) >     (root / ("tph-" + str(words) + "dw.txt")).write_text(output) >     print("TPH example:", words, "DW:", output.splitlines()[1 if words == 4 else 2].strip()) > > # AtomicOp FetchAdd: byte enables are reserved when TH=0. > for words in (4, 8): >     head0 = (2 << (30 if words == 4 else 29)) | (0xc << (25 if words == 4 else 24)) >     output = decode("decoder-current", words, 1, [head0, 0x12345600, 0x1000, 0]) >     (root / ("atomic-" + str(words) + "dw.txt")).write_text(output) > print("Saved TPH/AtomicOp reproducer output.") > > if "--fixed" in sys.argv: >     count = 0 >     for words in (4, 8): >         for fmt in range(4): >             for typ in range(32): >                 h0 = (fmt << (30 if words == 4 else 29)) | (typ << (25 if words == 4 else 24)) >                 header = [h0, 0x123456a5, 0x1000, 0] >                 old = decode("decoder-current", words, 0, header) >                 new = decode("decoder-fixed", words, 0, header) >                 assert old == new >                 if typ not in (0xc, 0xd, 0xe) or fmt < 2: >                     assert decode("decoder-current", words, 1, header) == decode("decoder-fixed", words, 1, header) >                 count += 1 >     for words in (4, 8): >         for fmt, typ in ((0, 0), (1, 0), (2, 0), (3, 0), (2, 0x1b), (3, 0x1b), (2, 0xc), (3, 0xc), (2, 0xd), (3, 0xd), (2, 0xe), (3, 0xe)): >             for th in (0, 1): >                 h0 = (fmt << (30 if words == 4 else 29)) | (typ << (25 if words == 4 else 24)) | (th << (22 if words == 4 else 16)) >                 out = decode("decoder-fixed", words, 1, [h0, 0x123456a5, 0x1000, 0]) >                 line = out.splitlines()[1 if words == 4 else 2] >                 if th and typ == 0 and fmt >= 2: >                     assert "ST<7:0> 56" in line and "Tag<7:0>" not in line >                     assert "Last DW BE a First DW BE 5" in line >                 elif th: >                     assert "ST<7:0> a5" in line and "DW BE" not in line >                 elif typ in (0xc, 0xd, 0xe): >                     assert "Reserved a5" in line and "DW BE" not in line >                 else: >                     assert "Last DW BE a First DW BE 5" in line >     print("PASS: candidate fix, 48 TH/type/width cases and", count, "compatibility cases") > > > > >> >> Thanks for your time! >> Sizhe >> >>>> --- Changes in v4: - Add missing space in hisi-ptt.rst (Sashiko). - >>>> Widen the pattern bit field in struct hisi_ptt_trace_ctrl (Sashiko). - Add protocol defined TLP header length parsing in patch 05/08. - >>>> Add MRd and DMRr message types parsing in patch 05/08. - Add comment >>>> for enum hisi_ptt_pkt_msg_type in patch 05/08. - Add DW0 and DW1 >>>> fields analysing in patch 06/08. - Refine bit-fields parsing of DW0/ >>>> DW1/DW2/DW3 based on different requests in patch 06/08. - Refine the >>>> description of pattern=1 in the document in patch 07/08. - Extract >>>> the bit-field printing of v1 version into functions in patch 08/08. - >>>> Link to v3: https://lore.kernel.org/linux- >>>> pci/20260903075241.1445338-1-liusizhe5@huawei.com/ >>>> >>>> Changes in v3: - Add explicit inclusion of (Sashiko). - >>>> Make patch 07/08 apply cleanly to mainline (Yushan). - Pick up the >>>> reviewed-by tag (Yushan). - Link to v2: https://lore.kernel.org/ >>>> linux-pci/20260827140442.2031128-1-liusizhe5@huawei.com/ >>>> >>>> Changes in v2: - Split patch 01/10 and patch 02/10 from series v1 >>>> into independent patch series for backporting (Bjorn). - Use bitwise >>>> operations instead of C bitfields for cross-platform cases (Sashiko). >>>> - Add `pattern` parameter in hisi_ptt driver for layout >>>> compatibility. - Link to v1: https://lore.kernel.org/linux- >>>> pci/20260604075005.2219785-1-liusizhe5@huawei.com/ >>>> >>>> --- Sizhe Liu (8): perf hisi-ptt: Abstract trace data buf and offset perf hisi-ptt: Complete the field names for 4DW and 8DW packets perf >>>> hisi-ptt: Extract the raw data printing part perf hisi-ptt: Merge >>>> 4DW and 8DW HEAD0 printing perf hisi-ptt: Add parsing of supported >>>> message types and proto length perf hisi-ptt: Add field-level >>>> parsing for header DW0/DW1/DW2/DW3 hwtracing: hisi_ptt: Add pattern >>>> PMU config for trace format selection perf hisi-ptt: Pass pattern >>>> version to decoder for compatibility >>>> >>>> Documentation/trace/hisi-ptt.rst              |  26 +- drivers/ >>>> hwtracing/ptt/hisi_ptt.c              |  25 +- drivers/hwtracing/ptt/ >>>> hisi_ptt.h              |   4 + tools/perf/arch/arm64/util/hisi- >>>> ptt.c         |  18 + .../hisi-ptt-decoder/hisi-ptt-pkt-decoder.c >>>> | 593 ++++++++++++++++-- .../hisi-ptt-decoder/hisi-ptt-pkt- >>>> decoder.h   | 241 ++++++- tools/perf/util/hisi- >>>> ptt.c                    |  51 +- tools/perf/util/hisi- >>>> ptt.h                    |   9 +- 8 files changed, 872 >>>> insertions(+), 95 deletions(-) >>>> >>>> -- 2.33.0 >> >