Received: by 10.223.185.111 with SMTP id b44csp682428wrg; Fri, 9 Mar 2018 11:40:33 -0800 (PST) X-Google-Smtp-Source: AG47ELv10S/om4ax0ROpkbNzPaaZwcgQseiMrXNFEExl4KeVmR0pN+40PIdGoyzOtX8oJzq3MRjt X-Received: by 2002:a17:902:6bcc:: with SMTP id m12-v6mr4171650plt.101.1520624433078; Fri, 09 Mar 2018 11:40:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520624433; cv=none; d=google.com; s=arc-20160816; b=I9crUS7uHF7Y0W0rNuyVBgKf+dL9lnxw2FDeIDz/SdM5ccBJVl+BY73H13FICm7JYr wyJZtbHlg+g1J+ixmSgk5tilvUEdySgn8olVo4evL3080L4sobJRPH8hBI2Qo0rgeKt5 ey3Z8LAV/SesUGiEAg9NTC484UOxQ8TbkgxtS6/nlA6VikcN05FR/3KnheneN3Ciw/2d weqr5U2VEkSKKwGf/mMW+s9Uukz2qFzDpvt8nispAdQaSuK1d1dGhgKJ2OFP7vERw2Yx SgHIQR7uQtujhPHO8mW9DL5imT2qxCUN3n53EqfcMQcwf8gHR20iJoE9NfvYil+4A7a0 Eomg== 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=lFOkuuSwSev34+VIOEriT4NY3Eq9afJ+4dNk70Yhl7U=; b=pcVSrLwb24pN9EUjf6YmSvCvRj2HVrMBaChcxL2ZM6LtTWa4B/TLFugHjOnwBqwguG 7st2ZCd0n/BFL+VqKEeQu4UGljSbhRty4dIzsvM1ZgLz4BO8k0VtXf/K2LaQFiv7iqj+ 8pLFpDSi/E1iLrgppgHqcOtX8pUjhO6IwAFKH1XiNJe2TWufU4p6E5dam/VfIOI4EZhX gvkyUx33/ZvdjirleOw8FawwvIa7ZSYazWvmdDkSZD6bKOgxsJ//09PN3E/7HDml4iJS JQ/Lz/Vr1TJysgp8LTYBShMtJGXZWdj/mgD3jBcuJ+LbM6q6o7tgAHBMiDiEWnrFEDYe Efcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=HQEbm6dA; 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 1-v6si1332025plk.52.2018.03.09.11.40.18; Fri, 09 Mar 2018 11:40:33 -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=HQEbm6dA; 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 S932736AbeCITjF (ORCPT + 99 others); Fri, 9 Mar 2018 14:39:05 -0500 Received: from mail-bn3nam01on0093.outbound.protection.outlook.com ([104.47.33.93]:38750 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932677AbeCITie (ORCPT ); Fri, 9 Mar 2018 14:38:34 -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=lFOkuuSwSev34+VIOEriT4NY3Eq9afJ+4dNk70Yhl7U=; b=HQEbm6dAUTq5bPbV3PWhqPsDZXH8HuVS9iqCAo9heftH9m7ixf8wKjZWPKa/WaRMQzKfOZQuiJX1MceFO4cNszqO7kdhFC44FqwStirSkV78JZfqFKTf75yPgF/jz2rt1R/HGTvcWdBhNYFpT2VXx/Op2IEcc/TdqoDTTjueaEQ= Received: from BL0PR2101MB1108.namprd21.prod.outlook.com (52.132.24.31) by BL0PR2101MB1107.namprd21.prod.outlook.com (52.132.24.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.588.3; Fri, 9 Mar 2018 19:38:31 +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:38:31 +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)" , "stable@vger.kernel.org" , Jack Morgenstein Subject: RE: [PATCH v3 6/6] PCI: hv: fix 2 hang issues in hv_compose_msi_msg() Thread-Topic: [PATCH v3 6/6] PCI: hv: fix 2 hang issues in hv_compose_msi_msg() Thread-Index: AQHTtXgE9Y8Q5y/qWkesxFgPUzhEwqPIUVAA Date: Fri, 9 Mar 2018 19:38:10 +0000 Message-ID: References: <20180306182128.23281-1-decui@microsoft.com> <20180306182128.23281-7-decui@microsoft.com> In-Reply-To: <20180306182128.23281-7-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:38:09.3494967Z; 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;BL0PR2101MB1107;7:aC22TbmsBEumpJs2+oOv49/Ne17Hld28OWgGi7itQ1NHgQ6gmjw7/SXzzF5YWynGDZ6sKw01WL+q0k1nncCMGGNLndMNPcvt1J2BVonS4YMtajdPq/5DzcRdXy7PHIK7SzQisWdu1as7++JA738f7uHEYF2AqK5fFkxZy6bpfcR+mFypuRKGNLPkvXXxf5UM2j7elELDnqXhxOYg1yZgmj5XAb7BX00dvv5teqVzicpAQl4vHwWjdp1S3ifvT3JF;20:75AD4Lw7rp/VIivV9SKKPt2nEF1OmeeAzqHhTRyq9KLs0NNhfqaDBwoAqwZECnMLKbnNo5SQaU62xVW5NCkGd6XTumBsQA/UVf8F/3VhubisqvQeF+XqMGNk+MJKmxT+GnyZxYLsOshTlzG5JJ9iE+jkDE0Skwvv1uOrO2p2swc= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 2a9f518b-49e1-4b6b-09f1-08d585f556d2 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(2017052603328)(7193020);SRVR:BL0PR2101MB1107; x-ms-traffictypediagnostic: BL0PR2101MB1107: 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)(3002001)(93006095)(93001095)(3231220)(944501255)(52105095)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011);SRVR:BL0PR2101MB1107;BCL:0;PCL:0;RULEID:;SRVR:BL0PR2101MB1107; x-forefront-prvs: 0606BBEB39 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(396003)(39380400002)(346002)(376002)(39860400002)(189003)(199004)(13464003)(66066001)(59450400001)(53546011)(26005)(478600001)(6506007)(97736004)(10290500003)(86612001)(2950100002)(76176011)(2201001)(4326008)(86362001)(6246003)(102836004)(1511001)(54906003)(8936002)(6666003)(110136005)(8676002)(316002)(81166006)(81156014)(74316002)(106356001)(33656002)(7736002)(305945005)(2906002)(25786009)(7696005)(5250100002)(2900100001)(3846002)(2501003)(99286004)(6116002)(8990500004)(3660700001)(10090500001)(6436002)(229853002)(53936002)(105586002)(55016002)(7416002)(9686003)(5660300001)(68736007)(22452003)(3280700002)(14454004);DIR:OUT;SFP:1102;SCL:1;SRVR:BL0PR2101MB1107;H:BL0PR2101MB1108.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: yTLoHPtIUiN23EQIEXbZ5fLQe3f4KoQMPw/I9yzx9bf5hcTUPX997TaF3bJcwSQlkaet8ffCoMTbfEOkIImj2c7NIB7Wfi2p1eK+FsvUJbuRVn0v6AKRfJHHPQElUFP7c6cw1FoMHU05M0Sk6nHfIt2y9QR+Xft8KXSqliwMJz3du/uiwj2FHnBFIeEQLRudu+nf0SJtKh/jXokqjXyB9NQBnbuiActuOE2GJ1esNswpepCZK0WralTbRyDc4RlrEnRRaKzFrXVX9GJS5Uc+K3lqy9frCUzDIOjox2ZeCDPxIlvG4Mv2Fc4Ox5QvbapTs9CFBMTW/LB7hWTSnw0NYw== 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: 2a9f518b-49e1-4b6b-09f1-08d585f556d2 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Mar 2018 19:38:10.4274 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR2101MB1107 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 ; > stable@vger.kernel.org; Jack Morgenstein > Subject: [PATCH v3 6/6] PCI: hv: fix 2 hang issues in hv_compose_msi_msg(= ) >=20 > 1. With the patch "x86/vector/msi: Switch to global reservation mode" > (4900be8360), the recent v4.15 and newer kernels always hang for 1-vCPU > Hyper-V VM with SR-IOV. This is because when we reach > hv_compose_msi_msg() by request_irq() -> request_threaded_irq() -> > __setup_irq()->irq_startup() -> __irq_startup() -> irq_domain_activate_i= rq() - > > ... -> > msi_domain_activate() -> ... -> hv_compose_msi_msg(), local irq is disabl= ed in > __setup_irq(). >=20 > Fix this by polling the channel. >=20 > 2. If the host is ejecting the VF device before we reach hv_compose_msi_m= sg(), > in a UP VM, we can hang in hv_compose_msi_msg() forever, because at this > time the host doesn't respond to the CREATE_INTERRUPT request. This issue > also happens to old kernels like v4.14, v4.13, etc. >=20 > Fix this by polling the channel for the PCI_EJECT message and > hpdev->state, and by checking the PCI vendor ID. >=20 > Note: actually the above issues also happen to a SMP VM, if "hbus->hdev- > >channel->target_cpu =3D=3D smp_processor_id()" is true. >=20 > Signed-off-by: Dexuan Cui > Tested-by: Adrian Suhov > Tested-by: Chris Valean > Cc: stable@vger.kernel.org > Cc: Stephen Hemminger > Cc: K. Y. Srinivasan > Cc: Vitaly Kuznetsov > Cc: Jack Morgenstein > --- Acked-by: Haiyang Zhang