OSDN Git Service

vdpa: mlx5: prevent cvq work from hogging CPU
authorJason Wang <jasowang@redhat.com>
Tue, 29 Mar 2022 04:21:07 +0000 (12:21 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 30 Mar 2022 08:18:14 +0000 (04:18 -0400)
commit55ebf0d60e3cc6c9e8593399e185842c00e12f36
tree247b49c2514822cdf5debac17e9d362b3dc4ff07
parentc18c86808b78c4c2dc69f27f37c57abab14ee387
vdpa: mlx5: prevent cvq work from hogging CPU

A userspace triggerable infinite loop could happen in
mlx5_cvq_kick_handler() if userspace keeps sending a huge amount of
cvq requests.

Fixing this by introducing a quota and re-queue the work if we're out
of the budget (currently the implicit budget is one) . While at it,
using a per device work struct to avoid on demand memory allocation
for cvq.

Fixes: 5262912ef3cfc ("vdpa/mlx5: Add support for control VQ and MAC setting")
Signed-off-by: Jason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/20220329042109.4029-1-jasowang@redhat.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Eli Cohen <elic@nvidia.com>
drivers/vdpa/mlx5/net/mlx5_vnet.c