From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796395530; b=o2L3a1YxLo2ywV79Fq4+MduVzQOAApsdHyZJLOffa1JuvVs2YcUmRj0Zz5wt9ZPwO01K j1R45IoO5BYiXk7gRQ+zSh4Zg8BL2V6IkxNQspyAWdjTPcRq++60rLHrpsds/FB9FlhCC h3eiJAG7ftpHf1YYT7KJsU4nlQBzNA9Aikr6ofWClEEU/hQ4eFLmpcNl3CNS5eI8IUmhH rOc9e7+1HlAGKMNdTvaDwC16vDG0t/GmlfyPt6d6/hSH1nUhKZEMG6SBsqBcal9lNdVsN hX+X5t2vwOOFE9IbwEA+sXFf7OgVCLduLYgd/LlKyP5mgJGqjjO0zI0LjgNI/ePTthA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796395530; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=2BtI3GrF3fUf7PU8cKJI26XaLe1uwODX26ep3rbua1A=; b=krs4nZwdPrh6Hs2TiekcxfZbA5WTSBBnagFzfgh2VCep24Q7egUX8ySbZrf/Pkqyrqnl 5rctMTtE6/9aFJJe+7bAGeV0ZjrmYneBM/AUBm61m/xR9/oMzDaBAaedgebn+8U15oUde 542l5v9Xeto/gFaQVKK6ftE2OuoSkMEhW43DJry0RGqIjK/1h8GCcYggOQLZZAubPI/Mv Xpa1shWzyJSssi0vOGYXLi85Zz0Z/c19qrolegbsDozjETbo4l4fXZt+dAPD0WBrQZAh5 zPZeKhLx7B41tvGuZbbmj9X/zpm4SF3lw8LHrtaHC4ZZFi5Xh5mvBEcLAJHtTiQWR3w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nPsHgxVd; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (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 BECE7606A322; Fri, 4 Dec 2026 14:45:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nPsHgxVd Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEFD01F000C2; Fri, 4 Dec 2026 14:45:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796395530; bh=2BtI3GrF3fUf7PU8cKJI26XaLe1uwODX26ep3rbua1A=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=nPsHgxVddQhDl01D8+7Ky4MnD2B86mpaydn+Laqk+nXnp0UFzesUx+rTwxf4x/HHy vsnDI21ZDnIn8CnwnaKazFGKbOGYZSK/MnXrYZAxzZ6s93yekdTylsxF39w1/C5VYm jmYNaD+Y1/SYqQVzCCDYtjek216kXB+uITtMvMJPQniOuMSerFa6OZsbWqoHFJO8aE wKLVHZb5TDn6D/WTj15n7Fahp52H8TXOjf6I50a56R/xlBD7hmNr5KvF0i4RS4VwVS J4O/aHgzMNMdXojQk6hBvA7xcCv6PsapphQXhoNLvOWhfizwUgLOn9fw7I8cRL592y cXLQ+NAZpi0aQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v6 2/4] PCI: loongson: Handle missing function 0 explicitly not via isolated functions Reply-To: sashiko-reviews@lists.linux.dev To: "Niklas Schnelle" Cc: linux-s390 , linux-pci@vger.kernel.org, virtualization@lists.linux.dev, "Heiko Carstens" , "Vasily Gorbik" , "Alexander Gordeev" , "Christian Borntraeger" , "Michael S. Tsirkin" , "Eugenio Perez" In-Reply-To: <20261204-ari_no_bus_dev-v6-2-855e75237600@linux.ibm.com> References: <20261204-ari_no_bus_dev-v6-0-855e75237600@linux.ibm.com> <20261204-ari_no_bus_dev-v6-2-855e75237600@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 14:45:29 +0000 X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] PCI: loongson: unsynchronized bus_flags RMW in pci_loongson_add_bus() -- commit a00d743eeef918a05cf235d984b0deccce027b91 Author: Niklas Schnelle PCI: loongson: Handle missing function 0 explicitly not via isolated functi= ons This commit introduces the PCI_BUS_FLAGS_MAYBE_NO_FN0 bus flag for Loongson PCI controllers via pci_loongson_add_bus() and checks it in pci_scan_slot(), replacing the CONFIG_LOONGARCH check in hypervisor_isolated_pci_functions(). Link: https://lore.kernel.org/lkml/CAAhV-H6qqppoX_G5KrWmPor16bXfvNTE2x8Xx6y= ajAYPqxpigw@mail.gmail.com/ Link: https://lore.kernel.org/linux-pci/20251014074100.2149737-1-chenhuacai= @loongson.cn/ > diff --git a/drivers/pci/controller/pci-loongson.c b/drivers/pci/controll= er/pci-loongson.c > index 6c0b7a3f4ba05..6241b8038fe16 100644 > --- a/drivers/pci/controller/pci-loongson.c > +++ b/drivers/pci/controller/pci-loongson.c > @@ -252,6 +252,19 @@ static void __iomem *cfg1_map(struct loongson_pci *p= riv, struct pci_bus *bus, > return priv->cfg1_base + addroff; > } > =20 > +static int pci_loongson_add_bus(struct pci_bus *bus) > +{ > + /* > + * Some Loongson systems rely on PCI devices with > + * a disabled function 0. Tell common code to keep looking > + * for PCI functions even if function 0 is missing. > + * This does not drop the checks for ARI and multifunction. > + */ > + bus->bus_flags |=3D PCI_BUS_FLAGS_MAYBE_NO_FN0; > + > + return 0; > +} [Severity: Low] Can this read-modify-write on bus->bus_flags race with msi_bus_store() on child buses? During a PCI rescan or hotplug of a bridge, pci_device_add() exposes the bridge's msi_bus sysfs attribute before pci_alloc_child_bus() creates its subordinate bus. Inside pci_alloc_child_bus(), bridge->subordinate is published before device_register(&child->dev) and child->ops->add_bus(child) run, while msi_bus_store() modifies subordinate->bus_flags without holding any lock: CPU0 CPU1 pci_alloc_child_bus() bridge->subordinate =3D child device_register(&child->dev) msi_bus_store() subordinate =3D pdev->subordinate pci_loongson_add_bus(child) bus->bus_flags |=3D ... subordinate->bus_flags |=3D ... <-- data race on bus_flags Because both sides perform unlocked non-atomic read-modify-writes, a concurrent update can silently lose a PCI_BUS_FLAGS_NO_MSI toggle even though msi_bus_store() returns success. Since pci_alloc_child_bus() already inherits parent->bus_flags before publishing bridge->subordinate, setting PCI_BUS_FLAGS_MAYBE_NO_FN0 only when pci_is_root_bus(bus) is true would avoid the redundant write on child buses. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204-ari_no_bus= _dev-v6-0-855e75237600@linux.ibm.com?part=3D2