Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp215046imm; Tue, 22 May 2018 17:19:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr0fHN7NiULTBAiw1xaieEj7ykTs4zt+ljiPN0NjSuY4Ny1booeouijoUsye3KAObwXBwSX X-Received: by 2002:a17:902:8d8d:: with SMTP id v13-v6mr609147plo.362.1527034771303; Tue, 22 May 2018 17:19:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527034771; cv=none; d=google.com; s=arc-20160816; b=Id06np8kcl9zLvg3X9dYkVw7Hh73FNtPOoFijdSjWS6KYMtYEar+ls2W97UdPMrHiB eP6N24+Jfila4GpvDNkIumnr2EYr7Kg99CbVpP+rpaz5TVLn8xk3BcLOgnWgX7dPwZUp WeeUCX3ObuVcz+fMoS1mccqMQ0D1Hdk9lGMSupTkETMA5QvWt6gr9r+QjKp25M5LV46H yU4gO4Y7FI6mzfyv2lOlKQ/jdugkE91sxyBeFbj7v0ZMaEYbKoxXwGrjVy386yIXhSlj 43Sm628oQBrWDkHm4wpNzzPSWVWEJsl5ODNoJ2KEKQPPtd9bUla8LbztdbUqiqHxU9dm tLFg== 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:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=3Tpa/Sq6qLzfXRxRVKSzX3yuiKZQE5mN3njFQHiTwSU=; b=L00Rzffbzqkxe87ywykWG602J8fFB6yLrrXNBQM9BeosLav4PxT4HqsVtF0Bx26M/x jFBAB8quvdC8W40A15NFo+qao3TNlZl3LKSze760H3l0OedsLivo1t0pLJD3i/TEP7DS ozirrUW3PLShqmWHbw6Z/zCvQjYETj5VkvuwvXBeMw1guFNM6B7FDNHx94TT91wFoomz 05aDbbKnZ+05ijwS9QeCdAC0cGfplH6WsMUMD1eXSkQDnMKte73kyMYo00wSPCnKZKBP c6t3SXB80XpXkFoDxkuOKBVk0wbOl0mUQnK1sX2ySGMg+CfcbzUqtRHgD0yeEjXKvkpw srSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Br/8bhwA; 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 d14-v6si17589805plj.32.2018.05.22.17.19.17; Tue, 22 May 2018 17:19:31 -0700 (PDT) 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=Br/8bhwA; 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 S1753599AbeEWASk (ORCPT + 99 others); Tue, 22 May 2018 20:18:40 -0400 Received: from mail-pu1apc01on0136.outbound.protection.outlook.com ([104.47.126.136]:15536 "EHLO APC01-PU1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753586AbeEWASi (ORCPT ); Tue, 22 May 2018 20:18:38 -0400 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:X-MS-Exchange-SenderADCheck; bh=3Tpa/Sq6qLzfXRxRVKSzX3yuiKZQE5mN3njFQHiTwSU=; b=Br/8bhwAA5POgXhkZD3IsTsVKh7JkXZk3gh+eC7HXoXS9aejp6TrFs4ecHsmlLixp0P2QhhvYvkldqIrm3JNgraslXVd2sbQGdHMu+DblhAsP7b7aWLeh6cnHkYSHh+ETj2BiRJEO+7KdPFHUUZTk3vy8qqNF3nDWc9r5R5kB+U= Received: from KL1P15301MB0006.APCP153.PROD.OUTLOOK.COM (10.170.167.17) by KL1P15301MB0040.APCP153.PROD.OUTLOOK.COM (10.170.168.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.820.2; Wed, 23 May 2018 00:18:21 +0000 Received: from KL1P15301MB0006.APCP153.PROD.OUTLOOK.COM ([10.170.167.17]) by KL1P15301MB0006.APCP153.PROD.OUTLOOK.COM ([10.170.167.17]) with mapi id 15.20.0820.001; Wed, 23 May 2018 00:18:21 +0000 From: Dexuan Cui To: Lorenzo Pieralisi , Bjorn Helgaas , "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" Subject: [PATCH] PCI: hv: Fix a __local_bh_enable_ip warning in hv_compose_msi_msg() Thread-Topic: [PATCH] PCI: hv: Fix a __local_bh_enable_ip warning in hv_compose_msi_msg() Thread-Index: AdPyKucLHxE0xn3+RTSKXedSJeHHcg== Date: Wed, 23 May 2018 00:18:20 +0000 Message-ID: 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=decui@microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2018-05-23T00:18:18.8931354Z; 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: [2001:4898:80e8:8:5df6:5a7b:7ee7:e115] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;KL1P15301MB0040;7:aKCsiOyaGACIdnbVMDDjvqS+75osiU1dVp1JuMLJSGKBbxFmWJ2YRyOVawVHDwEJADuqPe1Db3+a1+rMHruczJ/I4Lo8YK/xRmypFXrOTYVAVhMvlRaIWFMysDzpXB1WWUqGYJctHfltc+mRID0mNCPLXIrqAqSY+OzCjVnUKklUyrC0ugBa14gUK2FuaKjBldoem6RxSO2gvvlTo/yylW6Ybl6oSxIXxrSoUdxmvG9b3v4MLNXFZuokH3o6OHXu;20:sXnsl7eqT8/8oy1mcD8RwQnzUHAXjOayQhaygswhbVWTKTj547+T/qXldewMARCRKCvhGV4yVRYhmtDeXobx25KX82gV7Kotlyp4ob2G4pVulvyGLvmeOVHSo83c9OKCwagmZWjhgr8ymxgGvrTp4BsLNrIYvsuMDjiTu/Nl7YE= x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:KL1P15301MB0040; x-ms-traffictypediagnostic: KL1P15301MB0040: authentication-results: spf=none (sender IP is ) smtp.mailfrom=decui@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(9452136761055); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(3231254)(944501410)(52105095)(10201501046)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(6072148)(201708071742011)(7699016);SRVR:KL1P15301MB0040;BCL:0;PCL:0;RULEID:;SRVR:KL1P15301MB0040; x-forefront-prvs: 06818431B9 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(396003)(366004)(39860400002)(376002)(346002)(199004)(189003)(8990500004)(6116002)(8676002)(81166006)(3660700001)(81156014)(106356001)(105586002)(110136005)(6436002)(9686003)(53936002)(54906003)(102836004)(2201001)(486006)(476003)(2501003)(86612001)(86362001)(575784001)(1857600001)(97736004)(8936002)(186003)(10090500001)(46003)(77096007)(1511001)(68736007)(7696005)(478600001)(10290500003)(33656002)(59450400001)(6506007)(99286004)(4326008)(7416002)(25786009)(74316002)(305945005)(7736002)(2900100001)(14454004)(3280700002)(316002)(2906002)(55016002)(5660300001)(22452003);DIR:OUT;SFP:1102;SCL:1;SRVR:KL1P15301MB0040;H:KL1P15301MB0006.APCP153.PROD.OUTLOOK.COM;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: IRu+CKHRiurG1AidSSoFy5sV4cWabnIkKxdsvgTMu4uPuu2aceIHwWM5qxx9AEmQdycOrwCcrbJ9liMqZui3NyQa3VxNz7f2eJ1MrWcGYDrronX97QbChHtx27rPcqIFjOIkCThkhN2UJE1RXX4xRWnKBMn2ERDdEifwRj/oeC6wQI9gXRdWJ7j8QoRU0kQo spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 4c35535f-548e-4252-a2ac-08d5c042b0fb X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c35535f-548e-4252-a2ac-08d5c042b0fb X-MS-Exchange-CrossTenant-originalarrivaltime: 23 May 2018 00:18:20.8295 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1P15301MB0040 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit de0aa7b2f97d ("PCI: hv: Fix 2 hang issues in hv_compose_msi_msg()") uses local_bh_disable()/enable(), because hv_pci_onchannelcallback() can also run in tasklet context as the channel event callback. With CONFIG_PROVE_LOCKING=3Dy in the latest mainline, or old kernels that don't have commit f71b74bca637 ("irq/softirqs: Use lockdep to assert IRQs are disabled/enabled"), it turns out can we trigger a warnin= g at the beginning of __local_bh_enable_ip(), because the upper layer irq code can call hv_compose_msi_msg() with local irqs disabled. Let's fix the warning by switching to local_irq_save()/restore(). This is not an issue because hv_pci_onchannelcallback() is not slow, and it not a hot path. Fixes: de0aa7b2f97d ("PCI: hv: Fix 2 hang issues in hv_compose_msi_msg()") Signed-off-by: Dexuan Cui Cc: Cc: Stephen Hemminger Cc: K. Y. Srinivasan --- A trimmed version of the warning is: IRQs not enabled as expected WARNING: CPU: 0 PID: 408 at kernel/softirq.c:162 __local_bh_enable_ip+0xb= 0/0xe0 Call Trace: hv_compose_msi_msg+0x209/0x462 [pci_hyperv] irq_chip_compose_msi_msg+0x41/0x50 msi_domain_activate+0x1a/0x40 __irq_domain_activate_irq+0x59/0x90 irq_domain_activate_irq+0x25/0x40 __setup_irq+0x3ec/0x730 request_threaded_irq+0xfa/0x1a0 mlx4_init_eq_table+0x3c3/0x5f0 [mlx4_core] mlx4_setup_hca+0x1db/0x750 [mlx4_core] mlx4_load_one+0xad2/0x13b0 [mlx4_core] mlx4_init_one+0x578/0x710 [mlx4_core] local_pci_probe+0x1e/0x50 work_for_cpu_fn+0x10/0x20 process_one_work+0x1d4/0x5a0 worker_thread+0x1cb/0x3d0 kthread+0xf5/0x130 drivers/pci/host/pci-hyperv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c index 50cdefe..ad6a64d 100644 --- a/drivers/pci/host/pci-hyperv.c +++ b/drivers/pci/host/pci-hyperv.c @@ -1051,6 +1051,7 @@ static u32 hv_compose_msi_req_v2( */ static void hv_compose_msi_msg(struct irq_data *data, struct msi_msg *msg) { + unsigned long flags; struct irq_cfg *cfg =3D irqd_cfg(data); struct hv_pcibus_device *hbus; struct hv_pci_dev *hpdev; @@ -1148,14 +1149,14 @@ static void hv_compose_msi_msg(struct irq_data *dat= a, struct msi_msg *msg) * the channel callback directly when channel->target_cpu is * the current CPU. When the higher level interrupt code * calls us with interrupt enabled, let's add the - * local_bh_disable()/enable() to avoid race. + * local_irq_save()/restore() to avoid race. */ - local_bh_disable(); + local_irq_save(flags); =20 if (hbus->hdev->channel->target_cpu =3D=3D smp_processor_id()) hv_pci_onchannelcallback(hbus); =20 - local_bh_enable(); + local_irq_restore(flags); =20 if (hpdev->state =3D=3D hv_pcichild_ejecting) { dev_err_once(&hbus->hdev->device, --=20 2.7.4