]> git.baikalelectronics.ru Git - kernel.git/commit
vhost: log dirty page correctly
authorJason Wang <jasowang@redhat.com>
Wed, 16 Jan 2019 08:54:42 +0000 (16:54 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Jan 2019 05:43:24 +0000 (21:43 -0800)
commit97d763512e67d48d00ae15c9d78d4e861b7dd6e1
treec636103033e16eb5d9218b7c7cdbd98a89c4077c
parent1bc0745ce6cd462ab5456825febd72cf131f628a
vhost: log dirty page correctly

Vhost dirty page logging API is designed to sync through GPA. But we
try to log GIOVA when device IOTLB is enabled. This is wrong and may
lead to missing data after migration.

To solve this issue, when logging with device IOTLB enabled, we will:

1) reuse the device IOTLB translation result of GIOVA->HVA mapping to
   get HVA, for writable descriptor, get HVA through iovec. For used
   ring update, translate its GIOVA to HVA
2) traverse the GPA->HVA mapping to get the possible GPA and log
   through GPA. Pay attention this reverse mapping is not guaranteed
   to be unique, so we should log each possible GPA in this case.

This fix the failure of scp to guest during migration. In -next, we
will probably support passing GIOVA->GPA instead of GIOVA->HVA.

Fixes: 89cd651c320d ("vhost: new device IOTLB API")
Reported-by: Jintack Lim <jintack@cs.columbia.edu>
Cc: Jintack Lim <jintack@cs.columbia.edu>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/vhost/net.c
drivers/vhost/vhost.c
drivers/vhost/vhost.h