Andy Lutomirski
2015-Jul-28 01:08 UTC
[PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API
On Mon, Sep 1, 2014 at 10:39 AM, Andy Lutomirski <luto at amacapital.net> wrote:> This fixes virtio on Xen guests as well as on any other platform > that uses virtio_pci on which physical addresses don't match bus > addresses. > > This can be tested with: > > virtme-run --xen xen --kimg arch/x86/boot/bzImage --console > > using virtme from here: > > https://git.kernel.org/cgit/utils/kernel/virtme/virtme.git > > Without these patches, the guest hangs forever. With these patches, > everything works. >Dusting off an ancient thread. Now that the dust has accumulated^Wsettled, is it worth pursuing this? I think the situation is considerably worse than it was when I originally wrote these patches: I think that QEMU now supports a nasty mode in which the guest's PCI bus appears to be behind an IOMMU but the virtio devices on that bus punch straight through that IOMMU. I have a half-hearted port to modern kernels here: https://git.kernel.org/cgit/linux/kernel/git/luto/linux.git/log/?h=virtio_ring_xen I didn't implement DMA API access for virtio_pci_modern, and I have no idea what to do about detecting whether a given virtio device honors its IOMMU or not. --Andy
Christian Borntraeger
2015-Jul-28 07:05 UTC
[PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API
Am 28.07.2015 um 03:08 schrieb Andy Lutomirski:> On Mon, Sep 1, 2014 at 10:39 AM, Andy Lutomirski <luto at amacapital.net> wrote: >> This fixes virtio on Xen guests as well as on any other platform >> that uses virtio_pci on which physical addresses don't match bus >> addresses. >> >> This can be tested with: >> >> virtme-run --xen xen --kimg arch/x86/boot/bzImage --console >> >> using virtme from here: >> >> https://git.kernel.org/cgit/utils/kernel/virtme/virtme.git >> >> Without these patches, the guest hangs forever. With these patches, >> everything works. >> > > Dusting off an ancient thread. > > Now that the dust has accumulated^Wsettled, is it worth pursuing this? > I think the situation is considerably worse than it was when I > originally wrote these patches: I think that QEMU now supports a nasty > mode in which the guest's PCI bus appears to be behind an IOMMU but > the virtio devices on that bus punch straight through that IOMMU. > > I have a half-hearted port to modern kernels here: > > https://git.kernel.org/cgit/linux/kernel/git/luto/linux.git/log/?h=virtio_ring_xen > > I didn't implement DMA API access for virtio_pci_modern, and I have no > idea what to do about detecting whether a given virtio device honors > its IOMMU or not.I think its really tricky. Looking at where virtio came from, the virtio ring was always native access without IOMMU. This was true for the early lguest things and then the early s390 transport, (which is quite close to the lguest interface). virtio-pci used the same scheme - ignoring all iommu considerations. I understand that for PCI we actually might want to follow iommu restrictions from a correctness and security point of view and from the ccw point of view we do not. No idea about virtio-mmio. I think the proper way of handling this is to take this into the TC for virtio - dont know what would be the right thing to do. A feature bit, always iommu for pci, something else? Michael, Conny, do you agree? Christian
Paolo Bonzini
2015-Jul-28 08:16 UTC
[PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API
On 28/07/2015 03:08, Andy Lutomirski wrote:> On Mon, Sep 1, 2014 at 10:39 AM, Andy Lutomirski <luto at amacapital.net> wrote: >> This fixes virtio on Xen guests as well as on any other platform >> that uses virtio_pci on which physical addresses don't match bus >> addresses. >> >> This can be tested with: >> >> virtme-run --xen xen --kimg arch/x86/boot/bzImage --console >> >> using virtme from here: >> >> https://git.kernel.org/cgit/utils/kernel/virtme/virtme.git >> >> Without these patches, the guest hangs forever. With these patches, >> everything works. >> > > Dusting off an ancient thread. > > Now that the dust has accumulated^Wsettled, is it worth pursuing this? > I think the situation is considerably worse than it was when I > originally wrote these patches: I think that QEMU now supports a nasty > mode in which the guest's PCI bus appears to be behind an IOMMU but > the virtio devices on that bus punch straight through that IOMMU.That is an experimental feature (it's x-iommu), so it can change. The plan was: - for PPC, virtio never honors IOMMU - for non-PPC, either have virtio always honor IOMMU, or enforce that virtio is not under IOMMU. Paolo> I have a half-hearted port to modern kernels here: > > https://git.kernel.org/cgit/linux/kernel/git/luto/linux.git/log/?h=virtio_ring_xen > > I didn't implement DMA API access for virtio_pci_modern, and I have no > idea what to do about detecting whether a given virtio device honors > its IOMMU or not. > > --Andy >
Benjamin Herrenschmidt
2015-Jul-28 10:12 UTC
[PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API
On Tue, 2015-07-28 at 10:16 +0200, Paolo Bonzini wrote:> > On 28/07/2015 03:08, Andy Lutomirski wrote: > > On Mon, Sep 1, 2014 at 10:39 AM, Andy Lutomirski <luto at amacapital.net> wrote: > >> This fixes virtio on Xen guests as well as on any other platform > >> that uses virtio_pci on which physical addresses don't match bus > >> addresses. > >> > >> This can be tested with: > >> > >> virtme-run --xen xen --kimg arch/x86/boot/bzImage --console > >> > >> using virtme from here: > >> > >> https://git.kernel.org/cgit/utils/kernel/virtme/virtme.git > >> > >> Without these patches, the guest hangs forever. With these patches, > >> everything works. > >> > > > > Dusting off an ancient thread. > > > > Now that the dust has accumulated^Wsettled, is it worth pursuing this? > > I think the situation is considerably worse than it was when I > > originally wrote these patches: I think that QEMU now supports a nasty > > mode in which the guest's PCI bus appears to be behind an IOMMU but > > the virtio devices on that bus punch straight through that IOMMU. > > That is an experimental feature (it's x-iommu), so it can change. > > The plan was: > > - for PPC, virtio never honors IOMMU > > - for non-PPC, either have virtio always honor IOMMU, or enforce that > virtio is not under IOMMU. >I dislike having PPC special cased. In fact, today x86 guests also assume that virtio bypasses IOMMU I believe. In fact *all* guests do. I would much prefer if the information as to whether it honors or not gets passed to the guest somewhat. My preference goes for passing it via the virtio config space but there were objections that it should be a bus property (which is tricky to do with PCI and doesn't properly reflect the fact that in qemu you can mix & match IOMMU-honoring devices and bypassing-virtio on the same bus). Ben.> Paolo > > > I have a half-hearted port to modern kernels here: > > > > https://git.kernel.org/cgit/linux/kernel/git/luto/linux.git/log/?h=virtio_ring_xen > > > > I didn't implement DMA API access for virtio_pci_modern, and I have no > > idea what to do about detecting whether a given virtio device honors > > its IOMMU or not. > > > > --Andy > >
Michael S. Tsirkin
2015-Jul-28 13:08 UTC
[PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API
On Mon, Jul 27, 2015 at 06:08:59PM -0700, Andy Lutomirski wrote:> On Mon, Sep 1, 2014 at 10:39 AM, Andy Lutomirski <luto at amacapital.net> wrote: > > This fixes virtio on Xen guests as well as on any other platform > > that uses virtio_pci on which physical addresses don't match bus > > addresses. > > > > This can be tested with: > > > > virtme-run --xen xen --kimg arch/x86/boot/bzImage --console > > > > using virtme from here: > > > > https://git.kernel.org/cgit/utils/kernel/virtme/virtme.git > > > > Without these patches, the guest hangs forever. With these patches, > > everything works. > > > > Dusting off an ancient thread. > > Now that the dust has accumulated^Wsettled, is it worth pursuing this? > I think the situation is considerably worse than it was when I > originally wrote these patches: I think that QEMU now supports a nasty > mode in which the guest's PCI bus appears to be behind an IOMMU but > the virtio devices on that bus punch straight through that IOMMU. > > I have a half-hearted port to modern kernels here: > > https://git.kernel.org/cgit/linux/kernel/git/luto/linux.git/log/?h=virtio_ring_xen > > I didn't implement DMA API access for virtio_pci_modern, and I have no > idea what to do about detecting whether a given virtio device honors > its IOMMU or not. > > --AndyIt's worth thinking about. I'll need to measure what's the overhead of supporting both modes - probably after I'm back from the KVM forum. -- MST
Seemingly Similar Threads
- [PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API
- [PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API
- [PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API
- [PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API
- [PATCH v2 0/4] virtio: Clean up scatterlists and use the DMA API