From patchwork Thu Nov 8 16:26:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauricio Faria de Oliveira X-Patchwork-Id: 994997 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42rTFm63syz9s8T; Fri, 9 Nov 2018 03:27:08 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1gKn95-0006yI-8T; Thu, 08 Nov 2018 16:27:03 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1gKn92-0006uU-UR for kernel-team@lists.ubuntu.com; Thu, 08 Nov 2018 16:27:00 +0000 Received: from mail-qk1-f197.google.com ([209.85.222.197]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1gKn92-0004GA-I2 for kernel-team@lists.ubuntu.com; Thu, 08 Nov 2018 16:27:00 +0000 Received: by mail-qk1-f197.google.com with SMTP id l7-v6so38891393qkd.5 for ; Thu, 08 Nov 2018 08:27:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xab/zMW1AHEGUAmfidL+6J/Q4xT6XW8rnhFmQGOfO+A=; b=XNa6bKJ5AdJiTcU1Uw+yMsVjAsgnyw3fRh3hRsBtNbTI+Xv3lRwpv0svuaWRkVJvaa aKyq5yJt7ru2leovEblmZW6bdVb6Bjyc+tfWvfuhIYVvzn7JeDwm4NFC1g91O1Hq0Vw+ noV0BVmtRSZ06wHq++uMf2qyRJe1w1OaWTJXfMX922MkpNzTtyJXshW2WrnyPitps83a 7+nPDPBBmXj51YzC4r0M3ELOn1Rr13b2T1ozlsXI/B+7nmUJH4frCup35VwNvWWvG6jZ THBTrjr35khIBI0TczYPEQaEYGCziN9r7ZLlfjwAdE3Nx9+WM0HCUJSCuyQJjsU9u1Kw AR3Q== X-Gm-Message-State: AGRZ1gKG3EsDU0uIP64E2P+dfnloWXwg8LQUg7fbRc/jOFY91mJzMHWe qRjZVhoA+AJYUavgw5KHD/tlzynnRnKuUCRQ9FH1ojn9eATAXKCEVllL9Pn7+RZ7w2ccgroZlhR FajTkeI5DLop9IDZkbxs1nkzNE2IWACMRDdwNwvmyFg== X-Received: by 2002:a37:9a4c:: with SMTP id c73mr4933891qke.200.1541694419561; Thu, 08 Nov 2018 08:26:59 -0800 (PST) X-Google-Smtp-Source: AJdET5cPDtVhvSJhMBGRqxphybYSHOng6wjLXsMcPBM4yxUTYR5vr04w7Lx0f2cfOaTvWD3qKCXCLw== X-Received: by 2002:a37:9a4c:: with SMTP id c73mr4933871qke.200.1541694419328; Thu, 08 Nov 2018 08:26:59 -0800 (PST) Received: from localhost.localdomain ([179.159.57.206]) by smtp.gmail.com with ESMTPSA id t186-v6sm2211225qkd.54.2018.11.08.08.26.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Nov 2018 08:26:58 -0800 (PST) From: Mauricio Faria de Oliveira To: kernel-team@lists.ubuntu.com Subject: [SRU C][PATCH v2 3/3] UBUNTU: SAUCE: x86/quirks: Scan all busses for early PCI quirks Date: Thu, 8 Nov 2018 14:26:38 -0200 Message-Id: <20181108162638.17137-4-mfo@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181108162638.17137-1-mfo@canonical.com> References: <20181108162638.17137-1-mfo@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gpiccoli@canonical.com MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: "Guilherme G. Piccoli" BugLink: https://bugs.launchpad.net/bugs/1797990 Recently was noticed in an HP GEN9 system that kdump couldn't succeed due to an irq storm coming from an Intel NIC, narrowed down to be lack of clearing the MSI/MSI-X enable bits during the kdump kernel boot. For that, we need an early quirk to manually turn off MSI/MSI-X for PCI devices - this was worked as an optional boot parameter in a (~subsequent~) previous patch. Problem is that in our test system, the Intel NICs were not present in any secondary bus under the first PCIe root complex, so they couldn't be reached by the recursion in check_dev_quirk(). Modern systems, specially with multi-processors and multiple NUMA nodes expose multiple root complexes, describing more than one PCI hierarchy domain. Currently the simple recursion present in the early-quirks code from x86 starts a descending recursion from bus 0000:00, and reach many other busses by navigating this hierarchy walking through the bridges. This is not enough in systems with more than one root complex/host bridge, since the recursion won't "traverse" to other root complexes by starting statically in 0000:00 (for more details, see [0]). This patch hence implements the full bus/device/function scan in early_quirks(), by checking all possible busses instead of using a recursion based on the first root bus or limiting the search scope to the first 32 busses (like it was done in the beginning [1]). [0] https://bugs.launchpad.net/bugs/1797990 [1] From historical perspective, early PCI scan dates back to BitKeeper, added by Andi Kleen's "[PATCH] APIC fixes for x86-64", on October/2003. It initially restricted the search to the first 32 busses and slots. Due to a potential bug found in Nvidia chipsets, the scan was changed to run only in the first root bus: see commit 8659c406ade3 ("x86: only scan the root bus in early PCI quirks") Finally, secondary busses reachable from the 1st bus were re-added back by: commit 850c321027c2 ("x86/quirks: Reintroduce scanning of secondary buses") Reported-by: Dan Streetman Signed-off-by: Guilherme G. Piccoli [mfo: v2: - gate the bus-scan differences with the cmdline option. - update changelog: subsequent/previous patch.] Signed-off-by: Mauricio Faria de Oliveira --- arch/x86/kernel/early-quirks.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index e7561314eb5d..330749614db6 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c @@ -793,6 +793,10 @@ static int __init check_dev_quirk(int num, int slot, int func) PCI_HEADER_TYPE); if ((type & 0x7f) == PCI_HEADER_TYPE_BRIDGE) { + /* pci_early_clear_msi scans the buses differently. */ + if (pci_early_clear_msi) + return -1; + sec = read_pci_config_byte(num, slot, func, PCI_SECONDARY_BUS); if (sec > num) early_pci_scan_bus(sec); @@ -819,8 +823,13 @@ static void __init early_pci_scan_bus(int bus) void __init early_quirks(void) { + int bus; + if (!early_pci_allowed()) return; early_pci_scan_bus(0); + /* pci_early_clear_msi scans more buses. */ + for (bus = 1; pci_early_clear_msi && bus < 256; bus++) + early_pci_scan_bus(bus); }