Thread (12 messages) 12 messages, 5 authors, 2015-07-28
STALE3972d
Revisions (16)
  1. v2 [diff vs current]
  2. v1 [diff vs current]
  3. v2 [diff vs current]
  4. v3 [diff vs current]
  5. v4 [diff vs current]
  6. v4 current
  7. v5 [diff vs current]
  8. v5 [diff vs current]
  9. v5 [diff vs current]
  10. v5 [diff vs current]
  11. v5 [diff vs current]
  12. v5 [diff vs current]
  13. v5 [diff vs current]
  14. v6 [diff vs current]
  15. v6 [diff vs current]
  16. v6 [diff vs current]

[PATCH v4 1/4] iommu/iova: Avoid over-allocating when size-aligned

From: dwmw2@infradead.org (David Woodhouse)
Date: 2015-07-28 13:31:50
Also in: linux-iommu

On Thu, 2015-07-16 at 19:40 +0100, Robin Murphy wrote:
Currently, allocating a size-aligned IOVA region quietly adjusts the
actual allocation size in the process, returning a rounded-up
power-of-two-sized allocation. This results in mismatched behaviour in
the IOMMU driver if the original size was not a power of two, where the
original size is mapped, but the rounded-up IOVA size is unmapped.

Whilst some IOMMUs will happily unmap already-unmapped pages, others
consider this an error, so fix it by computing the necessary alignment
padding without altering the actual allocation size. Also clean up by
making pad_size unsigned, since its callers always pass unsigned values
and negative padding makes little sense here anyway.
Applied; thanks.

I'm not 100% sure we *need* the hunk in intel-iommu.c, we can probably
live without rounding the size up. It means we'll use huge pages less
often, but it's not clear that using them when we didn't *mean* to map
the full size of them was the right thing to do in the first place.

But it makes sense to apply the patch as-is, without changing the
effective behaviour, and ponder that more deeply later.

Thanks.

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse at intel.com                              Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5691 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150728/785b9d33/attachment.bin>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help