[PATCH net-next 0/2] mlxsw: Various updates

STALE1720d

Revision v1 of 3 in this series.

6 messages, 3 authors, 2021-11-23 · open the first message on its own page

[PATCH net-next 0/2] mlxsw: Various updates

From: Ido Schimmel <hidden>
Date: 2021-11-23 07:55:09

From: Ido Schimmel <idosch@nvidia.com>

Patch #1 removes deadcode reported by Coverity.

Patch #2 adds a shutdown method in the PCI driver to ensure the kexeced
kernel starts working with a device that is in a sane state.

Danielle Ratson (2):
  mlxsw: spectrum_router: Remove deadcode in
    mlxsw_sp_rif_mac_profile_find
  mlxsw: pci: Add shutdown method in PCI driver

 drivers/net/ethernet/mellanox/mlxsw/pci.c             | 1 +
 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 3 ---
 2 files changed, 1 insertion(+), 3 deletions(-)

-- 
2.31.1

[PATCH net-next 1/2] mlxsw: spectrum_router: Remove deadcode in mlxsw_sp_rif_mac_profile_find

From: Ido Schimmel <hidden>
Date: 2021-11-23 07:55:10

From: Danielle Ratson <redacted>

The function idr_for_each_entry() already checks that the next entry in
the IDR is not NULL.

Therefore, checking that again in every iteration leads to deadcode.

Remove the unnecessary check in order to avoid that.

Addresses-Coverity: ("Logically dead code")
Signed-off-by: Danielle Ratson <redacted>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 3 ---
 1 file changed, 3 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index 217e3b351dfe..98df6e8fa45f 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -8369,9 +8369,6 @@ mlxsw_sp_rif_mac_profile_find(const struct mlxsw_sp *mlxsw_sp, const char *mac)
 	int id;
 
 	idr_for_each_entry(&router->rif_mac_profiles_idr, profile, id) {
-		if (!profile)
-			continue;
-
 		if (ether_addr_equal_masked(profile->mac_prefix, mac,
 					    mlxsw_sp->mac_mask))
 			return profile;
-- 
2.31.1

[PATCH net-next 2/2] mlxsw: pci: Add shutdown method in PCI driver

From: Ido Schimmel <hidden>
Date: 2021-11-23 07:55:14

From: Danielle Ratson <redacted>

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 <redacted>
Signed-off-by: Danielle Ratson <redacted>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
 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 a15c95a10bae..cd3331a077bb 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.31.1

Re: [PATCH net-next 2/2] mlxsw: pci: Add shutdown method in PCI driver

From: Denis Kirjanov <hidden>
Date: 2021-11-23 08:47:44


11/23/21 10:54 AM, Ido Schimmel пишет:
From: Danielle Ratson <redacted>

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.
This should be sent to net tree instead of net-next with Fixes tag added.
quoted hunk
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 <redacted>
Signed-off-by: Danielle Ratson <redacted>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
  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 a15c95a10bae..cd3331a077bb 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);

Re: [PATCH net-next 2/2] mlxsw: pci: Add shutdown method in PCI driver

From: Ido Schimmel <hidden>
Date: 2021-11-23 09:15:21

On Tue, Nov 23, 2021 at 11:47:34AM +0300, Denis Kirjanov wrote:

11/23/21 10:54 AM, Ido Schimmel пишет:
quoted
From: Danielle Ratson <redacted>

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.
This should be sent to net tree instead of net-next with Fixes tag added.
This is not a regression (never worked) and the system does not crash.
The trace is only observed on a specific platform and only with kexec
which I assume nobody is using but our team (for development purposes).

Therefore, I prefer to route it via net-next. If users complain
(unlikely), I will send backports to stable kernels.

Re: [PATCH net-next 0/2] mlxsw: Various updates

From: patchwork-bot+netdevbpf@kernel.org
Date: 2021-11-23 11:50:17

Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller [off-list ref]:

On Tue, 23 Nov 2021 09:54:45 +0200 you wrote:
From: Ido Schimmel <idosch@nvidia.com>

Patch #1 removes deadcode reported by Coverity.

Patch #2 adds a shutdown method in the PCI driver to ensure the kexeced
kernel starts working with a device that is in a sane state.

[...]
Here is the summary with links:
  - [net-next,1/2] mlxsw: spectrum_router: Remove deadcode in mlxsw_sp_rif_mac_profile_find
    https://git.kernel.org/netdev/net-next/c/ed1607e2ddf4
  - [net-next,2/2] mlxsw: pci: Add shutdown method in PCI driver
    https://git.kernel.org/netdev/net-next/c/c1020d3cf475

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help