Received: by 10.223.185.111 with SMTP id b44csp682134wrg; Fri, 9 Mar 2018 11:40:11 -0800 (PST) X-Google-Smtp-Source: AG47ELt9+mekw1ScDMP1y+pzvMBgbgEbClOyyRRxvZ+hW18jS0n6fflMnkWjMOPfvJnfB83h/ors X-Received: by 10.99.140.85 with SMTP id q21mr24712649pgn.51.1520624410998; Fri, 09 Mar 2018 11:40:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520624410; cv=none; d=google.com; s=arc-20160816; b=HWS+2+BddYujYl7ZCc7OeiAkxrYJheJ2NusID+UBjePOfxzlABXJBOsg1BhL0qcgo6 q7XsA4BemLBmPs8JKRswWVAR1uZDn3BLZZ397AHfbpnac1b5yfZcIe5LRX2mT4dAcEzb TKhRVINVcf6e3SfVNX1CE8ef5q/jncgOHNC2LO1gPUtBlTyPT7HP4eQrBeTXvMGCgQ98 IhtG0JBTWEiPy3Wts3FcI7Z0vlR7Gr60xqRUbCyLB9bT8MZczGqf9tbKTRa1T/y5zKCJ qujjg2PK0OGyPJs0/2w0xV5mX6dMHua2b2yIYBSYoRYFhydUESo/f0kmWaRfS4QxyZ7c KnbA== 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=cEhcbP5UZDPHAafSxBB3jtmobQ7lTx2TmdZ2I7jENUM=; b=LaC0Dz5NTy5SiaUVLxYTHo/rJwseS48PoWZ2LlVGmF0AySog+OBu7IbwKDNIhmBWX5 05dgtUpFJ0e6QTKEqT5yRziCmlp6yqY9LeMI/y0faunACjfzt/46YYbsTRH/4/BoG+MV Pan2x+qqF+a19Q3XduIv2wyJHPV1JeSK1bfH0/hme9ZeLx0HbKtNRPgQ33NnCTPvQK7x m6unHM5562tVJvD3ix641LCSTuZ0L0HhJbl14EIgqWcRFFwyqa0e1vy24hVv1lr4KHJX 30orVt/0+rBfLzlBKDrrfrdEZ+nuFNdo1ujipehESWGCJCEs+azYDIVO3tHi3cnnqnUl FiKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=L+rc2Oj9; 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 a34-v6si1374398pld.8.2018.03.09.11.39.56; Fri, 09 Mar 2018 11:40:10 -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=L+rc2Oj9; 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 S932698AbeCITif (ORCPT + 99 others); Fri, 9 Mar 2018 14:38:35 -0500 Received: from mail-sn1nam02on0139.outbound.protection.outlook.com ([104.47.36.139]:58348 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932661AbeCITia (ORCPT ); Fri, 9 Mar 2018 14:38:30 -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=cEhcbP5UZDPHAafSxBB3jtmobQ7lTx2TmdZ2I7jENUM=; b=L+rc2Oj9QQxI5Ti8Ry0UN3VwgGFmS/h6fFAlYMCKwpnvEAfiT5Ebyg8TM5JnF3Xf8SPVgP4IsbS4szVTFJjKsaIr92hAF/pU7SKTtujET+tGUyMAsC+xri/67TQxf2AwUtod4UupfbxnzN9gfPP1mCTjpEGo/potw99zVePuTTc= Received: from BL0PR2101MB1108.namprd21.prod.outlook.com (52.132.24.31) by BL0PR2101MB1076.namprd21.prod.outlook.com (52.132.24.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.588.1; Fri, 9 Mar 2018 19:37:21 +0000 Received: from BL0PR2101MB1108.namprd21.prod.outlook.com ([fe80::a9c2:e3f3:4b2:9517]) by BL0PR2101MB1108.namprd21.prod.outlook.com ([fe80::a9c2:e3f3:4b2:9517%3]) with mapi id 15.20.0588.009; Fri, 9 Mar 2018 19:37:21 +0000 From: Haiyang Zhang 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" , "vkuznets@redhat.com" , "marcelo.cerri@canonical.com" , "Michael Kelley (EOSG)" , 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: AQHTtXgBpTiV2t8ytkWUZze+26AbwaPIURNA Date: Fri, 9 Mar 2018 19:37:21 +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=haiyangz@microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2018-03-09T19:37:20.5642665Z; 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: [69.130.166.81] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BL0PR2101MB1076;7:USI1vNTqIl423v37o/1MqXCFUG+Wn/VMU8uV72NSFtws3aJz1q6RVLPioqBR24e0vC+Z22vxPlkjAsWZ4JAG7VhWiFjm2g/S7lyBeX5JsEeZbDEgFTwxLedJ/yY6NxGDUVRvgzvdTRvYbPUzNC/VJopSx4sf2qtoM+kB0ZU1LEYPLt8KVvxoYMPTvfeJHnvm8hECOi3moz4Osws16CNe8NscgqgoPCV6sgWvil7D4i1844BhfxX781qZWrh8mS2P;20:phiXyDnr1CDrlPWAXzGlRPO70GpPyMZHYUzyEFwnTdMR7jyelKfh8ZOzMqc29wkXBxh1gn1uf5IxoG8YZIHJfWLl5uAFRK7h6k+znGpFLj7W4AiUuiYUYmtKheFqCRK3fJk4hspNJjNgPgvmV6a8O9kIuHTOCKBzaXF30JpE1Zw= x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 14330c6d-e80e-407d-6d58-08d585f52d6f x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(2017052603328)(7193020);SRVR:BL0PR2101MB1076; x-ms-traffictypediagnostic: BL0PR2101MB1076: authentication-results: spf=none (sender IP is ) smtp.mailfrom=haiyangz@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)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231220)(944501255)(52105095)(93006095)(93001095)(3002001)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123564045)(20161123562045)(6072148)(201708071742011);SRVR:BL0PR2101MB1076;BCL:0;PCL:0;RULEID:;SRVR:BL0PR2101MB1076; x-forefront-prvs: 0606BBEB39 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(346002)(39860400002)(39380400002)(396003)(366004)(13464003)(199004)(189003)(2501003)(86612001)(2906002)(53546011)(2950100002)(316002)(3660700001)(6436002)(6506007)(5250100002)(2900100001)(8936002)(229853002)(86362001)(4326008)(25786009)(2201001)(3280700002)(97736004)(1511001)(102836004)(6246003)(9686003)(55016002)(110136005)(26005)(74316002)(10290500003)(22452003)(478600001)(99286004)(8990500004)(3846002)(305945005)(54906003)(66066001)(53936002)(106356001)(8676002)(5660300001)(33656002)(7696005)(81156014)(105586002)(76176011)(7416002)(81166006)(14454004)(68736007)(7736002)(6116002)(10090500001);DIR:OUT;SFP:1102;SCL:1;SRVR:BL0PR2101MB1076;H:BL0PR2101MB1108.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: sxlW5iIzqkwqyZwcEBbaZZPHh9j3Rs03tpOIM2rJPtgewF7+MVHn5YhQDU0panBMH8t5y8WpPh2INOY3TO91AfhCHoyS/lGaLRgYhxZk0F15gJ2n4tazsv7of0yX97JKV/PmXxchS36UrhayXerMHm3a7TMzMAB7ECBUKyIGiNDmJnI5fdQXg4YOHQGUfnj4yl0Gv8juRTeg/kmxE0DrWAMh02dcmIKpEKDXL5NNBHkTDL7jFD2U/LcfwYrtl5Mn1anUpazX3hD0ufyq/cbx2VRDsZhisyimzFG1MYsipe3kvXKowH/ewSY2uUq6+wfD+uwh4zgIA+myVgwauhmM8g== 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: 14330c6d-e80e-407d-6d58-08d585f52d6f X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Mar 2018 19:37:21.5640 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR2101MB1076 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 1:22 PM > 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.com; 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 > --- Acked-by: Haiyang Zhang