Commit 55ebf0d
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: 5262912 ("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>1 parent c18c868 commit 55ebf0d
1 file changed
Lines changed: 9 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
166 | 167 | | |
167 | 168 | | |
168 | 169 | | |
| |||
1659 | 1660 | | |
1660 | 1661 | | |
1661 | 1662 | | |
1662 | | - | |
| 1663 | + | |
1663 | 1664 | | |
1664 | 1665 | | |
1665 | | - | |
| 1666 | + | |
1666 | 1667 | | |
1667 | 1668 | | |
1668 | 1669 | | |
| |||
1696 | 1697 | | |
1697 | 1698 | | |
1698 | 1699 | | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
1699 | 1703 | | |
1700 | | - | |
1701 | | - | |
1702 | 1704 | | |
1703 | 1705 | | |
1704 | 1706 | | |
1705 | 1707 | | |
1706 | 1708 | | |
1707 | 1709 | | |
1708 | 1710 | | |
1709 | | - | |
1710 | 1711 | | |
1711 | 1712 | | |
1712 | 1713 | | |
| |||
1715 | 1716 | | |
1716 | 1717 | | |
1717 | 1718 | | |
1718 | | - | |
1719 | | - | |
1720 | | - | |
1721 | | - | |
1722 | | - | |
1723 | | - | |
1724 | | - | |
| 1719 | + | |
1725 | 1720 | | |
1726 | 1721 | | |
1727 | 1722 | | |
| |||
2740 | 2735 | | |
2741 | 2736 | | |
2742 | 2737 | | |
| 2738 | + | |
| 2739 | + | |
2743 | 2740 | | |
2744 | 2741 | | |
2745 | 2742 | | |
| |||
0 commit comments