vdpasim: protect concurrent access to iommu iotlb
authorMax Gurtovoy <maxg@mellanox.com>
Fri, 31 Jul 2020 07:38:22 +0000 (15:38 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Aug 2020 06:24:12 +0000 (08:24 +0200)
commitf37c95d8c6b24d62ccb153f33f55aac625d87db7
tree80049e198b7612b5692c187b8aa4548a1f9b8806
parentd37e144863160ce3d6315d85215e1b5c9f244969
vdpasim: protect concurrent access to iommu iotlb

commit 0ea9ee430e74b16c6b17e70757d1c26d8d140e1f upstream.

Iommu iotlb can be accessed by different cores for performing IO using
multiple virt queues. Add a spinlock to synchronize iotlb accesses.

This could be easily reproduced when using more than 1 pktgen threads
to inject traffic to vdpa simulator.

Fixes: 2c53d0f64c06f("vdpasim: vDPA device simulator")
Cc: stable@vger.kernel.org
Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/20200731073822.13326-1-jasowang@redhat.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/vdpa/vdpa_sim/vdpa_sim.c