dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] vhost: IOTLB fixes for -rc1
@ 2017-10-12 15:38 Maxime Coquelin
  2017-10-12 15:38 ` [PATCH 1/2] vhost: fix deadlock on IOTLB miss Maxime Coquelin
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Maxime Coquelin @ 2017-10-12 15:38 UTC (permalink / raw)
  To: yliu, thomas, dev; +Cc: Maxime Coquelin

These two patches fixes issues faced when running the VM on a different
socket than DPDK.

In this case, the numa_realloc() function is called to reallocate
the virtqueue and the virtio-net device structs on the VM's socket.

The problem is that doing so corrupts the IOTLB cache list, as the list
head is being reallocated, but the first entry in the list is not updated
to point to the new list head. It results in all new IOTLB entries that
need to be inserted before the first entry in the list to be leaked, as
the new head is still pointing to the first entry at the time the realloc
happened.

Patch 2 addresses this issue by re-initializing the IOTLB cache 
completely. Doing this also create again the IOTLB mempool on the new
socket.

This first issue helped to highlight a deadlock that patch 1 fixes.
As inserting an entry before the first entry in the list resulted in a
leak, it ended up flooding Qemu with IOTLB misses for the same address.

The deadlock happen because an optimization was done to lock the iotlb
cache lock once per packet burst instead of once per translation. It
means that when an IOTLB miss is sent, it is done with the lock held.

The problem is that sending an IOTLB miss can block if the socket buffer
is full, and this buffer is emptied by the same Qemu thread which is
waiting for an IOTLB update to be completed. But it never completes
because DPDK waits for the iotlb lock to insert the update into the
iotlb cache, hence the deadlock.

The fix consists in just unlocking the iotlb lock while sending the
IOTLB miss, which is safe as it does not access the iotlb list the
lock protects.

Maxime Coquelin (2):
  vhost: fix deadlock on IOTLB miss
  vhost: fix IOTLB on NUMA realloc

 lib/librte_vhost/iotlb.c      |  1 -
 lib/librte_vhost/vhost.c      | 12 ++++++++++++
 lib/librte_vhost/vhost_user.c |  3 +++
 3 files changed, 15 insertions(+), 1 deletion(-)

-- 
2.13.6

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-10-13 18:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-12 15:38 [PATCH 0/2] vhost: IOTLB fixes for -rc1 Maxime Coquelin
2017-10-12 15:38 ` [PATCH 1/2] vhost: fix deadlock on IOTLB miss Maxime Coquelin
2017-10-13 11:32   ` Jens Freimann
2017-10-12 15:38 ` [PATCH 2/2] vhost: fix IOTLB on NUMA realloc Maxime Coquelin
2017-10-13 11:23   ` Jens Freimann
2017-10-13 18:37 ` [PATCH 0/2] vhost: IOTLB fixes for -rc1 Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).