Linux IOMMU Development
 help / color / mirror / Atom feed
* Intel-iommu: Possible memory corruption due to deferred iommu flush
@ 2017-11-16 10:20 nick klingsman
       [not found] ` <CAGkh+XfVC0Ki0T88qdKke4Hsp2nyAZewRupEOLTds+1i4eBQYQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: nick klingsman @ 2017-11-16 10:20 UTC (permalink / raw)
  To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

* Note: Please 'CC'/Reply my email as I'm not subscribed to the list yet.

Hi,

During __iommu_flush_iotlb() we set the WD (WriteDrain) bit if the
iommu supports cap_write_drain(). This part of the logic exists from
day one of the code and later even added to QI logic.

Back than, when we dma_unmap_xxx() we 'synchronically' did the
iommu_flush() and within it the the Write-Drain logic.

However, today, we do a batch-flush  which means that all/most calls
to dma_unmap() don't perform the Write-Drain.

Questions:

1. If WD is a must, how come the batch-flush doesn't cause any memory
corruption ? For example:
   a. dma_map_page(100, from_device)
   b. Device writes data to device
   c. dma_unmap_page() -> batched and not sync-flushed
   d. Possible BUG ? Data read before the write is drained can be stale ?

2. If WD is not needed, why do we do it ? Why do we effect IOMMU work
with unneeded actions (in the most critical fast path of map/unmap) ?


Thanks,
Nick

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

end of thread, other threads:[~2017-11-17  1:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-16 10:20 Intel-iommu: Possible memory corruption due to deferred iommu flush nick klingsman
     [not found] ` <CAGkh+XfVC0Ki0T88qdKke4Hsp2nyAZewRupEOLTds+1i4eBQYQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-16 22:52   ` Raj, Ashok
2017-11-16 23:54     ` nick klingsman
     [not found]       ` <CAGkh+XesX-yFnU_3q2=t6Zcju_zE3wN7EZoBswQnfc_cZ9qZxQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-16 23:57         ` nick klingsman
     [not found]           ` <CAGkh+Xd-mwYT75-sFWbjxKCOu5H0QhZFBKNELZxBytWpnORnZw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-17  1:23             ` Raj, Ashok

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox