Message ID | 20230404020545.32359-1-decui@microsoft.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2715511vqo; Mon, 3 Apr 2023 19:09:31 -0700 (PDT) X-Google-Smtp-Source: AKy350b7bCfJZjm6zAS4ICMbD5aSvdtRecMRuPLHcTmb+4lFjJY9PJssWwOCxwizSlETvzU/93pn X-Received: by 2002:a17:907:988e:b0:947:bd54:cb8e with SMTP id ja14-20020a170907988e00b00947bd54cb8emr1054854ejc.10.1680574171451; Mon, 03 Apr 2023 19:09:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1680574171; cv=pass; d=google.com; s=arc-20160816; b=mq0kV/SDiYToYQ5CyWerfGHOl3e5kIWZEsY9iRfFefuKFWRBsO4XLCwOj5A7BHh7MI u1b9+eXE+7B8kbP0onfs2Knnt2lncaxngFynnL1nle0BBZJ5BITjcGzZgn4LZyiGMXly IIh0W+/aEUaK4qIuOetzCOYClSUFI8CvIw36sM9R6oJmOhawiONjKvsKD0+1YGiLaWyP efNBcgyzvCUo15n1GUVEl8QBTqyw0rW9ZKjBsbGWPyeQ9msDXd4K6hBIisYJFTEsZKmu 8Qabxh/00ldNkkxyU3yOlHh1IParvXHBzI9m2DDBIxH9mwYusCXKH8m4t3LPqPN1cIOd PCZA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=l5P8l4br+1d9DXbcCdavHVwhDuEVJ0uH+LnGsJjs4KU=; b=mVSX/8bQrde473T0xi8mOKI/vJVpWjcK/3XrvM2WB3XXQjn5OHOc1E1zASw+mGXnHc ZnBFIJdpuS9IOylra1PH0GjGy4cHYe5hmpLKejYotSkVthVEYrCsk2WHgWn3AHx1I/UG K74raX6hkcpPC3ijYAQBGV27CFQPPM4dddRGl4eP8IG/x42UvosNm6YD1k8yF9jO/S0h hLHR+6cUQH8BCCMa9ztLpxluztav10vA13et8tLgONJQsYuz9kZvmhhh65Ke10WnWWbb AmltbHKq3SD2mtIBud03ZWw+RcaAjmmpJQolqz8Gv4vDyasF4SSlQtanrOCOb73ypJZW YmxA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=HudTc0aZ; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jj15-20020a170907984f00b00930a6858cd8si2447659ejc.454.2023.04.03.19.09.07; Mon, 03 Apr 2023 19:09:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=HudTc0aZ; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233163AbjDDCHG (ORCPT <rfc822;zwp10758@gmail.com> + 99 others); Mon, 3 Apr 2023 22:07:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232676AbjDDCHC (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 3 Apr 2023 22:07:02 -0400 Received: from DM5PR00CU002.outbound.protection.outlook.com (mail-centralusazon11021027.outbound.protection.outlook.com [52.101.62.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04C481BC9; Mon, 3 Apr 2023 19:07:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ba/g2AC2i3t3THuqOp/m4EwyDjB/3i21WfboiwzV/F3fujCq/k517D5YzLgWIacxWwLlsPmI28hz+cF/AUHMhyLaBEzkJu5WYjHlTFEBqEekV48h2OS2EhIOBBs6AWliPGO3sVn/2kxG8YSTI1xMH9ZzA3rLprNNgdWd4J0xEPmmgfT3hqZE5RcZ/lsQmfUn2ekdpISGdSPYPIL+sFVkS2vJqRUDvyH+3NwSWGGrVs6JzjlPVXJ8uWoJb4VDv854XQ7wJL31B6BSb4ugpx7/aTKphpe0O18NUUcOxENstgL05DVNTsTNjcLWq0QXYy43eTeV/z+vMLvoQq6HhYL7pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=l5P8l4br+1d9DXbcCdavHVwhDuEVJ0uH+LnGsJjs4KU=; b=eGr6EayJVP17yA+gQ5VRjtUXuopZkZIrQmQoJ4Zk4zBCCitqrhWqLrTZdTMvADojB6dS3y/hD18gNoVOHaG2zy9YfP8zuwTU29EAajQgiPRbgdskhFodblz7LFV6uGItQHzqdNfmp58jKDx2jn/nnGKtkSd6ieo5qg4Nqfc/3INBl+/SW9P9OB9TgzZoVm7ouLJIlJf9dzLY5LaSyhJMEG+nF+T6QLOk/TnEfoOD6pH2D6fUYbaEJaYeD0hHtg4eNu7LaIFeDbzAkjnlBlwAMIAqI9Iuf2InOUNeLhgATLqSC4utBFlJiNZa0OMzFrOx5CZX1qSIyfWn3cPi1pIMPg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=l5P8l4br+1d9DXbcCdavHVwhDuEVJ0uH+LnGsJjs4KU=; b=HudTc0aZ9RXTeXtmqnuoBfXWjSs9mfAb1lWoyh3T+Fpya/BfMfxAcg+AXPiPYYclMuz6Px3GshQttzzeZ7FAwdqKE7bJ9Pa8Wv3qywQJn632DX8Q1/dLeMp8VKDkiKQIq3573vQviNLyc6ilEA401Vg1educJlkmAtLYqLSq3lA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; Received: from BL0PR2101MB1092.namprd21.prod.outlook.com (2603:10b6:207:30::23) by PH8PR21MB3959.namprd21.prod.outlook.com (2603:10b6:510:23b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.11; Tue, 4 Apr 2023 02:06:57 +0000 Received: from BL0PR2101MB1092.namprd21.prod.outlook.com ([fe80::97b2:25ca:c44:9b7]) by BL0PR2101MB1092.namprd21.prod.outlook.com ([fe80::97b2:25ca:c44:9b7%6]) with mapi id 15.20.6298.010; Tue, 4 Apr 2023 02:06:57 +0000 From: Dexuan Cui <decui@microsoft.com> To: bhelgaas@google.com, davem@davemloft.net, decui@microsoft.com, edumazet@google.com, haiyangz@microsoft.com, jakeo@microsoft.com, kuba@kernel.org, kw@linux.com, kys@microsoft.com, leon@kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, mikelley@microsoft.com, pabeni@redhat.com, robh@kernel.org, saeedm@nvidia.com, wei.liu@kernel.org, longli@microsoft.com, boqun.feng@gmail.com, ssengar@microsoft.com, helgaas@kernel.org Cc: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v2 0/6] pci-hyper: Fix race condition bugs for fast device hotplug Date: Mon, 3 Apr 2023 19:05:39 -0700 Message-Id: <20230404020545.32359-1-decui@microsoft.com> X-Mailer: git-send-email 2.17.1 Content-Type: text/plain X-ClientProxiedBy: MW4P221CA0019.NAMP221.PROD.OUTLOOK.COM (2603:10b6:303:8b::24) To BL0PR2101MB1092.namprd21.prod.outlook.com (2603:10b6:207:30::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL0PR2101MB1092:EE_|PH8PR21MB3959:EE_ X-MS-Office365-Filtering-Correlation-Id: 9a669683-ff62-48b4-6071-08db34b14499 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MsZLbRU8zyx+jA8PySaE1qY8TIOErziQL95/Q8AdrTY5ttFWDeXcKAus/Tegsbz/IFb+Tn1i+9q7y9yVhIZewxOCS4tBsIWHlS6tKyV5J43mO8EW9nXjq583O/QL4wOIUQ1O4g79HVj3s/8A+xhrCNh4KgrOBathcDLwxUdGPMWhuA9hbZkkpVxRHa5LSChGavuFb9iWo3+qIseevayDM7nSt5Opgy1K8mDgqPLuutThEvwZUFqzFnQrettUpdhhsKhaG5im+33PHiQ/R5kyA39pl3lOqqQClFi4C02/w+kyndYGyfeTxuay2sWjMHh/D2givV2xDnMxvMPCS0yOWLNvOBVlmgxRzn04j8JotWUdvLA2AsPhg8j18RQVhVBPNGvLPQaAeZhumSf2orpIxkLvSSBB0H8ZGSW0MkGT3Z943y7S26ptKcZPgWrFhQbboH+4EDHtyQPpA8JwfEWmAGsn9gJpdVs7/7D0aGtUnseU9YLmvAhBqgcrYCuOzgXrUDAhXVt2F2d16hKzw6C5cANHpq+0kmTAysM9MaBlY8z1ZJxQC/YaVXSIHRwaWdgurEjUJ6thM54gAe6ObwcZVGvAtyir1u65hGn8unpxrDdrnGoTRHYCQ3e4vNMU6d6y0sfGxTuaGgMg9hq53F6F6A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR2101MB1092.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(376002)(366004)(396003)(136003)(39860400002)(451199021)(966005)(6486002)(5660300002)(82950400001)(82960400001)(36756003)(478600001)(921005)(10290500003)(38100700002)(66946007)(66556008)(66476007)(8676002)(4326008)(86362001)(41300700001)(786003)(316002)(52116002)(8936002)(2616005)(186003)(6512007)(6506007)(1076003)(2906002)(6666004)(7416002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UqMTRDxSb6p47fmuw/cujRWhtIj8v2EDaQ39wDRB4rlAaIVP9VSkOOIeB3cmHnppvCxY8PfcP8IZ7O0UPWJ0SgebrnzTkfyNFVnpLG6UbBBuywllNQ3gPcyexvPCeYvPRW1drUgRVQonkeMqCj4TciVTsTswNBi5bEkCIgmwmfGeG+tqjZSZTRpkYu2CckRzbUBSRu4Gh3gBtedIYx5lhCvcFAe85rnDOovJycwe9eRr44en2zMrhkdqxljcj08KcUoNRgXsdopmLgVLXdFeVPMKtnkPOBiggXE5ntzZVHPim9Xo2rnqkIlJun4x6aplWw3Jsr9J+ocweahwWiwHMCyxKGB7zyDCmhGhhVp5Sl734FSHJYyvZ+I0A3yeFpKjtcceveAMjuls3ZHz2nuyJk7hpsp6M5p6ay/DuZNe+G7dBzKAPZrUY+zWeyDy1Q9ndAMTZfcYRIiOLjRH010osecYinjLkNM/25BYPjHJx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N//XV9pk349XTfxReZ/OcaKlNSgL2Y78lHkitGwVXmiVyJPCqk5VDQLewuKsr4pQYckeRy6aBgOVu+Bl3vJVZ6sC/8/0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a669683-ff62-48b4-6071-08db34b14499 X-MS-Exchange-CrossTenant-AuthSource: BL0PR2101MB1092.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Apr 2023 02:06:57.4476 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: qkck1vu8RJ70N/6y20OaFS1Zn5crk2e6ZCcZC7htwLkb5Y85IAg063F5Qf4GX624CFJYRkUnwa/AheNVjQVc0w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR21MB3959 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762209742103354720?= X-GMAIL-MSGID: =?utf-8?q?1762209742103354720?= |
Series |
pci-hyper: Fix race condition bugs for fast device hotplug
|
|
Message
Dexuan Cui
April 4, 2023, 2:05 a.m. UTC
Before the guest finishes probing a device, the host may be already starting to remove the device. Currently there are multiple race condition bugs in the pci-hyperv driver, which can cause the guest to panic. The patchset fixes the crashes. The patchset also does some cleanup work: patch 3 removes the useless hv_pcichild_state, and patch 4 reverts an old patch which is not really useful (without patch 4, it would be hard to make patch 5 clean). Patch 6 removes the use of a global mutex lock, and enables async-probing to allow concurrent device probing for faster boot. In v2, I dropped the "debug code" before the real patch body to avoid confusion; I fixed some minor issues pointed out by Michael Kelely: fixed "goto release_state_lock" in patch 5, and improved the commit log of patch 6; I added Wei Hu's Acked-by to patch 4. I added the cc:stable tag to all the 6 patches. v2 is based on v6.3-rc5. I have been testing the patchset with https://lwn.net/ml/linux-kernel/20230316091540.494366-1-alexander.stein%40ew.tq-group.com/ for several days, and no panic/hang is observed (earlier the kernel would panic/hang within 1 day in my long haul testing). The patchset is also availsble in my github branch: https://github.com/dcui/tdx/commits/decui/vpci/v6.3-rc5-v2 v1 can be found here: https://lwn.net/ml/linux-kernel/20230328045122.25850-1-decui%40microsoft.com/ Please review. Thanks! Dexuan Cui (6): PCI: hv: Fix a race condition bug in hv_pci_query_relations() PCI: hv: Fix a race condition in hv_irq_unmask() that can cause panic PCI: hv: Remove the useless hv_pcichild_state from struct hv_pci_dev Revert "PCI: hv: Fix a timing issue which causes kdump to fail occasionally" PCI: hv: Add a per-bus mutex state_lock PCI: hv: Use async probing to reduce boot time drivers/pci/controller/pci-hyperv.c | 145 +++++++++++++++++----------- 1 file changed, 86 insertions(+), 59 deletions(-)