Received: by 10.223.185.116 with SMTP id b49csp4145503wrg; Tue, 6 Mar 2018 10:32:09 -0800 (PST) X-Google-Smtp-Source: AG47ELuUAoSbGq3zVuX6s5pJV/Qc+z1yC+C0JwAAdpbPl+jozC6Wv0olvlWrJuUnE9X6Hcro9DgR X-Received: by 2002:a17:902:600e:: with SMTP id r14-v6mr17911864plj.200.1520361129865; Tue, 06 Mar 2018 10:32:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520361129; cv=none; d=google.com; s=arc-20160816; b=BikGeCWcubA8nErOCJVl+laB4yGYEddINGWEl4KDcKhoijCuE82DoLQiu1f0iB9Mvw Zp2Ot3C5352Zy978iBl5TBewEQAbvYyi2EpKET4U73wcI/Si4DGu/8pGgZT7nrYK3MaD EuCGW71Az1KV+TZ40fqPvjnMFEwq1q2Ex2Sk4WYiZ69qGb7PUOF3Sa16akCSdtWUymr8 Y0Sv8p72pKkR6QuNOmC1z6dCSpyIvhKR0uRNOXhSZCCLB1ROxFuqCZiXXhfubJ/GH3Dr R3XwMBYN69oB1lQ6stTC0bV3cayh2hQqZ2K7XjUxVuSUjWoQFMNPCjkEL+e05/21C9Xu Lo5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:msip_labels :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=OIIhdvFZ58I4M4I4QJOdo24vTGHjWp5owX1KCki5sI8=; b=MVAAXlmKGUUWyQAP0riiCMVyPzQMxSk4dxJnVRIFdeNyDRmOvLbY6zxYdXcLF/cKAW 4nefVsRG8qQkUbvsw5GFGlGehJKakGoaQZndqpwPA51r+6TYWUjwXjq2XIEPwVTsDyKe Zc3M5AFRZL5jCn3jv0XQEM8qPfFummsMRL33gadESbLXcD5gs0ZCZY2y+1KDS0HsSmKF jUM8h9KMrPYmKdJn8zVuMCNXp94gMNFapN63EvyT9OoKT6U4iPBZ0FhTxAaZbvHhsp0c D4jXvgWeMqfg9/YIhRwjFtUN23nhM5fIp4yzB7sQrvihV/ulaVT7k6i+8CZS8SsOmL06 wGFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Y7x9UtLe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t12si10102486pgb.190.2018.03.06.10.31.55; Tue, 06 Mar 2018 10:32:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Y7x9UtLe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S932604AbeCFSal (ORCPT + 99 others); Tue, 6 Mar 2018 13:30:41 -0500 Received: from mail-sn1nam01on0093.outbound.protection.outlook.com ([104.47.32.93]:49765 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753901AbeCFSah (ORCPT ); Tue, 6 Mar 2018 13:30:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=OIIhdvFZ58I4M4I4QJOdo24vTGHjWp5owX1KCki5sI8=; b=Y7x9UtLeA3SF1ogKhD8+K2bRS7VaC0l0RTYSf9/Ec/23nDHH+m503bqCHG7q3mQiafBx6vFPRFK8KFr0yUh4EKiiBWWlYXFHZs6A7qaXgOVkZsvNfj/Ch3M/oz/b51zEi3fpaMhtI0Xtz/6Fo6286OfX3kYNjxxC+TAE09SlI84= Received: from DM5PR2101MB1030.namprd21.prod.outlook.com (52.132.128.11) by DM5PR2101MB1112.namprd21.prod.outlook.com (52.132.133.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.588.3; Tue, 6 Mar 2018 18:30:33 +0000 Received: from DM5PR2101MB1030.namprd21.prod.outlook.com ([fe80::14f:785d:71f2:d396]) by DM5PR2101MB1030.namprd21.prod.outlook.com ([fe80::14f:785d:71f2:d396%4]) with mapi id 15.20.0588.001; Tue, 6 Mar 2018 18:30:33 +0000 From: "Michael Kelley (EOSG)" To: Dexuan Cui , "bhelgaas@google.com" , "linux-pci@vger.kernel.org" , KY Srinivasan , Stephen Hemminger , "olaf@aepfle.de" , "apw@canonical.com" , "jasowang@redhat.com" CC: "linux-kernel@vger.kernel.org" , "driverdev-devel@linuxdriverproject.org" , Haiyang Zhang , "vkuznets@redhat.com" , "marcelo.cerri@canonical.com" , Jack Morgenstein , "stable@vger.kernel.org" Subject: RE: [PATCH v3 3/6] PCI: hv: serialize the present/eject work items Thread-Topic: [PATCH v3 3/6] PCI: hv: serialize the present/eject work items Thread-Index: AQHTtXgB6lWrZGCe00CPLCBSKQV72qPDhzOw Date: Tue, 6 Mar 2018 18:30:33 +0000 Message-ID: References: <20180306182128.23281-1-decui@microsoft.com> <20180306182128.23281-4-decui@microsoft.com> In-Reply-To: <20180306182128.23281-4-decui@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Owner=mikelley@ntdev.microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2018-03-06T18:30:31.7253905Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=General; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Application=Microsoft Azure Information Protection; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Extended_MSFT_Method=Automatic; Sensitivity=General x-originating-ip: [24.22.167.197] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1112;7:x9ZU5RLoarHVC9pBnl5KCZVRe0p8BhBMbPZKpD2Vmuy7wLiJ0G2VfKBDhkaDHEbHTulh6dcpu8zsz+APq13SoBarrus+LhxHxNvcbYbLyAmt65w+w6X4j2YUdCFFL6skqGPY6TVJ3DW2icVW70O1FG/8EeqhGtnfyDtDHXLqHxC0l0T8roIz5ykS5jTVtC39I+MGbPDBjytxI78uXpYTCpupzlbgNcxrVm7dTNOJyFnDRDD/rvxJx8qI/HWQQdcA;20:0L+7iimS05yoxyzqzWNoNXw8uYhr1v9pLE9huruGIlznEUaJMHxK2eMGdTfh+f/PJjt8emKuijRqeW5bBYntTTgYkvCl3+1xKwSzz1POe4WvX9I72C2PR31RwFHaySpIJ5qkoC5KosEbbll1uIxsM3o7To6FQ0SOrYqmp2XQxR8= x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: b6b225b5-4924-4df1-a5f8-08d5839058e3 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(2017052603328)(7193020);SRVR:DM5PR2101MB1112; x-ms-traffictypediagnostic: DM5PR2101MB1112: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Michael.H.Kelley@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(9452136761055)(211936372134217)(198206253151910); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231220)(944501244)(52105095)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041288)(20161123558120)(20161123560045)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB1112;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1112; x-forefront-prvs: 06036BD506 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(396003)(39860400002)(366004)(39380400002)(346002)(13464003)(199004)(189003)(6506007)(110136005)(68736007)(305945005)(4326008)(105586002)(10090500001)(7736002)(2201001)(6436002)(316002)(97736004)(102836004)(72206003)(2900100001)(2501003)(86612001)(10290500003)(14454004)(478600001)(6116002)(86362001)(2950100002)(74316002)(229853002)(22452003)(81156014)(54906003)(76176011)(81166006)(2906002)(7416002)(9686003)(53936002)(99286004)(6246003)(3846002)(8936002)(66066001)(1511001)(5660300001)(7696005)(3280700002)(26005)(8990500004)(53546011)(3660700001)(8676002)(33656002)(55016002)(5250100002)(106356001)(25786009);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1112;H:DM5PR2101MB1030.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: lswv8XvGtCo3CtNWkNgRYW+71rsMAgvbZdu0gc0MU0YzaZ5sbFlPKE8LxEmllS8VToKryubuUH21tIzGv1uNYQqcJpanOS8Woc76COlPGOsYw/fvXeBv0ELa4C1Sdi1iwhLjMmXp+YHWYda+AIl530G6HLA6i3NP7vGeHngy/tOdAgih8xtvQiQzZTmKBlSQQBnOSCnyblqRHtUXnGW2gUR8mDYxWXl25tmbFkKIZLvGmJP0ynDWVvQKpmQ/ku3JlE6nMXxMxtPfRWQBRdG/Eae4McU1embKN5Njwbfy6LNZ6VRaKHyjFJeFW3C5rnmABo0zbP9L1YPIQCucuqUejA== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: b6b225b5-4924-4df1-a5f8-08d5839058e3 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Mar 2018 18:30:33.1165 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1112 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Dexuan Cui > Sent: Tuesday, March 6, 2018 10:22 AM > To: bhelgaas@google.com; linux-pci@vger.kernel.org; KY Srinivasan ; > Stephen Hemminger ; olaf@aepfle.de; apw@canonical= .com; > jasowang@redhat.com > Cc: linux-kernel@vger.kernel.org; driverdev-devel@linuxdriverproject.org;= Haiyang Zhang > ; vkuznets@redhat.com; marcelo.cerri@canonical.co= m; Michael > Kelley (EOSG) ; Dexuan Cui ; Jack > Morgenstein ; stable@vger.kernel.org > Subject: [PATCH v3 3/6] PCI: hv: serialize the present/eject work items >=20 > When we hot-remove the device, we first receive a PCI_EJECT message and > then receive a PCI_BUS_RELATIONS message with bus_rel->device_count =3D= =3D 0. >=20 > The first message is offloaded to hv_eject_device_work(), and the second > is offloaded to pci_devices_present_work(). Both the paths can be running > list_del(&hpdev->list_entry), causing general protection fault, because > system_wq can run them concurrently. >=20 > The patch eliminates the race condition. >=20 > Signed-off-by: Dexuan Cui > Tested-by: Adrian Suhov > Tested-by: Chris Valean > Cc: Vitaly Kuznetsov > Cc: Jack Morgenstein > Cc: stable@vger.kernel.org > Cc: Stephen Hemminger > Cc: K. Y. Srinivasan > --- > drivers/pci/host/pci-hyperv.c | 17 ++++++++++++++--- > 1 file changed, 14 insertions(+), 3 deletions(-) >=20 Reviewed-by: Michael Kelley