Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2002432rdb; Thu, 7 Dec 2023 15:28:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IH55Fng2Mqp/MHD/z2ULUBCDUYa0ArgpDM0koloGB4RrSZ/Hsy3Qam/XOLnv4KMKP8UeB0v X-Received: by 2002:a05:6a00:1787:b0:6ce:8360:fa9c with SMTP id s7-20020a056a00178700b006ce8360fa9cmr3689309pfg.6.1701991727193; Thu, 07 Dec 2023 15:28:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701991727; cv=none; d=google.com; s=arc-20160816; b=MZUFukXEyN22EcTCrK/J35advN5oQy/5gj0/iGtrQIqVL2SolnlSyrSTdSSO5ZKO/a 5VJRB/5A9S77OL3Ey/YADslCbv/nnReZF+/v3uwog2FolRbb52WSo49JiO47GC01fxzF bVb+YDxJsjbyXDN2ddw7p9kEulnw9m/BnANBkhcB6DBSFUem3Lhe/1gvXF5rJHAjqVgR UK09DhkWkRZnmnrFZV7QCVXVLoLcXs1EPsI7EL39MurjQUjoLVS+wg6E0p4m5pRqNZMZ QuNATb8yanJkxijatEazd1GV6OajHAIMuY8a+gp0J6oAommDGMRJtI14Dhsri98AO4yY 9tBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=0GyASf8uf8HkQVl+AVgTjqDQeuvaJMZkX6eMqyUrQw8=; fh=uIwanZ4zBVopsR0uTAHNb4P1a8RFgUypL1QaGlanacI=; b=dNmxFGtOMXeBXyjLsSQd/ly0jr9q1qbQOUidjtRkOOcZX2VUe6wmP8TQdNDVdbQwCV OTouBXcvNAcd1FkuzplyfASfONqPp+gmiBLFjtzUld4w0ONtZWUjEJNYhqBN0dNtCy2j hlasOoFALXtzrJ++fplhCw1Q3SY43FfNBS86pvW30R7VdPe47J2x9gBM0mWUcRsWG1YF XAVCdLMGOkWU6R2mIe8HSy+/DOlpf5e0dCIHORd94GhNexf62hxDgnZGkdxsJKyanNbZ tGUfsoMNiLeIGX1QqLe+QO6+EwaR372eKRzn2Gw+WFlVAjmT956UbytPNBht4c76pSjH YhEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mVlqw5Yb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id e20-20020a656794000000b005c620f350fdsi453973pgr.341.2023.12.07.15.28.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 15:28:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mVlqw5Yb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id BBB0A807C7F5; Thu, 7 Dec 2023 15:28:43 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232536AbjLGX23 (ORCPT + 99 others); Thu, 7 Dec 2023 18:28:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235374AbjLGX2M (ORCPT ); Thu, 7 Dec 2023 18:28:12 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0750A1712 for ; Thu, 7 Dec 2023 15:28:18 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 608F4C433C9; Thu, 7 Dec 2023 23:28:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701991697; bh=DZ+5Z8KaZ9xQLPpIje7ERtXQp2O2ETE56yV3vkU7St8=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=mVlqw5Ybfu7kl5yYBdmXIo5fIIgEECYrKwsojA8PjBvs0qxwQCN4wJ+BVK930q2H0 9ewYe4APFkPRtfqxalCfRFR16Cu5RS6K/WdY6p3kEftGvfViN45CHv38g/KU+UcRyL j2vhZlkGGTE/G+f9WROEfDVQJdFhDetiqoAPtloxa0SXcovMYhbk1AaaclDXv+RYpr bV1SQChJXtkrbpIhwxZXBCVDIAkrPL3mOSjsFaNyGXmylU01HVONKfFHO6sV7DwMcA +3QkvlHCtByeRiVnsJG/iv/VeIOiTAjeJZm8rj8m/72+WA1BahiXr0UHlld4pC932W yw+fC6PAqkU4A== Date: Thu, 7 Dec 2023 17:28:15 -0600 From: Bjorn Helgaas To: Fiona Ebner Cc: linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, Igor Mammedov , linux-kernel@vger.kernel.org, bhelgaas@google.com, lenb@kernel.org, rafael@kernel.org, Thomas Lamprecht Subject: Re: SCSI hotplug issues with UEFI VM with guest kernel >= 6.5 Message-ID: <20231207232815.GA771837@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9eb669c0-d8f2-431d-a700-6da13053ae54@proxmox.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 07 Dec 2023 15:28:44 -0800 (PST) On Wed, Nov 29, 2023 at 04:22:41PM +0100, Fiona Ebner wrote: > Hi, > it seems that hot-plugging SCSI disks for QEMU virtual machines booting > with UEFI and with guest kernels >= 6.5 might be broken. It's not > consistently broken, hinting there might be a race somewhere. > > Reverting the following two commits seems to make it work reliably again: > > cc22522fd55e2 ("PCI: acpiphp: Use > pci_assign_unassigned_bridge_resources() only for non-root bus") > 40613da52b13f ("PCI: acpiphp: Reassign resources on bridge if necessary" > > Of course, they might only expose some pre-existing issue, but this is > my best lead. See below for some logs and details about an affected > virtual machine. Happy to provide more information and to debug/test > further. > ... > I've attached some logs for guest using kernel 6.7.0-rc3 where hotplug > works rarely and guest using kernel 6.7.0-rc3 with the previously > mentioned commits reverted where hotplug works reliably: > > 6.7.0-rc3: > > > Nov 29 15:12:02 hotplug kernel: pci 0000:01:02.0: [1af4:1004] type 00 class 0x010000 > > Nov 29 15:12:02 hotplug kernel: pci 0000:01:02.0: reg 0x10: [io 0x0000-0x003f] > > Nov 29 15:12:02 hotplug kernel: pci 0000:01:02.0: reg 0x14: [mem 0x00000000-0x00000fff] > > Nov 29 15:12:02 hotplug kernel: pci 0000:01:02.0: reg 0x20: [mem 0x00000000-0x00003fff 64bit pref] > > Nov 29 15:12:02 hotplug kernel: pci 0000:01:02.0: BAR 4: assigned [mem 0xc000004000-0xc000007fff 64bit pref] > > Nov 29 15:12:02 hotplug kernel: pci 0000:01:02.0: BAR 1: assigned [mem 0xc1401000-0xc1401fff] > > Nov 29 15:12:02 hotplug kernel: pci 0000:01:02.0: BAR 0: assigned [io 0xe040-0xe07f] > > Nov 29 15:12:02 hotplug kernel: pci 0000:00:05.0: PCI bridge to [bus 01] > > Nov 29 15:12:02 hotplug kernel: pci 0000:00:05.0: bridge window [io 0xe000-0xefff] > > Nov 29 15:12:02 hotplug kernel: pci 0000:00:05.0: bridge window [mem 0xc1400000-0xc15fffff] > > Nov 29 15:12:02 hotplug kernel: pci 0000:00:05.0: bridge window [mem 0xc000000000-0xc01fffffff 64bit pref] > > Nov 29 15:12:02 hotplug kernel: virtio-pci 0000:01:02.0: enabling device (0000 -> 0003) > > Nov 29 15:12:02 hotplug kernel: ACPI: \_SB_.LNKC: Enabled at IRQ 11 > > Nov 29 15:12:02 hotplug kernel: scsi host3: Virtio SCSI HBA > > Nov 29 15:12:02 hotplug kernel: pci 0000:00:05.0: PCI bridge to [bus 01] > > Nov 29 15:12:02 hotplug kernel: pci 0000:00:05.0: bridge window [io 0xe000-0xefff] > > Nov 29 15:12:02 hotplug kernel: scsi 3:0:0:1: Direct-Access QEMU QEMU HARDDISK 2.5+ PQ: 0 ANSI: 5 > > Nov 29 15:12:02 hotplug kernel: pci 0000:00:05.0: bridge window [mem 0xc1400000-0xc15fffff] > > Nov 29 15:12:02 hotplug kernel: pci 0000:00:05.0: bridge window [mem 0xc000000000-0xc01fffffff 64bit pref] What's the actual symptom that this is broken? All these log fragments show the exact same assignments for BARs 0, 1, 4 and for the bridge windows. I assume 0000:01:02.0 is the hot-added SCSI HBA, and 00:05.0 is a bridge leading to it? Can you put the complete dmesg logs somewhere? There's a lot of context missing here. Do you have to revert both cc22522fd55e2 and 40613da52b13f to make it work reliably? If we have to revert something, reverting one would be better than reverting both. Bjorn > Reboot > > > Nov 29 15:12:52 hotplug kernel: pci 0000:01:02.0: [1af4:1004] type 00 class 0x010000 > > Nov 29 15:12:52 hotplug kernel: pci 0000:01:02.0: reg 0x10: [io 0x0000-0x003f] > > Nov 29 15:12:52 hotplug kernel: pci 0000:01:02.0: reg 0x14: [mem 0x00000000-0x00000fff] > > Nov 29 15:12:52 hotplug kernel: pci 0000:01:02.0: reg 0x20: [mem 0x00000000-0x00003fff 64bit pref] > > Nov 29 15:12:52 hotplug kernel: pci 0000:01:02.0: BAR 4: assigned [mem 0xc000004000-0xc000007fff 64bit pref] > > Nov 29 15:12:52 hotplug kernel: pci 0000:01:02.0: BAR 1: assigned [mem 0xc1401000-0xc1401fff] > > Nov 29 15:12:52 hotplug kernel: pci 0000:01:02.0: BAR 0: assigned [io 0xe040-0xe07f] > > Nov 29 15:12:52 hotplug kernel: pci 0000:00:05.0: PCI bridge to [bus 01] > > Nov 29 15:12:52 hotplug kernel: pci 0000:00:05.0: bridge window [io 0xe000-0xefff] > > Nov 29 15:12:52 hotplug kernel: pci 0000:00:05.0: bridge window [mem 0xc1400000-0xc15fffff] > > Nov 29 15:12:52 hotplug kernel: pci 0000:00:05.0: bridge window [mem 0xc000000000-0xc01fffffff 64bit pref] > > Nov 29 15:12:52 hotplug kernel: virtio-pci 0000:01:02.0: enabling device (0000 -> 0003) > > Nov 29 15:12:52 hotplug kernel: ACPI: \_SB_.LNKC: Enabled at IRQ 11 > > Nov 29 15:12:52 hotplug kernel: scsi host3: Virtio SCSI HBA > > Nov 29 15:12:52 hotplug kernel: pci 0000:00:05.0: PCI bridge to [bus 01] > > Nov 29 15:12:52 hotplug kernel: pci 0000:00:05.0: bridge window [io 0xe000-0xefff] > > Nov 29 15:12:52 hotplug kernel: pci 0000:00:05.0: bridge window [mem 0xc1400000-0xc15fffff] > > Nov 29 15:12:52 hotplug kernel: scsi 3:0:0:1: Direct-Access QEMU QEMU HARDDISK 2.5+ PQ: 0 ANSI: 5 > > Nov 29 15:12:52 hotplug kernel: pci 0000:00:05.0: bridge window [mem 0xc000000000-0xc01fffffff 64bit pref] > > RebootThe one time it did work. Note that the line with "QEMU HARDDISK" > comes after all lines with "bridge window": > > > Nov 29 15:13:51 hotplug kernel: pci 0000:01:02.0: [1af4:1004] type 00 class 0x010000 > > Nov 29 15:13:51 hotplug kernel: pci 0000:01:02.0: reg 0x10: [io 0x0000-0x003f] > > Nov 29 15:13:51 hotplug kernel: pci 0000:01:02.0: reg 0x14: [mem 0x00000000-0x00000fff] > > Nov 29 15:13:51 hotplug kernel: pci 0000:01:02.0: reg 0x20: [mem 0x00000000-0x00003fff 64bit pref] > > Nov 29 15:13:51 hotplug kernel: pci 0000:01:02.0: BAR 4: assigned [mem 0xc000004000-0xc000007fff 64bit pref] > > Nov 29 15:13:51 hotplug kernel: pci 0000:01:02.0: BAR 1: assigned [mem 0xc1401000-0xc1401fff] > > Nov 29 15:13:51 hotplug kernel: pci 0000:01:02.0: BAR 0: assigned [io 0xe040-0xe07f] > > Nov 29 15:13:51 hotplug kernel: pci 0000:00:05.0: PCI bridge to [bus 01] > > Nov 29 15:13:51 hotplug kernel: pci 0000:00:05.0: bridge window [io 0xe000-0xefff] > > Nov 29 15:13:51 hotplug kernel: pci 0000:00:05.0: bridge window [mem 0xc1400000-0xc15fffff] > > Nov 29 15:13:51 hotplug kernel: pci 0000:00:05.0: bridge window [mem 0xc000000000-0xc01fffffff 64bit pref] > > Nov 29 15:13:51 hotplug kernel: virtio-pci 0000:01:02.0: enabling device (0000 -> 0003) > > Nov 29 15:13:51 hotplug kernel: ACPI: \_SB_.LNKC: Enabled at IRQ 11 > > Nov 29 15:13:51 hotplug kernel: scsi host3: Virtio SCSI HBA > > Nov 29 15:13:51 hotplug kernel: pci 0000:00:05.0: PCI bridge to [bus 01] > > Nov 29 15:13:51 hotplug kernel: pci 0000:00:05.0: bridge window [io 0xe000-0xefff] > > Nov 29 15:13:51 hotplug kernel: pci 0000:00:05.0: bridge window [mem 0xc1400000-0xc15fffff] > > Nov 29 15:13:51 hotplug kernel: pci 0000:00:05.0: bridge window [mem 0xc000000000-0xc01fffffff 64bit pref] > > Nov 29 15:13:51 hotplug kernel: scsi 3:0:0:1: Direct-Access QEMU QEMU HARDDISK 2.5+ PQ: 0 ANSI: 5 > > Nov 29 15:13:51 hotplug kernel: sd 3:0:0:1: Attached scsi generic sg1 type 0 > > Nov 29 15:13:51 hotplug kernel: sd 3:0:0:1: Power-on or device reset occurred > > Nov 29 15:13:51 hotplug kernel: sd 3:0:0:1: [sdb] 2048 512-byte logical blocks: (1.05 MB/1.00 MiB) > > Nov 29 15:13:51 hotplug kernel: sd 3:0:0:1: [sdb] Write Protect is off > > Nov 29 15:13:51 hotplug kernel: sd 3:0:0:1: [sdb] Mode Sense: 63 00 00 08 > > Nov 29 15:13:51 hotplug kernel: sd 3:0:0:1: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA > > Nov 29 15:13:51 hotplug kernel: sd 3:0:0:1: [sdb] Attached SCSI disk > > Nov 29 15:14:08 hotplug systemd[1]: systemd-fsckd.service: Deactivated successfully. > > 6.7.0-rc3 with the following reverted: > cc22522fd55e2 ("PCI: acpiphp: Use > pci_assign_unassigned_bridge_resources() only for non-root bus") > 40613da52b13f ("PCI: acpiphp: Reassign resources on bridge if necessary") > > > Nov 29 15:15:37 hotplug kernel: pci 0000:01:02.0: [1af4:1004] type 00 class 0x010000 > > Nov 29 15:15:37 hotplug kernel: pci 0000:01:02.0: reg 0x10: [io 0x0000-0x003f] > > Nov 29 15:15:37 hotplug kernel: pci 0000:01:02.0: reg 0x14: [mem 0x00000000-0x00000fff] > > Nov 29 15:15:37 hotplug kernel: pci 0000:01:02.0: reg 0x20: [mem 0x00000000-0x00003fff 64bit pref] > > Nov 29 15:15:37 hotplug kernel: pci 0000:01:02.0: BAR 4: assigned [mem 0xc000004000-0xc000007fff 64bit pref] > > Nov 29 15:15:37 hotplug kernel: pci 0000:01:02.0: BAR 1: assigned [mem 0xc1401000-0xc1401fff] > > Nov 29 15:15:37 hotplug kernel: pci 0000:01:02.0: BAR 0: assigned [io 0xe040-0xe07f] > > Nov 29 15:15:37 hotplug kernel: virtio-pci 0000:01:02.0: enabling device (0000 -> 0003) > > Nov 29 15:15:37 hotplug kernel: ACPI: \_SB_.LNKC: Enabled at IRQ 11 > > Nov 29 15:15:37 hotplug kernel: scsi host3: Virtio SCSI HBA > > Nov 29 15:15:37 hotplug kernel: scsi 3:0:0:1: Direct-Access QEMU QEMU HARDDISK 2.5+ PQ: 0 ANSI: 5 > > Nov 29 15:15:37 hotplug kernel: sd 3:0:0:1: Attached scsi generic sg1 type 0 > > Nov 29 15:15:37 hotplug kernel: sd 3:0:0:1: Power-on or device reset occurred > > Nov 29 15:15:37 hotplug kernel: sd 3:0:0:1: [sdb] 2048 512-byte logical blocks: (1.05 MB/1.00 MiB) > > Nov 29 15:15:37 hotplug kernel: sd 3:0:0:1: [sdb] Write Protect is off > > Nov 29 15:15:37 hotplug kernel: sd 3:0:0:1: [sdb] Mode Sense: 63 00 00 08 > > Nov 29 15:15:37 hotplug kernel: sd 3:0:0:1: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA > > Nov 29 15:15:37 hotplug kernel: sd 3:0:0:1: [sdb] Attached SCSI disk > > Nov 29 15:15:38 hotplug systemd[1]: systemd-fsckd.service: Deactivated successfully. >