d6352dae | 15-May-2023 |
Ido Schimmel <idosch@nvidia.com> |
devlink: Fix crash with CONFIG_NET_NS=n
'__net_initdata' becomes a no-op with CONFIG_NET_NS=y, but when this option is disabled it becomes '__initdata', which means the data can be freed after the i
devlink: Fix crash with CONFIG_NET_NS=n
'__net_initdata' becomes a no-op with CONFIG_NET_NS=y, but when this option is disabled it becomes '__initdata', which means the data can be freed after the initialization phase. This annotation is obviously incorrect for the devlink net device notifier block which is still registered after the initialization phase [1].
Fix this crash by removing the '__net_initdata' annotation.
[1] general protection fault, probably for non-canonical address 0xcccccccccccccccc: 0000 [#1] PREEMPT SMP CPU: 3 PID: 117 Comm: (udev-worker) Not tainted 6.4.0-rc1-custom-gdf0acdc59b09 #64 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-1.fc37 04/01/2014 RIP: 0010:notifier_call_chain+0x58/0xc0 [...] Call Trace: <TASK> dev_set_mac_address+0x85/0x120 dev_set_mac_address_user+0x30/0x50 do_setlink+0x219/0x1270 rtnl_setlink+0xf7/0x1a0 rtnetlink_rcv_msg+0x142/0x390 netlink_rcv_skb+0x58/0x100 netlink_unicast+0x188/0x270 netlink_sendmsg+0x214/0x470 __sys_sendto+0x12f/0x1a0 __x64_sys_sendto+0x24/0x30 do_syscall_64+0x38/0x80 entry_SYSCALL_64_after_hwframe+0x63/0xcd
Fixes: e93c9378e33f ("devlink: change per-devlink netdev notifier to static one") Reported-by: Marek Szyprowski <m.szyprowski@samsung.com> Closes: https://lore.kernel.org/netdev/600ddf9e-589a-2aa0-7b69-a438f833ca10@samsung.com/ Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Link: https://lore.kernel.org/r/20230515162925.1144416-1-idosch@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
12af29e7 | 14-Feb-2023 |
Moshe Shemesh <moshe@nvidia.com> |
devlink: Move health common function to health file
Now that all devlink health callbacks and related code are in file health.c move common health functions and devlink_health_reporter struct to be
devlink: Move health common function to health file
Now that all devlink health callbacks and related code are in file health.c move common health functions and devlink_health_reporter struct to be local in health.c file.
Signed-off-by: Moshe Shemesh <moshe@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
c9311ee1 | 14-Feb-2023 |
Moshe Shemesh <moshe@nvidia.com> |
devlink: Move devlink health test to health file
Move devlink health report test callback from leftover.c to health.c. No functional change in this patch.
Signed-off-by: Moshe Shemesh <moshe@nvidia
devlink: Move devlink health test to health file
Move devlink health report test callback from leftover.c to health.c. No functional change in this patch.
Signed-off-by: Moshe Shemesh <moshe@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
7004c6c4 | 14-Feb-2023 |
Moshe Shemesh <moshe@nvidia.com> |
devlink: Move devlink health dump to health file
Move devlink health report dump callbacks and related code from leftover.c to health.c. No functional change in this patch.
Signed-off-by: Moshe She
devlink: Move devlink health dump to health file
Move devlink health report dump callbacks and related code from leftover.c to health.c. No functional change in this patch.
Signed-off-by: Moshe Shemesh <moshe@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
a929df7f | 14-Feb-2023 |
Moshe Shemesh <moshe@nvidia.com> |
devlink: Move devlink fmsg and health diagnose to health file
Devlink fmsg (formatted message) is used by devlink health diagnose, dump and drivers which support these devlink health callbacks. Ther
devlink: Move devlink fmsg and health diagnose to health file
Devlink fmsg (formatted message) is used by devlink health diagnose, dump and drivers which support these devlink health callbacks. Therefore, move devlink fmsg helpers and related code to file health.c. Move devlink health diagnose to file health.c. No functional change in this patch.
Signed-off-by: Moshe Shemesh <moshe@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
55b9b249 | 14-Feb-2023 |
Moshe Shemesh <moshe@nvidia.com> |
devlink: Move devlink health report and recover to health file
Move devlink health report helper and recover callback and related code from leftover.c to health.c. No functional change in this patch
devlink: Move devlink health report and recover to health file
Move devlink health report helper and recover callback and related code from leftover.c to health.c. No functional change in this patch.
Signed-off-by: Moshe Shemesh <moshe@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
db6b5f3e | 14-Feb-2023 |
Moshe Shemesh <moshe@nvidia.com> |
devlink: Move devlink health get and set code to health file
Move devlink health get and set callbacks and related code from leftover.c to health.c. No functional change in this patch.
Signed-off-b
devlink: Move devlink health get and set code to health file
Move devlink health get and set callbacks and related code from leftover.c to health.c. No functional change in this patch.
Signed-off-by: Moshe Shemesh <moshe@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
bfd4e6a5 | 14-Feb-2023 |
Moshe Shemesh <moshe@nvidia.com> |
devlink: health: Fix nla_nest_end in error flow
devlink_nl_health_reporter_fill() error flow calls nla_nest_end(). Fix it to call nla_nest_cancel() instead.
Note the bug is harmless as genlmsg_canc
devlink: health: Fix nla_nest_end in error flow
devlink_nl_health_reporter_fill() error flow calls nla_nest_end(). Fix it to call nla_nest_cancel() instead.
Note the bug is harmless as genlmsg_cancel() cancel the entire message, so no fixes tag added.
Signed-off-by: Moshe Shemesh <moshe@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
6b4bfa43 | 10-Feb-2023 |
Jiri Pirko <jiri@nvidia.com> |
devlink: add forgotten devlink instance lock assertion to devl_param_driverinit_value_set()
Driver calling devl_param_driverinit_value_set() has to hold devlink instance lock while doing that. Put a
devlink: add forgotten devlink instance lock assertion to devl_param_driverinit_value_set()
Driver calling devl_param_driverinit_value_set() has to hold devlink instance lock while doing that. Put an assertion there.
Signed-off-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Acked-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
280f7b2a | 10-Feb-2023 |
Jiri Pirko <jiri@nvidia.com> |
devlink: allow to call devl_param_driverinit_value_get() without holding instance lock
If the driver maintains following basic sane behavior, the devl_param_driverinit_value_get() function could be
devlink: allow to call devl_param_driverinit_value_get() without holding instance lock
If the driver maintains following basic sane behavior, the devl_param_driverinit_value_get() function could be called without holding instance lock:
1) Driver ensures a call to devl_param_driverinit_value_get() cannot race with registering/unregistering the parameter with the same parameter ID. 2) Driver ensures a call to devl_param_driverinit_value_get() cannot race with devl_param_driverinit_value_set() call with the same parameter ID. 3) Driver ensures a call to devl_param_driverinit_value_get() cannot race with reload operation.
By the nature of params usage, these requirements should be trivially achievable. If the driver for some off reason is not able to comply, it has to take the devlink->lock while calling devl_param_driverinit_value_get().
Remove the lock assertion and add comment describing the locking requirements.
This fixes a splat in mlx5 driver introduced by the commit referenced in the "Fixes" tag.
Lore: https://lore.kernel.org/netdev/719de4f0-76ac-e8b9-38a9-167ae239efc7@amd.com/ Reported-by: Kim Phillips <kim.phillips@amd.com> Fixes: 075935f0ae0f ("devlink: protect devlink param list by instance lock") Signed-off-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Acked-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Kim Phillips <kim.phillips@amd.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
a72e17b4 | 10-Feb-2023 |
Jiri Pirko <jiri@nvidia.com> |
devlink: convert param list to xarray
Loose the linked list for params and use xarray instead.
Note that this is required to be eventually possible to call devl_param_driverinit_value_get() without
devlink: convert param list to xarray
Loose the linked list for params and use xarray instead.
Note that this is required to be eventually possible to call devl_param_driverinit_value_get() without holding instance lock.
Signed-off-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Acked-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
fbcf9381 | 10-Feb-2023 |
Jiri Pirko <jiri@nvidia.com> |
devlink: use xa_for_each_start() helper in devlink_nl_cmd_port_get_dump_one()
As xarray has an iterator helper that allows to start from specified index, use this directly and avoid repeated iterati
devlink: use xa_for_each_start() helper in devlink_nl_cmd_port_get_dump_one()
As xarray has an iterator helper that allows to start from specified index, use this directly and avoid repeated iteration from 0.
Signed-off-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Acked-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
94ba1c31 | 10-Feb-2023 |
Jiri Pirko <jiri@nvidia.com> |
devlink: fix the name of value arg of devl_param_driverinit_value_get()
Probably due to copy-paste error, the name of the arg is "init_val" which is misleading, as the pointer is used to point to st
devlink: fix the name of value arg of devl_param_driverinit_value_get()
Probably due to copy-paste error, the name of the arg is "init_val" which is misleading, as the pointer is used to point to struct where to store the current value. Rename it to "val" and change the arg comment a bit on the way.
Signed-off-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Acked-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
afd888c3 | 10-Feb-2023 |
Jiri Pirko <jiri@nvidia.com> |
devlink: make sure driver does not read updated driverinit param before reload
The driverinit param purpose is to serve the driver during init/reload time to provide a value, either default or set b
devlink: make sure driver does not read updated driverinit param before reload
The driverinit param purpose is to serve the driver during init/reload time to provide a value, either default or set by user.
Make sure that driver does not read value updated by user before the reload is performed. Hold the new value in a separate struct and switch it during reload.
Note that this is required to be eventually possible to call devl_param_driverinit_value_get() without holding instance lock.
Signed-off-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
fa2f921f | 10-Feb-2023 |
Jiri Pirko <jiri@nvidia.com> |
devlink: don't use strcpy() to copy param value
No need to treat string params any different comparing to other types. Rely on the struct assign to copy the whole struct, including the string.
Sign
devlink: don't use strcpy() to copy param value
No need to treat string params any different comparing to other types. Rely on the struct assign to copy the whole struct, including the string.
Signed-off-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Acked-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
7c976c7c | 02-Feb-2023 |
Moshe Shemesh <moshe@nvidia.com> |
devlink: Move devlink dev selftest code to dev
Move devlink dev selftest callbacks and related code from leftover.c to file dev.c. No functional change in this patch.
Signed-off-by: Moshe Shemesh <
devlink: Move devlink dev selftest code to dev
Move devlink dev selftest callbacks and related code from leftover.c to file dev.c. No functional change in this patch.
Signed-off-by: Moshe Shemesh <moshe@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
ec4a0ce9 | 02-Feb-2023 |
Moshe Shemesh <moshe@nvidia.com> |
devlink: Move devlink_info_req struct to be local
As all users of the struct devlink_info_req are already in dev.c, move this struct from devl_internal.c to be local in dev.c.
Signed-off-by: Moshe
devlink: Move devlink_info_req struct to be local
As all users of the struct devlink_info_req are already in dev.c, move this struct from devl_internal.c to be local in dev.c.
Signed-off-by: Moshe Shemesh <moshe@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|