Linux s390 Architecture development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Heiko Carstens" <hca@linux.ibm.com>
Cc: "Vasily Gorbik" <gor@linux.ibm.com>,
	"Heiko Carstens" <hca@linux.ibm.com>,
	"Alexander Gordeev" <agordeev@linux.ibm.com>,
	linux-s390@vger.kernel.org
Subject: Re: [PATCH v3 3/3] s390/pci: Enable CONTEXT_ANALYSIS
Date: Wed, 05 Aug 2026 14:12:15 +0000	[thread overview]
Message-ID: <20260805141216.382B01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260805133627.1216607-4-hca@linux.ibm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing lock acquisition in zpci_remove_reserved_devices() leading to lockdep failure and state corruption.
- [High] Race condition in zpci_event_avail_new_device() exposing an unlocked device to concurrent state changes.
--

--- Patch [3]: [PATCH v3 3/3] s390/pci: Enable CONTEXT_ANALYSIS ---
commit f14ecb575360924ecbbf3801f2b0b0e2ff3a2eeb
Author: Heiko Carstens <hca@linux.ibm.com>

s390/pci: Enable CONTEXT_ANALYSIS

This commit enables CONTEXT_ANALYSIS in the s390 PCI Makefile since the
code now compiles without warnings.

> diff --git a/arch/s390/pci/Makefile b/arch/s390/pci/Makefile
> index 1810e0944a4ed..b8be1316491b8 100644
> --- a/arch/s390/pci/Makefile
> +++ b/arch/s390/pci/Makefile
> @@ -3,6 +3,8 @@
>  # Makefile for the s390 PCI subsystem.
>  #
>  
> +CONTEXT_ANALYSIS := y
> +

[Severity: High]
This is a pre-existing issue and was not introduced by the patch under
review, but since context analysis is being enabled to catch locking issues,
I noticed a missing lock acquisition that it might not be catching.

In arch/s390/pci/pci.c:zpci_remove_reserved_devices():

	list_for_each_entry_safe(zdev, tmp, &remove, entry)
		zpci_device_reserved(zdev);

The function zpci_device_reserved() unconditionally asserts
lockdep_assert_held(&zdev->state_lock). Will calling it here without
holding zdev->state_lock lead to a lockdep failure or state corruption
if accessed concurrently by sysfs or event handlers?


[Severity: High]
This is also a pre-existing issue not introduced by the patch under
review, but there might be a race condition exposed here as well.

In arch/s390/pci/pci_event.c:zpci_event_avail_new_device():

	if (zpci_add_device(zdev)) {
		kfree(zdev);
		break;
	}
	zpci_scan_configured_device(zdev, ccdf->fh);

Once zpci_add_device() publishes the device globally, can concurrent
threads acquire zdev->state_lock and deconfigure the device while
zpci_scan_configured_device() is still running unlocked?

>  obj-$(CONFIG_PCI)	+= pci.o pci_irq.o pci_clp.o \
>  			   pci_event.o pci_debug.o pci_insn.o pci_mmio.o \
>  			   pci_bus.o pci_kvm_hook.o pci_report.o pci_fixup.o

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260805133627.1216607-1-hca@linux.ibm.com?part=3

  reply	other threads:[~2026-08-05 14:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-05 13:36 [PATCH v3 0/3] s390/pci: Enable CONTEXT_ANALYSIS Heiko Carstens
2026-08-05 13:36 ` [PATCH v3 1/3] s390/pci: Rework __zpci_event_error() to remove conditional locking Heiko Carstens
2026-08-05 14:09   ` sashiko-bot
2026-08-05 13:36 ` [PATCH v3 2/3] s390/pci: Rework __zpci_event_availability() " Heiko Carstens
2026-08-05 14:01   ` Niklas Schnelle
2026-08-05 14:23   ` sashiko-bot
2026-08-05 13:36 ` [PATCH v3 3/3] s390/pci: Enable CONTEXT_ANALYSIS Heiko Carstens
2026-08-05 14:12   ` sashiko-bot [this message]
2026-08-07 10:48 ` [PATCH v3 0/3] " Heiko Carstens

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=20260805141216.382B01F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --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