]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix race between driver unload and dumping firmware in mlx5core.
authorhselasky <hselasky@FreeBSD.org>
Wed, 8 May 2019 11:08:48 +0000 (11:08 +0000)
committerhselasky <hselasky@FreeBSD.org>
Wed, 8 May 2019 11:08:48 +0000 (11:08 +0000)
commitd6f19b4f0f81650c052fdc595857d3e8dcbd699e
tree7dd1305677464a7f00ad3c73a8d80101d0a4b74a
parentb67f93bdbeed934a41051f89054e287e5b428000
Fix race between driver unload and dumping firmware in mlx5core.

Present code uses lock-less accesses to the dump data to prevent top
level ioctls from blocking bottom-level call to dump.  Unfortunately, this
depends on the type stability of the dump data structure, which makes it
non-functional during driver teardown.

Switch to the mutex locking scheme where top levels use the mutex in the
bound regions, while copyouts and drain for completion utilize condvars.
The mutex lifetime is guaranteed to be strictly larger than the time
interval where driver can initiate dump, and most of the control fields
of the old struct mlx5_dump_data are directly embedded into struct
mlx5_core_dev.

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies
sys/dev/mlx5/driver.h
sys/dev/mlx5/mlx5_core/mlx5_fwdump.c
sys/dev/mlx5/mlx5_core/mlx5_main.c