From: sashiko-bot@kernel.org
To: "Srirangan Madhavan" <smadhavan@nvidia.com>,
linux-cxl@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH v16 15/18] PCI/CXL: Restore CXL state after PCI reset
Date: Thu, 29 Oct 2026 15:29:19 +0000 [thread overview]
Message-ID: <sashiko-outbox-189605@kernel.org> (raw)
In-Reply-To: <20261029145703.2185231-16-smadhavan@nvidia.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] PCI/CXL: missing __must_hold(cxl_region_quiesce) on __cxl_reset_execute()
--
commit da830bbfe7ea5fbc66b29d8fb48ea9c9acd0a112
Author: Srirangan Madhavan <smadhavan@nvidia.com>
PCI/CXL: Restore CXL state after PCI reset
This commit restores the PCI configuration needed for HDM access, cached HDM
decoder settings, and CXL Device DVSEC state after a CXL device reset. It also
handles restoration failures by disabling the device in the saved PCI command
state.
> diff --git a/drivers/pci/cxl.c b/drivers/pci/cxl.c
> index 9a298e90586da..58bbd5b47539f 100644
> --- a/drivers/pci/cxl.c
> +++ b/drivers/pci/cxl.c
[ ... ]
> @@ -232,6 +233,162 @@ void pci_cxl_hdm_cache_release(struct pci_dev *pdev)
[ ... ]
> +/* Caller holds the region lock and keeps device traffic isolated. */
> +static int pci_cxl_restore_state(struct pci_dev *pdev,
> + const struct cxl_hdm_info *snapshot, u16 *command)
> + __must_hold(cxl_region_quiesce)
> +{
> + device_lock_assert(&pdev->dev);
> + cxl_restore_pci_state_for_hdm_restore(pdev, command);
> + return cxl_restore_state(pdev, snapshot);
> +}
> +
> /*
> * CXL r4.0 sec 9.7.2 defines the reset completion timeout encodings.
> * Sec 9.7.3 leaves config-space access behavior undefined for 100 ms after
> @@ -412,7 +569,9 @@ static int cxl_clear_memory(struct pci_dev *pdev, int dvsec, bool initiate)
> }
>
> static int __cxl_reset_execute(struct pci_dev *pdev, int dvsec, u16 cap,
> - struct cxl_hdm_quiesce *q)
> + const struct cxl_hdm_info *snapshot,
> + struct cxl_hdm_quiesce *q,
> + u16 *command)
> {
> int rc, rc2;
>
> @@ -437,10 +596,15 @@ static int __cxl_reset_execute(struct pci_dev *pdev, int dvsec, u16 cap,
> pci_err(pdev, "failed to clear CXL Reset Memory Clear: %d\n", rc2);
> rc = rc ?: rc2;
>
> + if (!rc)
> + rc = pci_cxl_restore_state(pdev, snapshot, command);
> +
> rc2 = cxl_hdm_quiesce_flush(q);
[Severity: Low]
Does __cxl_reset_execute() also need the __must_hold(cxl_region_quiesce)
annotation to avoid compiler context-analysis (-Wthread-safety) warnings when
context analysis is enabled?
Both its caller cxl_reset_quiesced() and its callees pci_cxl_restore_state()
and cxl_hdm_quiesce_flush() are annotated with
__must_hold(cxl_region_quiesce), while __cxl_reset_execute() itself is not:
cxl_reset_execute()
cxl_region_quiesce_lock()
cxl_reset_quiesced() [__must_hold(cxl_region_quiesce)]
__cxl_reset_execute() [unannotated]
pci_cxl_restore_state() [__must_hold(cxl_region_quiesce)]
cxl_hdm_quiesce_flush() [__must_hold(cxl_region_quiesce)]
cxl_region_quiesce_unlock()
Relatedly, in include/cxl/hdm.h:
void cxl_region_quiesce_lock(void);
void cxl_region_quiesce_unlock(void);
the prototypes omit the __acquires(cxl_region_quiesce) and
__releases(cxl_region_quiesce) annotations that are present on the definitions
in drivers/cxl/core/hdm_state.c, which also prevents context analysis from
seeing the lock acquisition in cxl_reset_execute().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261029145703.2185231-1-smadhavan@nvidia.com?part=15
next prev parent reply other threads:[~2026-10-29 15:29 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 14:56 [PATCH v16 00/18] PCI/CXL: Add CXL reset support for Type 2 devices Srirangan Madhavan
2026-10-29 14:56 ` [PATCH v16 01/18] cxl: Clarify decoder interleave limit Srirangan Madhavan
2026-10-29 15:00 ` sashiko-bot
2026-10-29 14:56 ` [PATCH v16 02/18] cxl: Share CXL port upstream PCI device lookup Srirangan Madhavan
2026-10-29 15:07 ` sashiko-bot
2026-10-29 14:56 ` [PATCH v16 03/18] cxl: Move decoder declarations to shared header Srirangan Madhavan
2026-10-29 15:03 ` sashiko-bot
2026-10-29 14:56 ` [PATCH v16 04/18] cxl: Embed decoder configuration in a standalone structure Srirangan Madhavan
2026-10-29 15:03 ` sashiko-bot
2026-10-29 14:56 ` [PATCH v16 05/18] cxl: Introduce endpoint HDM decoder settings Srirangan Madhavan
2026-10-29 15:03 ` sashiko-bot
2026-10-29 14:56 ` [PATCH v16 06/18] cxl: Move HDM decoder helpers to built-in code Srirangan Madhavan
2026-10-29 15:03 ` sashiko-bot
2026-10-30 4:01 ` Richard Cheng
2026-10-29 14:56 ` [PATCH v16 07/18] cxl: Share HDM decoder register unpacking Srirangan Madhavan
2026-10-29 15:09 ` sashiko-bot
2026-10-30 6:21 ` Richard Cheng
2026-10-29 14:56 ` [PATCH v16 08/18] cxl: Move cxl_rwsem into built-in code Srirangan Madhavan
2026-10-29 15:04 ` sashiko-bot
2026-10-30 6:26 ` Richard Cheng
2026-10-29 14:56 ` [PATCH v16 09/18] cxl: Refresh cached PCI HDM decoder settings Srirangan Madhavan
2026-10-29 15:08 ` sashiko-bot
2026-10-30 6:58 ` Richard Cheng
2026-10-29 14:56 ` [PATCH v16 10/18] cxl: Build register block helpers into the kernel Srirangan Madhavan
2026-10-29 15:07 ` sashiko-bot
2026-10-30 7:02 ` Richard Cheng
2026-10-29 14:56 ` [PATCH v16 11/18] PCI/CXL: Cache endpoint HDM state during PCI enumeration Srirangan Madhavan
2026-10-29 15:29 ` sashiko-bot
2026-10-30 8:22 ` Richard Cheng
2026-10-29 14:56 ` [PATCH v16 12/18] PCI/CXL: Add CXL Device Reset sequencing Srirangan Madhavan
2026-10-29 15:05 ` sashiko-bot
2026-10-30 3:22 ` Richard Cheng
2026-10-29 14:56 ` [PATCH v16 13/18] cxl: Validate and synchronize HDM ranges around reset Srirangan Madhavan
2026-10-29 15:25 ` sashiko-bot
2026-10-30 3:45 ` Richard Cheng
2026-10-29 14:56 ` [PATCH v16 14/18] PCI/CXL: Reject reset with unsafe function scope Srirangan Madhavan
2026-10-29 15:10 ` sashiko-bot
2026-10-30 8:37 ` Richard Cheng
2026-10-29 14:57 ` [PATCH v16 15/18] PCI/CXL: Restore CXL state after PCI reset Srirangan Madhavan
2026-10-29 15:29 ` sashiko-bot [this message]
2026-10-29 14:57 ` [PATCH v16 16/18] PCI/CXL: Expose CXL Reset as a PCI reset method Srirangan Madhavan
2026-10-29 15:12 ` sashiko-bot
2026-10-30 8:36 ` Richard Cheng
2026-10-29 14:57 ` [PATCH v16 17/18] PCI/CXL: Restore CXL state after CXL bus reset Srirangan Madhavan
2026-10-29 15:22 ` sashiko-bot
2026-10-30 9:22 ` Richard Cheng
2026-10-29 14:57 ` [PATCH v16 18/18] cxl: Add KUnit checks for HDM decoder unpacking Srirangan Madhavan
2026-10-29 15:09 ` sashiko-bot
2026-10-29 18:58 ` [PATCH v16 00/18] PCI/CXL: Add CXL reset support for Type 2 devices Alison Schofield
2026-10-29 23:03 ` Srirangan Madhavan
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-189605@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=smadhavan@nvidia.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.