mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
fc56be47da
This resolves race during initialization where the resources with
ops are registered before driver and the structures used by occ_get
op is initialized. So keep occ_get callbacks registered only when
all structs are initialized.
The example flows, as it is in mlxsw:
1) driver load/asic probe:
mlxsw_core
-> mlxsw_sp_resources_register
-> mlxsw_sp_kvdl_resources_register
-> devlink_resource_register IDX
mlxsw_spectrum
-> mlxsw_sp_kvdl_init
-> mlxsw_sp_kvdl_parts_init
-> mlxsw_sp_kvdl_part_init
-> devlink_resource_size_get IDX (to get the current setup
size from devlink)
-> devlink_resource_occ_get_register IDX (register current
occupancy getter)
2) reload triggered by devlink command:
-> mlxsw_devlink_core_bus_device_reload
-> mlxsw_sp_fini
-> mlxsw_sp_kvdl_fini
-> devlink_resource_occ_get_unregister IDX
(struct mlxsw_sp *mlxsw_sp is freed at this point, call to occ get
which is using mlxsw_sp would cause use-after free)
-> mlxsw_sp_init
-> mlxsw_sp_kvdl_init
-> mlxsw_sp_kvdl_parts_init
-> mlxsw_sp_kvdl_part_init
-> devlink_resource_size_get IDX (to get the current setup
size from devlink)
-> devlink_resource_occ_get_register IDX (register current
occupancy getter)
Fixes:
|
||
---|---|---|
.. | ||
cmd.h | ||
core_acl_flex_actions.c | ||
core_acl_flex_actions.h | ||
core_acl_flex_keys.c | ||
core_acl_flex_keys.h | ||
core_hwmon.c | ||
core_thermal.c | ||
core.c | ||
core.h | ||
emad.h | ||
i2c.c | ||
i2c.h | ||
ib.h | ||
item.h | ||
Kconfig | ||
Makefile | ||
minimal.c | ||
pci_hw.h | ||
pci.c | ||
pci.h | ||
port.h | ||
reg.h | ||
resources.h | ||
spectrum_acl_flex_actions.c | ||
spectrum_acl_flex_actions.h | ||
spectrum_acl_flex_keys.h | ||
spectrum_acl_tcam.c | ||
spectrum_acl.c | ||
spectrum_buffers.c | ||
spectrum_cnt.c | ||
spectrum_cnt.h | ||
spectrum_dcb.c | ||
spectrum_dpipe.c | ||
spectrum_dpipe.h | ||
spectrum_fid.c | ||
spectrum_flower.c | ||
spectrum_ipip.c | ||
spectrum_ipip.h | ||
spectrum_kvdl.c | ||
spectrum_mr_tcam.c | ||
spectrum_mr_tcam.h | ||
spectrum_mr.c | ||
spectrum_mr.h | ||
spectrum_qdisc.c | ||
spectrum_router.c | ||
spectrum_router.h | ||
spectrum_span.c | ||
spectrum_span.h | ||
spectrum_switchdev.c | ||
spectrum.c | ||
spectrum.h | ||
switchib.c | ||
switchx2.c | ||
trap.h | ||
txheader.h |