Skip to content

Commit 55a7cb0

Browse files
dtatuleamstsirkin
authored andcommitted
vdpa/mlx5: Keep notifiers during suspend but ignore
Unregistering notifiers is a costly operation. Instead of removing the notifiers during device suspend and adding them back at resume, simply ignore the call when the device is suspended. At resume time call queue_link_work() to make sure that the device state is propagated in case there were changes. For 1 vDPA device x 32 VQs (16 VQPs) attached to a large VM (256 GB RAM, 32 CPUs x 2 threads per core), the device suspend time is reduced from ~13 ms to ~2.5 ms. Signed-off-by: Dragos Tatulea <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Acked-by: Eugenio Pérez <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Tested-by: Lei Yang <[email protected]>
1 parent 5eb8c7e commit 55a7cb0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/vdpa/mlx5/net/mlx5_vnet.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2850,6 +2850,9 @@ static int event_handler(struct notifier_block *nb, unsigned long event, void *p
28502850
struct mlx5_eqe *eqe = param;
28512851
int ret = NOTIFY_DONE;
28522852

2853+
if (ndev->mvdev.suspended)
2854+
return NOTIFY_DONE;
2855+
28532856
if (event == MLX5_EVENT_TYPE_PORT_CHANGE) {
28542857
switch (eqe->sub_type) {
28552858
case MLX5_PORT_CHANGE_SUBTYPE_DOWN:
@@ -3595,7 +3598,6 @@ static int mlx5_vdpa_suspend(struct vdpa_device *vdev)
35953598
mlx5_vdpa_info(mvdev, "suspending device\n");
35963599

35973600
down_write(&ndev->reslock);
3598-
unregister_link_notifier(ndev);
35993601
err = suspend_vqs(ndev, 0, ndev->cur_num_vqs);
36003602
mlx5_vdpa_cvq_suspend(mvdev);
36013603
mvdev->suspended = true;
@@ -3617,7 +3619,7 @@ static int mlx5_vdpa_resume(struct vdpa_device *vdev)
36173619
down_write(&ndev->reslock);
36183620
mvdev->suspended = false;
36193621
err = resume_vqs(ndev, 0, ndev->cur_num_vqs);
3620-
register_link_notifier(ndev);
3622+
queue_link_work(ndev);
36213623
up_write(&ndev->reslock);
36223624

36233625
return err;

0 commit comments

Comments
 (0)