Linux IOMMU Development
 help / color / mirror / Atom feed
* Software bounce buffers Vs allocating DMA buffers in page granularity
@ 2023-08-17 20:17 Chathura Rajapaksha
  2023-08-18  1:23 ` Baolu Lu
  2023-08-18 15:08 ` Robin Murphy
  0 siblings, 2 replies; 3+ messages in thread
From: Chathura Rajapaksha @ 2023-08-17 20:17 UTC (permalink / raw)
  To: iommu

Hi All,

I have a question regarding the IOMMU software bounce buffer feature.
I understand that this feature was introduced as a mitigation to
sub-page vulnerabilities (which were shown to be exploitable by
Thunderclap).

My question is:
Can allocating DMA buffers in page granularity (multiples of 4KB pages)
be a feasible alternative solution to software bounce buffers?

I am trying to understand the challenges and performance impact of
such a solution (compared to SW bounce buffers) if someone were to
proposed it.
In other words, I am trying to find the reasons why SW bounce buffers
were introduced rather than allocating DMA buffers in page granularity.

Thanks in advance.
Regards,
Chathura

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

* Re: Software bounce buffers Vs allocating DMA buffers in page granularity
  2023-08-17 20:17 Software bounce buffers Vs allocating DMA buffers in page granularity Chathura Rajapaksha
@ 2023-08-18  1:23 ` Baolu Lu
  2023-08-18 15:08 ` Robin Murphy
  1 sibling, 0 replies; 3+ messages in thread
From: Baolu Lu @ 2023-08-18  1:23 UTC (permalink / raw)
  To: Chathura Rajapaksha, iommu; +Cc: baolu.lu

On 2023/8/18 4:17, Chathura Rajapaksha wrote:
> Hi All,
> 
> I have a question regarding the IOMMU software bounce buffer feature.
> I understand that this feature was introduced as a mitigation to
> sub-page vulnerabilities (which were shown to be exploitable by
> Thunderclap).
> 
> My question is:
> Can allocating DMA buffers in page granularity (multiples of 4KB pages)
> be a feasible alternative solution to software bounce buffers?

Yes. I remember that we skip software bounce buffer if the buffer size
is one or multiple PAGE_SIZE(s). Any change during recent evolution?

Best regards,
baolu

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

* Re: Software bounce buffers Vs allocating DMA buffers in page granularity
  2023-08-17 20:17 Software bounce buffers Vs allocating DMA buffers in page granularity Chathura Rajapaksha
  2023-08-18  1:23 ` Baolu Lu
@ 2023-08-18 15:08 ` Robin Murphy
  1 sibling, 0 replies; 3+ messages in thread
From: Robin Murphy @ 2023-08-18 15:08 UTC (permalink / raw)
  To: Chathura Rajapaksha, iommu

On 2023-08-17 21:17, Chathura Rajapaksha wrote:
> Hi All,
> 
> I have a question regarding the IOMMU software bounce buffer feature.
> I understand that this feature was introduced as a mitigation to
> sub-page vulnerabilities (which were shown to be exploitable by
> Thunderclap).
> 
> My question is:
> Can allocating DMA buffers in page granularity (multiples of 4KB pages)
> be a feasible alternative solution to software bounce buffers?
> 
> I am trying to understand the challenges and performance impact of
> such a solution (compared to SW bounce buffers) if someone were to
> proposed it.
> In other words, I am trying to find the reasons why SW bounce buffers
> were introduced rather than allocating DMA buffers in page granularity.

Dedicated DMA buffers (dma_alloc_*()) *are* allocated at page 
granularity. SWIOTLB is used by the streaming DMA API (dma_map_*()), 
where the data already exists somewhere in memory, outside our control. 
If a streaming mapping request does happen to be aligned to the IOMMU 
page size already, it isn't bounced.

Robin.

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

end of thread, other threads:[~2023-08-18 15:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-17 20:17 Software bounce buffers Vs allocating DMA buffers in page granularity Chathura Rajapaksha
2023-08-18  1:23 ` Baolu Lu
2023-08-18 15:08 ` Robin Murphy

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