Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp5754251imm; Sat, 19 May 2018 08:56:30 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp+BtVnGmstn/qH8+dEeSzmG9dKXQ4dZtprS9hQ4BYle5KhfBPHDQFjpNSbV2yAEp4SOK8r X-Received: by 2002:a63:7341:: with SMTP id d1-v6mr10699446pgn.404.1526745390842; Sat, 19 May 2018 08:56:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526745390; cv=none; d=google.com; s=arc-20160816; b=jODPwlH774P8QJm500rulp9tTY30wxgpZDl23ROAJhrFARFS6/u+SckQFDWkZfpxKA M0JK08HCORLBhUafVBJRt1hFNRf3TOlbVLgal4LyO7Wus/IPykq0Li/8/O6WLzuqDoe0 wQI7jNDZQLDL3cPYA9X9xnLSQWJwDZcjXEsAWDDcq53AMqHuVTG79baFXq4EBSBlwijT ICwAMwbvIlcVHE85mZu6lBpxym+YSNKI1c6M8WPFGOMqx7VQ5boMsRyxKIxsm0TJoz44 pOMdBOWQ/nz7yF/Ch0C/RZOvptRsP+YUOSQpq9sZs+4eTAjCSyRU49ePKWECfZMr9tVE boyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=sKQrlraOg0D2qQPS38SXuAK3xMcYo64dWkLFbgEKUHo=; b=No5T0pmqGWGGnhyJxlTirvFXV5G5xRKgeUvx7iVCPz6UF3xZBF2KERoRIU7aTbgU47 L02NiZZYqSFic9/3PjexaYZUUcKiq/N+ifNGEXQ+Q17Gsy+ekvhuB1d78voACu4q92fa iH5y5w4EqmBjCuLtvrff112DAR3rgCouyS4cedavOhphVYDSEmJ90KFU5gt+54G0VFzA S788xjxGsSQgLYhtXg+lilHTRltlsZDjKmD04GnlKICOdqpi+LwQhU0YoxJoFClX8/dA SHNRPfnykfsWf5NZiLAwQWploQKFMhItMvvka9Te+igHoqkq2dBEeznz7CcenXI2Usl/ ehLQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v29-v6si8048088pgn.510.2018.05.19.08.56.16; Sat, 19 May 2018 08:56:30 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752713AbeESPzm (ORCPT + 99 others); Sat, 19 May 2018 11:55:42 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:8125 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752612AbeESPy6 (ORCPT ); Sat, 19 May 2018 11:54:58 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 5B8249DD689BD; Sat, 19 May 2018 23:54:43 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.227.234) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.382.0; Sat, 19 May 2018 23:54:37 +0800 From: Salil Mehta To: CC: , , , , , , , Xi Wang Subject: [PATCH net-next 8/9] net: hns3: Fixes kernel panic issue during rmmod hns3 driver Date: Sat, 19 May 2018 16:53:22 +0100 Message-ID: <20180519155323.68960-9-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180519155323.68960-1-salil.mehta@huawei.com> References: <20180519155323.68960-1-salil.mehta@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.202.227.234] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xi Wang If CONFIG_ARM_SMMU_V3 is enabled, arm64's dma_ops will replace arm64_swiotlb_dma_ops with iommu_dma_ops. When releasing contiguous dma memory, the new ops will call the vunmap function which cannot be run in interrupt context. Currently, spin_lock_bh is called before vunmap is executed. This disables BH and causes the interrupt context to be detected to generate a kernel panic like below: [ 2831.573400] kernel BUG at mm/vmalloc.c:1621! [ 2831.577659] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ... [ 2831.699907] Process rmmod (pid: 1893, stack limit = 0x0000000055103ee2) [ 2831.706507] Call trace: [ 2831.708941] vunmap+0x48/0x50 [ 2831.711897] dma_common_free_remap+0x78/0x88 [ 2831.716155] __iommu_free_attrs+0xa8/0x1c0 [ 2831.720255] hclge_free_cmd_desc+0xc8/0x118 [hclge] [ 2831.725128] hclge_destroy_cmd_queue+0x34/0x68 [hclge] [ 2831.730261] hclge_uninit_ae_dev+0x90/0x100 [hclge] [ 2831.735127] hnae3_unregister_ae_dev+0xb0/0x868 [hnae3] [ 2831.740345] hns3_remove+0x3c/0x90 [hns3] [ 2831.744344] pci_device_remove+0x48/0x108 [ 2831.748342] device_release_driver_internal+0x164/0x200 [ 2831.753553] driver_detach+0x4c/0x88 [ 2831.757116] bus_remove_driver+0x60/0xc0 [ 2831.761026] driver_unregister+0x34/0x60 [ 2831.764935] pci_unregister_driver+0x30/0xb0 [ 2831.769197] hns3_exit_module+0x10/0x978 [hns3] [ 2831.773715] SyS_delete_module+0x1f8/0x248 [ 2831.777799] el0_svc_naked+0x30/0x34 This patch fixes it by using spin_lock instead of spin_lock_bh. Fixes: 68c0a5c70614 ("net: hns3: Add HNS3 IMP(Integrated Mgmt Proc) Cmd Interface Support") Signed-off-by: Xi Wang Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c index 59fb0eb..c36d647 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c @@ -385,9 +385,9 @@ int hclge_cmd_init(struct hclge_dev *hdev) static void hclge_destroy_queue(struct hclge_cmq_ring *ring) { - spin_lock_bh(&ring->lock); + spin_lock(&ring->lock); hclge_free_cmd_desc(ring); - spin_unlock_bh(&ring->lock); + spin_unlock(&ring->lock); } void hclge_destroy_cmd_queue(struct hclge_hw *hw) -- 2.7.4