* Bug: Freeing dma regions
@ 2016-03-02 0:45 David Kiarie
[not found] ` <CABdVeACY5dWoj-q4uMUnc-NgqqShemunLU1bbvLpAN6jPdBC+w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: David Kiarie @ 2016-03-02 0:45 UTC (permalink / raw)
To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
joro-zLv9SwRftAIdnm+yROfE0A, Valentine Sinitsyn, Jan Kiszka
Hello,
This patch seems to have introduced a bug -
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=4eeca8c5e72fad752eba9efc293c924d65faa86e
As the commit message says, it should check for regions behind the
next_bit but it checks for regions beyond.
David.
^ permalink raw reply [flat|nested] 8+ messages in thread[parent not found: <CABdVeACY5dWoj-q4uMUnc-NgqqShemunLU1bbvLpAN6jPdBC+w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: Bug: Freeing dma regions [not found] ` <CABdVeACY5dWoj-q4uMUnc-NgqqShemunLU1bbvLpAN6jPdBC+w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2016-03-02 8:29 ` Joerg Roedel [not found] ` <20160302082940.GS22747-zLv9SwRftAIdnm+yROfE0A@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: Joerg Roedel @ 2016-03-02 8:29 UTC (permalink / raw) To: David Kiarie Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, Jan Kiszka, Valentine Sinitsyn On Wed, Mar 02, 2016 at 03:45:39AM +0300, David Kiarie wrote: > Hello, > > This patch seems to have introduced a bug - > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=4eeca8c5e72fad752eba9efc293c924d65faa86e > > As the commit message says, it should check for regions behind the > next_bit but it checks for regions beyond. Hmm, the patch looks good to me. Do you actually see a reproducible issue with it? Joerg ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <20160302082940.GS22747-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>]
* Re: Bug: Freeing dma regions [not found] ` <20160302082940.GS22747-zLv9SwRftAIdnm+yROfE0A@public.gmane.org> @ 2016-03-02 8:37 ` David Kiarie [not found] ` <CABdVeAB4C2aDGSgmCnGOjSzSZZ3Er5gu-ngsSVPc_XbBxsVaTA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: David Kiarie @ 2016-03-02 8:37 UTC (permalink / raw) To: Joerg Roedel Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, Jan Kiszka, Valentine Sinitsyn On Wed, Mar 2, 2016 at 11:29 AM, Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org> wrote: > On Wed, Mar 02, 2016 at 03:45:39AM +0300, David Kiarie wrote: >> Hello, >> >> This patch seems to have introduced a bug - >> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=4eeca8c5e72fad752eba9efc293c924d65faa86e >> >> As the commit message says, it should check for regions behind the >> next_bit but it checks for regions beyond. > > Hmm, the patch looks good to me. Do you actually see a reproducible > issue with it? Yep, I can't tell what exactly is happening but it seems to break Qemu emulated IOMMU. I haven't tried on real hardware. > > > Joerg > ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <CABdVeAB4C2aDGSgmCnGOjSzSZZ3Er5gu-ngsSVPc_XbBxsVaTA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: Bug: Freeing dma regions [not found] ` <CABdVeAB4C2aDGSgmCnGOjSzSZZ3Er5gu-ngsSVPc_XbBxsVaTA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2016-03-02 8:40 ` David Kiarie [not found] ` <CABdVeABM7OzGWeoXo1uui7f0HyP9wVLCPsEe+LnXrWXcmt7dVg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: David Kiarie @ 2016-03-02 8:40 UTC (permalink / raw) To: Joerg Roedel Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, Jan Kiszka, Valentine Sinitsyn On Wed, Mar 2, 2016 at 11:37 AM, David Kiarie <davidkiarie4-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > On Wed, Mar 2, 2016 at 11:29 AM, Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org> wrote: >> On Wed, Mar 02, 2016 at 03:45:39AM +0300, David Kiarie wrote: >>> Hello, >>> >>> This patch seems to have introduced a bug - >>> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=4eeca8c5e72fad752eba9efc293c924d65faa86e >>> >>> As the commit message says, it should check for regions behind the >>> next_bit but it checks for regions beyond. >> >> Hmm, the patch looks good to me. Do you actually see a reproducible >> issue with it? > > Yep, I can't tell what exactly is happening but it seems to break > Qemu emulated IOMMU. I haven't tried on real hardware. What effect is setting the value next_bit to last invalidated index supposed to have ? > >> >> >> Joerg >> ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <CABdVeABM7OzGWeoXo1uui7f0HyP9wVLCPsEe+LnXrWXcmt7dVg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: Bug: Freeing dma regions [not found] ` <CABdVeABM7OzGWeoXo1uui7f0HyP9wVLCPsEe+LnXrWXcmt7dVg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2016-03-02 12:35 ` Joerg Roedel [not found] ` <20160302123519.GT22747-zLv9SwRftAIdnm+yROfE0A@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: Joerg Roedel @ 2016-03-02 12:35 UTC (permalink / raw) To: David Kiarie Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, Jan Kiszka, Valentine Sinitsyn On Wed, Mar 02, 2016 at 11:40:04AM +0300, David Kiarie wrote: > What effect is setting the value next_bit to last invalidated index > supposed to have ? The idea is to safe the IOTLB flush by not re-using the address-range until the allocator wraps around to 0 again. We only allocate address ranges between next_bit and end-of-range. This way we don't need a flush after every unmap operation. Joerg ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <20160302123519.GT22747-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>]
* Re: Bug: Freeing dma regions [not found] ` <20160302123519.GT22747-zLv9SwRftAIdnm+yROfE0A@public.gmane.org> @ 2016-03-02 12:58 ` David Kiarie [not found] ` <CABdVeAAq_u6kAC9pm96UAdozWN5VSiiNm3HMBJ5wGqpd5zvbrQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: David Kiarie @ 2016-03-02 12:58 UTC (permalink / raw) To: Joerg Roedel Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, Jan Kiszka, Valentine Sinitsyn On Wed, Mar 2, 2016 at 3:35 PM, Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org> wrote: > On Wed, Mar 02, 2016 at 11:40:04AM +0300, David Kiarie wrote: >> What effect is setting the value next_bit to last invalidated index >> supposed to have ? > > The idea is to safe the IOTLB flush by not re-using the address-range > until the allocator wraps around to 0 again. We only allocate address > ranges between next_bit and end-of-range. This way we don't need a flush > after every unmap operation. Okay, I'll look at this issue again. Last unrelated question. If I have 'iommu=pt' IOMMU doesn't seem to allocate any addresses and doesn't populate the 'root page table' until I try to pass-through a device. Why is that set like this ? > > > > Joerg > ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <CABdVeAAq_u6kAC9pm96UAdozWN5VSiiNm3HMBJ5wGqpd5zvbrQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: Bug: Freeing dma regions [not found] ` <CABdVeAAq_u6kAC9pm96UAdozWN5VSiiNm3HMBJ5wGqpd5zvbrQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2016-03-02 13:45 ` Joerg Roedel [not found] ` <20160302134528.GA20213-zLv9SwRftAIdnm+yROfE0A@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: Joerg Roedel @ 2016-03-02 13:45 UTC (permalink / raw) To: David Kiarie Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, Jan Kiszka, Valentine Sinitsyn On Wed, Mar 02, 2016 at 03:58:18PM +0300, David Kiarie wrote: > On Wed, Mar 2, 2016 at 3:35 PM, Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org> wrote: > > On Wed, Mar 02, 2016 at 11:40:04AM +0300, David Kiarie wrote: > >> What effect is setting the value next_bit to last invalidated index > >> supposed to have ? > > > > The idea is to safe the IOTLB flush by not re-using the address-range > > until the allocator wraps around to 0 again. We only allocate address > > ranges between next_bit and end-of-range. This way we don't need a flush > > after every unmap operation. > > Okay, I'll look at this issue again. > > Last unrelated question. If I have 'iommu=pt' IOMMU doesn't seem to > allocate any addresses and doesn't populate the 'root page table' > until I try to pass-through a device. Why is that set like this ? The pt stands for passthrough. In this mode the IOMMU is enabled, but configured in way as if it is disabled. This means that all devices get access to the physical address space and no remapping through the DMA-API is done at all. Often this is used for performance reasons. This only changes when a device is is assigned to a guest. In that case it will only see the guest-physical address space via a page-table. Joerg ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <20160302134528.GA20213-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>]
* Re: Bug: Freeing dma regions [not found] ` <20160302134528.GA20213-zLv9SwRftAIdnm+yROfE0A@public.gmane.org> @ 2016-03-02 14:06 ` David Kiarie 0 siblings, 0 replies; 8+ messages in thread From: David Kiarie @ 2016-03-02 14:06 UTC (permalink / raw) To: Joerg Roedel Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, Jan Kiszka, Valentine Sinitsyn On Wed, Mar 2, 2016 at 4:45 PM, Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org> wrote: > On Wed, Mar 02, 2016 at 03:58:18PM +0300, David Kiarie wrote: >> On Wed, Mar 2, 2016 at 3:35 PM, Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org> wrote: >> > On Wed, Mar 02, 2016 at 11:40:04AM +0300, David Kiarie wrote: >> >> What effect is setting the value next_bit to last invalidated index >> >> supposed to have ? >> > >> > The idea is to safe the IOTLB flush by not re-using the address-range >> > until the allocator wraps around to 0 again. We only allocate address >> > ranges between next_bit and end-of-range. This way we don't need a flush >> > after every unmap operation. >> >> Okay, I'll look at this issue again. >> >> Last unrelated question. If I have 'iommu=pt' IOMMU doesn't seem to >> allocate any addresses and doesn't populate the 'root page table' >> until I try to pass-through a device. Why is that set like this ? > > The pt stands for passthrough. In this mode the IOMMU is enabled, but > configured in way as if it is disabled. This means that all devices get > access to the physical address space and no remapping through the > DMA-API is done at all. Often this is used for performance reasons. > > This only changes when a device is is assigned to a guest. In that case > it will only see the guest-physical address space via a page-table. Thanks for the insight! > > > Joerg > ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-03-02 14:06 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-02 0:45 Bug: Freeing dma regions David Kiarie
[not found] ` <CABdVeACY5dWoj-q4uMUnc-NgqqShemunLU1bbvLpAN6jPdBC+w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-03-02 8:29 ` Joerg Roedel
[not found] ` <20160302082940.GS22747-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2016-03-02 8:37 ` David Kiarie
[not found] ` <CABdVeAB4C2aDGSgmCnGOjSzSZZ3Er5gu-ngsSVPc_XbBxsVaTA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-03-02 8:40 ` David Kiarie
[not found] ` <CABdVeABM7OzGWeoXo1uui7f0HyP9wVLCPsEe+LnXrWXcmt7dVg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-03-02 12:35 ` Joerg Roedel
[not found] ` <20160302123519.GT22747-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2016-03-02 12:58 ` David Kiarie
[not found] ` <CABdVeAAq_u6kAC9pm96UAdozWN5VSiiNm3HMBJ5wGqpd5zvbrQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-03-02 13:45 ` Joerg Roedel
[not found] ` <20160302134528.GA20213-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2016-03-02 14:06 ` David Kiarie
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.