Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5008830rdb; Tue, 12 Dec 2023 16:36:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IFW2GwPGPxW/A4tjASfeQnogjk7mURHdBoEGmLWuH3ulukykQGKhpFR4pgZ1QU1IUOHaOCw X-Received: by 2002:a05:6a21:604:b0:18f:ea5b:6825 with SMTP id ll4-20020a056a21060400b0018fea5b6825mr3577952pzb.117.1702427794624; Tue, 12 Dec 2023 16:36:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702427794; cv=none; d=google.com; s=arc-20160816; b=xe+ZufwxofJg8CMwf8RE/7zp0+gMhIAdbv1wR/9DBiLIy8DQu+55dVywDUFNxmCpv5 bbgdCALMkmIJ5qCVDg3lHnr4V8OXeKCnSMz9FP0RCfeCkt+VTqNV8vFfHNOtyxOgBz4E ONsE3P1eFIVOMWKLAIkI5nyUGGzNh4cmEd/ny71L4HkCOTq40z0tn2G07aUH1Cl5+Qwi QWsfOYylbR3pTt8kXboBJJNaDLAnF5dbI37xslm7yPPdMP14cIE7pxRnvB7aQ2kGL9cl AgoqqQd/lYXI8UMuBxX9CHw0HZoFNMOGOKiieybLJEAB+upJhGgb0pa3V3uGMZhI9rHP gWjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4J3yyMVT0Ck6UqVMMggnyCj20M3aIOGukmt1/w28WlA=; fh=TXeuV5/wcpXTj7sVtU8LbAE1OfyC4N1uBVOdDk4O9CI=; b=oeXwaQiqKUAsR1j3R/9W4NpA+wxLVLnCtGdpzMDsZKFAD/jQLHNvzCQwNF78ccrA98 WpJimcIs5vrfmVzpm+HYETFjEB6QAJKaKcy1gUgeG0sHHpY6mTUevfoMoql3Jn7jEbN7 k2TlZYiYTCuy9Gt+YQjSWVp8Ee89egXD/n/OdpgiA78+SGZGlVV3vyDsmUQ5IkNEPHKR kIWWECTgNDcZ/as7xFgX4PZ4eG9iLl5nvFDE0jEDP3iS0/yvq5DoNCowdX65eb+BdQgz gDhyBom29z1I6/9WVvhh0i+tjA3hA6VKxpXUzB9fPgQzr6H4MhGQjIv9oflDslpBmXaY edbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RQHitFp8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id h9-20020a170902b94900b001cfd754d79esi8707648pls.79.2023.12.12.16.36.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 16:36:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RQHitFp8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 376958077572; Tue, 12 Dec 2023 16:36:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377871AbjLMAgW (ORCPT + 99 others); Tue, 12 Dec 2023 19:36:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377847AbjLMAgU (ORCPT ); Tue, 12 Dec 2023 19:36:20 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4836EB9 for ; Tue, 12 Dec 2023 16:36:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702427786; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4J3yyMVT0Ck6UqVMMggnyCj20M3aIOGukmt1/w28WlA=; b=RQHitFp8fXhxUD5EP4EHvhV7gBSpQZ/SN/nJmxzB4ZpvfKBWIA2F2/c/NhrhtCHAG4GLY1 fY3Hrz+XtTfBxwuezsT4LxEvWnlpgViJ++VBZbAeQGVyAROQvcIGa4ixo5a3ef8n8SMKy2 NQF7nm2XeQOnAuuhTsdy5d1RjpEQSpA= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-496-nIPG_mAZOtSj-ICft5S-pQ-1; Tue, 12 Dec 2023 19:36:23 -0500 X-MC-Unique: nIPG_mAZOtSj-ICft5S-pQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A3BE53833343; Wed, 13 Dec 2023 00:36:22 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq2.redhat.com (dell-r430-03.lab.eng.brq2.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id D2C821121306; Wed, 13 Dec 2023 00:36:20 +0000 (UTC) From: Igor Mammedov To: linux-kernel@vger.kernel.org Cc: Dongli Zhang , linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org, imammedo@redhat.com, mst@redhat.com, rafael@kernel.org, lenb@kernel.org, bhelgaas@google.com, mika.westerberg@linux.intel.com, boris.ostrovsky@oracle.com, joe.jin@oracle.com, stable@vger.kernel.org, Fiona Ebner , Thomas Lamprecht Subject: [RFC 2/2] PCI: acpiphp: slowdown hotplug if hotplugging multiple devices at a time Date: Wed, 13 Dec 2023 01:36:14 +0100 Message-Id: <20231213003614.1648343-3-imammedo@redhat.com> In-Reply-To: <20231213003614.1648343-1-imammedo@redhat.com> References: <20231213003614.1648343-1-imammedo@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Tue, 12 Dec 2023 16:36:33 -0800 (PST) previous commit ("PCI: acpiphp: enable slot only if it hasn't been enabled already" introduced a workaround to avoid a race between SCSI_SCAN_ASYNC job and bridge reconfiguration in case of single HBA hotplug. However in virt environment it's possible to pause machine hotplug several HBAs and let machine run. That can hit the same race when 2nd hotplugged HBA will start re-configuring bridge. Do the same thing as SHPC and throttle down hotplug of 2nd and up devices within single hotplug event. Signed-off-by: Igor Mammedov --- drivers/pci/hotplug/acpiphp_glue.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 6b11609927d6..30bca2086b24 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "../pci.h" #include "acpiphp.h" @@ -700,6 +701,7 @@ static void trim_stale_devices(struct pci_dev *dev) static void acpiphp_check_bridge(struct acpiphp_bridge *bridge) { struct acpiphp_slot *slot; + int nr_hp_slots = 0; /* Bail out if the bridge is going away. */ if (bridge->is_going_away) @@ -723,6 +725,10 @@ static void acpiphp_check_bridge(struct acpiphp_bridge *bridge) /* configure all functions */ if (slot->flags != SLOT_ENABLED) { + if (nr_hp_slots) + msleep(1000); + + ++nr_hp_slots; enable_slot(slot, true); } } else { -- 2.39.3