From: sashiko-bot@kernel.org
To: "Sizhe Liu" <liusizhe5@huawei.com>
Cc: linux-pci@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 08/10] perf hisi-ptt: Add parsing of supported message types
Date: Thu, 04 Jun 2026 08:01:14 +0000 [thread overview]
Message-ID: <20260604080114.97F781F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260604075005.2219785-9-liusizhe5@huawei.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The decoder uses C bitfields (`dw0_4dw` and the newly added `dw0_8dw`) to parse hardware headers from a host-endian integer, which breaks cross-platform perf trace analysis on big-endian architectures.
--
commit e6402a0d73ba805c4892540373d8a6a210da4d39
Author: Sizhe Liu <liusizhe5@huawei.com>
perf hisi-ptt: Add parsing of supported message types
This commit adds logic to parse TLP message types from Header DW0 Format and
Type fields for 4DW and 8DW packets. It stores the parsed message type in the
packet buffer to select the correct field layout for subsequent decoding steps.
> diff --git a/tools/perf/util/hisi-ptt-decoder/hisi-ptt-pkt-decoder.c b/tools/perf/util/hisi-ptt-decoder/hisi-ptt-pkt-decoder.c
> index 9ec84d398cc1b..59ab8ec3a03da 100644
> --- a/tools/perf/util/hisi-ptt-decoder/hisi-ptt-pkt-decoder.c
> +++ b/tools/perf/util/hisi-ptt-decoder/hisi-ptt-pkt-decoder.c
[ ... ]
> @@ -90,9 +121,41 @@ union hisi_ptt_field_data {
> uint32_t type : 5;
> uint32_t format : 2;
> } dw0_4dw;
> + /* Header DW0 for 8DW format */
> + struct {
> + uint32_t others : 24;
> + uint32_t type : 5;
> + uint32_t format : 3;
> + } dw0_8dw;
[Severity: Medium]
Will this bitfield layout break cross-platform perf trace analysis on
big-endian architectures?
The hardware payload is loaded via le32_to_cpu(), which correctly guarantees a
host-endian integer, but mapping C bitfields onto that integer relies on
implementation-defined behavior. On big-endian hosts, GCC packs bitfields
starting from the most significant bit, so accessing dw.dw0_8dw.format or
dw.dw0_8dw.type will extract the wrong bits.
Could these fields be extracted using standard bitwise shifts and masks
instead of relying on bitfield layout?
> uint32_t value;
> };
>
> +static int hisi_ptt_parse_pkt_msg_type(union hisi_ptt_field_data dw,
> + enum hisi_ptt_pkt_type pkt_type)
> +{
> + uint32_t format, type;
> +
> + format = (pkt_type == HISI_PTT_4DW_PKT) ? dw.dw0_4dw.format :
> + dw.dw0_8dw.format;
> + type = (pkt_type == HISI_PTT_4DW_PKT) ? dw.dw0_4dw.type :
> + dw.dw0_8dw.type;
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260604075005.2219785-1-liusizhe5@huawei.com?part=8
next prev parent reply other threads:[~2026-06-04 8:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-04 7:49 [PATCH 00/10] perf hisi-ptt: Enhance TLP packet decoder with field-level parsing and versioning Sizhe Liu
2026-06-04 7:49 ` [PATCH 01/10] perf hisi-ptt: Fix spelling and abbreviation errors Sizhe Liu
2026-06-04 7:49 ` [PATCH 02/10] perf hisi-ptt: Fix PTT trace TLP Header parsing Sizhe Liu
2026-06-04 7:59 ` sashiko-bot
2026-06-04 7:49 ` [PATCH 03/10] perf hisi-ptt: Rename hisi_ptt_4dw union for reuse Sizhe Liu
2026-06-04 7:49 ` [PATCH 04/10] perf hisi-ptt: Abstract trace data buf and offset Sizhe Liu
2026-06-04 7:50 ` [PATCH 05/10] perf hisi-ptt: Complete the field names for 4DW and 8DW packets Sizhe Liu
2026-06-04 7:50 ` [PATCH 06/10] perf hisi-ptt: Extract the raw data printing part Sizhe Liu
2026-06-04 7:50 ` [PATCH 07/10] perf hisi-ptt: Merge 4DW and 8DW HEAD0 printing Sizhe Liu
2026-06-04 7:50 ` [PATCH 08/10] perf hisi-ptt: Add parsing of supported message types Sizhe Liu
2026-06-04 8:01 ` sashiko-bot [this message]
2026-06-04 7:50 ` [PATCH 09/10] perf hisi-ptt: Add field-level parsing for header DW2/DW3 Sizhe Liu
2026-06-04 7:58 ` sashiko-bot
2026-06-04 7:50 ` [PATCH 10/10] perf hisi-ptt: Add decoder version compatibility Sizhe Liu
2026-06-04 8:03 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260604080114.97F781F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=liusizhe5@huawei.com \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox