Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3385701pxb; Mon, 17 Jan 2022 19:16:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJzIPSmnxjoUITJpmfjINDQoYD3iLrxxrKjIt28egOfELym+9FAoAe9JvlYcyQ+stRcFxY4y X-Received: by 2002:a17:90a:6fc2:: with SMTP id e60mr37801054pjk.102.1642475800670; Mon, 17 Jan 2022 19:16:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642475800; cv=none; d=google.com; s=arc-20160816; b=NCq//GnB/XZCDhHSvW9MGQ9n8XZFfZ5BItelgwaEMXr2jqSEbLOk2/rb7U+6g01N6Z IhEDOGthfma7i+HIyZAcn90SW87XgrABPVr48c/TnZJNU08nWWSNmtuegSSxMcGCkTd5 +lr/KcHB2I7POqpo1AgXKOlsYXKZzelxxuGOXMMiYJH+0XbFyqs6bjzkPFKYmKsvNe4R x2e2lq0WgyMhC+GapRGW+huqA6f157kDVp1yjAv4Mn0uTSZjBHD0GxOi1iay0cDyzEHd p5deUS0BsxtDpwxq8s1Do2cwanLL8hEvCts7wXaEggkDH4Cm6WuLPeUlCZ+Nv+WwyJeZ BABA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=s2Spts58YZn+rllmojdfjx579UR0GQubdvTI+rutwz0=; b=beCnF2ymLI1W6NM63WWTV++oFve4z84y27b76+o0WFBz4JSgYixHmrX8PGrvexz03h Q3bRVbhKE8HXBgs6i4pdqAvbh4FclLb1mLY1nKd6iGqj1k1U9b7dqyidMjSWIvnBRY/h NxUAeTmsnfgDY3G/6rcgd2g2gBYhdpiq8XfLU5vpBLCpOZniMNNXJo1t/wHJe92pSXoW Mx35llYrZDI5WKWS3AL/bqPuftFtS8/yFbuV37ubMkXjXm+SrN+MEA5kG3m3r5vtn71Z brjL7j3YgN6echj1E7jItBVYgc/bMMMJSbwbbMrSyV6QsSrZB/t1aWM7o+SL4bpudhAK t/Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ITS7+JPK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j2si14582001pff.311.2022.01.17.19.16.28; Mon, 17 Jan 2022 19:16:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ITS7+JPK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245244AbiARC0k (ORCPT + 99 others); Mon, 17 Jan 2022 21:26:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245237AbiARCXV (ORCPT ); Mon, 17 Jan 2022 21:23:21 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28939C061786; Mon, 17 Jan 2022 18:23:14 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8AAD360ABB; Tue, 18 Jan 2022 02:23:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6724C36AF5; Tue, 18 Jan 2022 02:23:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642472593; bh=y1BrdKWyVxffW81kGbIO98I+Zu2GchAttOjh6y8BlKA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ITS7+JPKDCBJT2zQoNRejnJJns7zEAU5E4jJU4ubrT8zF8PLjUOAbW7NdmlFmnlCo peZPy+9UFlat9Sv/a9CLC8rJTL0kobc7zRCZDN6u6u5Rv8NNQkiT7ymsLmbk9mM7vd AXfVCyXFynXoVbBHfIckqS5ES/wWRqDCjZhUwwbsmpU54Mro6oQ7gZs28paKisYEsQ U0f+htq/cwPq8klQ69WHH7NR5eFmEAJwqcW3nz2aLTBKsSKJ/lkVJOU6h/nY0Cn10e r/IUEeqsPKU4D7wTfwo+KKZ2qVBR0/ySaAOz/BirZq8/+GimQecbyMcF9zAdbXrQvg K5vW69X1lwoKA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Danielle Ratson , Eric Biederman , Ido Schimmel , "David S . Miller" , Sasha Levin , petrm@nvidia.com, kuba@kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.16 063/217] mlxsw: pci: Add shutdown method in PCI driver Date: Mon, 17 Jan 2022 21:17:06 -0500 Message-Id: <20220118021940.1942199-63-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220118021940.1942199-1-sashal@kernel.org> References: <20220118021940.1942199-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Danielle Ratson [ Upstream commit c1020d3cf4752f61a6a413f632ea2ce2370e150d ] On an arm64 platform with the Spectrum ASIC, after loading and executing a new kernel via kexec, the following trace [1] is observed. This seems to be caused by the fact that the device is not properly shutdown before executing the new kernel. Fix this by implementing a shutdown method which mirrors the remove method, as recommended by the kexec maintainer [2][3]. [1] BUG: Bad page state in process devlink pfn:22f73d page:fffffe00089dcf40 refcount:-1 mapcount:0 mapping:0000000000000000 index:0x0 flags: 0x2ffff00000000000() raw: 2ffff00000000000 0000000000000000 ffffffff089d0201 0000000000000000 raw: 0000000000000000 0000000000000000 ffffffffffffffff 0000000000000000 page dumped because: nonzero _refcount Modules linked in: CPU: 1 PID: 16346 Comm: devlink Tainted: G B 5.8.0-rc6-custom-273020-gac6b365b1bf5 #44 Hardware name: Marvell Armada 7040 TX4810M (DT) Call trace: dump_backtrace+0x0/0x1d0 show_stack+0x1c/0x28 dump_stack+0xbc/0x118 bad_page+0xcc/0xf8 check_free_page_bad+0x80/0x88 __free_pages_ok+0x3f8/0x418 __free_pages+0x38/0x60 kmem_freepages+0x200/0x2a8 slab_destroy+0x28/0x68 slabs_destroy+0x60/0x90 ___cache_free+0x1b4/0x358 kfree+0xc0/0x1d0 skb_free_head+0x2c/0x38 skb_release_data+0x110/0x1a0 skb_release_all+0x2c/0x38 consume_skb+0x38/0x130 __dev_kfree_skb_any+0x44/0x50 mlxsw_pci_rdq_fini+0x8c/0xb0 mlxsw_pci_queue_fini.isra.0+0x28/0x58 mlxsw_pci_queue_group_fini+0x58/0x88 mlxsw_pci_aqs_fini+0x2c/0x60 mlxsw_pci_fini+0x34/0x50 mlxsw_core_bus_device_unregister+0x104/0x1d0 mlxsw_devlink_core_bus_device_reload_down+0x2c/0x48 devlink_reload+0x44/0x158 devlink_nl_cmd_reload+0x270/0x290 genl_rcv_msg+0x188/0x2f0 netlink_rcv_skb+0x5c/0x118 genl_rcv+0x3c/0x50 netlink_unicast+0x1bc/0x278 netlink_sendmsg+0x194/0x390 __sys_sendto+0xe0/0x158 __arm64_sys_sendto+0x2c/0x38 el0_svc_common.constprop.0+0x70/0x168 do_el0_svc+0x28/0x88 el0_sync_handler+0x88/0x190 el0_sync+0x140/0x180 [2] https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1195432.html [3] https://patchwork.kernel.org/project/linux-scsi/patch/20170212214920.28866-1-anton@ozlabs.org/#20116693 Cc: Eric Biederman Signed-off-by: Danielle Ratson Signed-off-by: Ido Schimmel Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlxsw/pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c index a15c95a10bae4..cd3331a077bbf 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/pci.c +++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c @@ -1973,6 +1973,7 @@ int mlxsw_pci_driver_register(struct pci_driver *pci_driver) { pci_driver->probe = mlxsw_pci_probe; pci_driver->remove = mlxsw_pci_remove; + pci_driver->shutdown = mlxsw_pci_remove; return pci_register_driver(pci_driver); } EXPORT_SYMBOL(mlxsw_pci_driver_register); -- 2.34.1