Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Priyank Rathod" <rathodpriyank@google.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v4 2/2] selftests/pcie_lmr: Add tests for the Lane Margining debugfs interface
Date: Tue, 06 Oct 2026 16:33:13 +0000	[thread overview]
Message-ID: <sashiko-outbox-162260@kernel.org> (raw)
In-Reply-To: <20261006-pcie-link-endpoints-v4-2-ad5398c4260c@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] selftests/pcie_lmr: reversed logic skips LNKCTL restoration test
--

commit b1633adf22c71efa783c2272b3fd92aab3e39291
Author: Priyank Rathod <rathodpriyank@google.com>

selftests/pcie_lmr: Add tests for the Lane Margining debugfs interface

Adds a KTAP test for the Lane Margining at the Receiver debugfs interface.
It runs default passive checks on every pcie_lmr_* directory, and active
margining sessions if PCIE_LMR_DEV points to a port.

> diff --git a/tools/testing/selftests/pcie_lmr/pcie_lmr.sh b/tools/testing/selftests/pcie_lmr/pcie_lmr.sh
> new file mode 100755
> index 0000000000000..99070d221ae06
> --- /dev/null
> +++ b/tools/testing/selftests/pcie_lmr/pcie_lmr.sh

[ ... ]

> +active_tests()
> +{

[ ... ]

> +	if check_end_session "$d"; then
> +		ktap_test_pass "$dev: end the session"
> +		ACTIVE_DIR=
> +	else
> +		ktap_test_fail "$dev: end the session"
> +	fi
> +
> +	up=$([ "$rx" = 6 ] && echo "$dev" || echo "$partner")
> +	after="$(link_regs "$dev") $(link_regs "$partner")"
> +	if [ -z "${before// }" ]; then
> +		ktap_test_skip "$dev: setpci not found"
> +	elif [ -n "$up" ] && [ ! -d "/sys/bus/pci/devices/$up/link" ]; then
> +		ktap_test_skip "$dev: no OS ASPM control on link"

[Severity: Medium]
Is it possible that the logic for identifying the upstream port is reversed?

In active_tests(), the variable up is assigned using the receiver type.
If rx=6, dev is the Endpoint device, so up becomes the Endpoint.
If rx=1, dev is the Downstream Port, meaning partner is the Endpoint,
so up still evaluates to the Endpoint device.

Because up always evaluates to the Endpoint device instead of the
Downstream Port, the check for the sysfs link directory will always fail,
as that directory is only present on the Downstream Port. Will this cause
the test to unconditionally skip the final LNKCTL restoration checks?

> +	else
> +		check "$dev: LNKCTL and LNKCTL2 restored on both ends" \
> +			test "$before" = "$after"
> +	fi
> +}

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261006-pcie-link-endpoints-v4-0-ad5398c4260c@google.com?part=2

  reply	other threads:[~2026-10-06 16:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06 16:11 [PATCH v4 0/2] PCI: Add Lane Margining at the Receiver debugfs interface Priyank Rathod
2026-10-06 16:11 ` [PATCH v4 1/2] PCI/LMR: " Priyank Rathod
2026-10-06 16:24   ` sashiko-bot
2026-10-06 16:11 ` [PATCH v4 2/2] selftests/pcie_lmr: Add tests for the Lane Margining " Priyank Rathod
2026-10-06 16:33   ` sashiko-bot [this message]
2026-10-06 17:34     ` Priyank Rathod

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=sashiko-outbox-162260@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rathodpriyank@google.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