From patchwork Wed May 23 00:18:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dexuan Cui X-Patchwork-Id: 918627 X-Patchwork-Delegate: lorenzo.pieralisi@arm.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=reject dis=none) header.from=microsoft.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=microsoft.com header.i=@microsoft.com header.b="Br/8bhwA"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40rCmX5WZYz9s1b for ; Wed, 23 May 2018 10:18:52 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753582AbeEWASk (ORCPT ); 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 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-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@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=y 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 warning 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 Reviewed-by: Haiyang Zhang --- 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+0xb0/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 = 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 *data, 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); if (hbus->hdev->channel->target_cpu == smp_processor_id()) hv_pci_onchannelcallback(hbus); - local_bh_enable(); + local_irq_restore(flags); if (hpdev->state == hv_pcichild_ejecting) { dev_err_once(&hbus->hdev->device,