]> git.baikalelectronics.ru Git - kernel.git/commit
vdpa: mlx5: prevent cvq work from hogging CPU
authorJason Wang <jasowang@redhat.com>
Tue, 29 Mar 2022 04:21:07 +0000 (12:21 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Apr 2022 18:59:15 +0000 (20:59 +0200)
commit603e082dc9f64be297616390ce925c9193b20488
tree8fc2ae496104b6b656999f35423283d6311a2678
parent505fea24f60486168b3395f60d2e616cb0816fe0
vdpa: mlx5: prevent cvq work from hogging CPU

[ Upstream commit 4e4788bc4b23745a3e2b5795496cd38bd3c202be ]

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: 463ccc085b882 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/vdpa/mlx5/net/mlx5_vnet.c