linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Revert "vring: Force use of DMA API for ARM-based systems with legacy devices"
@ 2017-02-03  3:49 Michael S. Tsirkin
  2017-02-03  9:57 ` Will Deacon
  0 siblings, 1 reply; 2+ messages in thread
From: Michael S. Tsirkin @ 2017-02-03  3:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Robin Murphy, stable, Will Deacon, Marc Zyngier, Jason Wang,
	virtualization

This reverts commit c7070619f3408d9a0dffbed9149e6f00479cf43b.

This has been shown to regress on some ARM systems:

by forcing on DMA API usage for ARM systems, we have inadvertently
kicked open a hornets' nest in terms of cache-coherency. Namely that
unless the virtio device is explicitly described as capable of coherent
DMA by firmware, the DMA APIs on ARM and other DT-based platforms will
assume it is non-coherent. This turns out to cause a big problem for the
likes of QEMU and kvmtool, which generate virtio-mmio devices in their
guest DTs but neglect to add the often-overlooked "dma-coherent"
property; as a result, we end up with the guest making non-cacheable
accesses to the vring, the host doing so cacheably, both talking past
each other and things going horribly wrong.

We are working on a safer work-around.

Fixes: c7070619f340 ("vring: Force use of DMA API for ARM-based systems with legacy devices")
Reported-by: Robin Murphy <robin.murphy@arm.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
---

I'll merge this for 4.10. Let's fix it properly for 4.11.

 drivers/virtio/virtio_ring.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 7e38ed7..409aeaa 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -159,13 +159,6 @@ static bool vring_use_dma_api(struct virtio_device *vdev)
 	if (xen_domain())
 		return true;
 
-	/*
-	 * On ARM-based machines, the DMA ops will do the right thing,
-	 * so always use them with legacy devices.
-	 */
-	if (IS_ENABLED(CONFIG_ARM) || IS_ENABLED(CONFIG_ARM64))
-		return !virtio_has_feature(vdev, VIRTIO_F_VERSION_1);
-
 	return false;
 }
 
-- 
MST

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

* Re: [PATCH] Revert "vring: Force use of DMA API for ARM-based systems with legacy devices"
  2017-02-03  3:49 [PATCH] Revert "vring: Force use of DMA API for ARM-based systems with legacy devices" Michael S. Tsirkin
@ 2017-02-03  9:57 ` Will Deacon
  0 siblings, 0 replies; 2+ messages in thread
From: Will Deacon @ 2017-02-03  9:57 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: linux-kernel, Robin Murphy, stable, Marc Zyngier, Jason Wang,
	virtualization

On Fri, Feb 03, 2017 at 05:49:11AM +0200, Michael S. Tsirkin wrote:
> This reverts commit c7070619f3408d9a0dffbed9149e6f00479cf43b.
> 
> This has been shown to regress on some ARM systems:
> 
> by forcing on DMA API usage for ARM systems, we have inadvertently
> kicked open a hornets' nest in terms of cache-coherency. Namely that
> unless the virtio device is explicitly described as capable of coherent
> DMA by firmware, the DMA APIs on ARM and other DT-based platforms will
> assume it is non-coherent. This turns out to cause a big problem for the
> likes of QEMU and kvmtool, which generate virtio-mmio devices in their
> guest DTs but neglect to add the often-overlooked "dma-coherent"
> property; as a result, we end up with the guest making non-cacheable
> accesses to the vring, the host doing so cacheably, both talking past
> each other and things going horribly wrong.
> 
> We are working on a safer work-around.
> 
> Fixes: c7070619f340 ("vring: Force use of DMA API for ARM-based systems with legacy devices")
> Reported-by: Robin Murphy <robin.murphy@arm.com>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Will Deacon <will.deacon@arm.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> Acked-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
> 
> I'll merge this for 4.10. Let's fix it properly for 4.11.

Acked-by: Will Deacon <will.deacon@arm.com>

Will

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

end of thread, other threads:[~2017-02-03  9:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-03  3:49 [PATCH] Revert "vring: Force use of DMA API for ARM-based systems with legacy devices" Michael S. Tsirkin
2017-02-03  9:57 ` Will Deacon

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).