Message ID | alpine.DEB.2.02.1405071606230.14596@kaball.uk.xensource.com |
---|---|
State | New |
Headers | show |
On 7 May 2014 16:09, Stefano Stabellini <stefano.stabellini@eu.citrix.com> wrote: > From: Alexey Kardashevskiy <aik@ozlabs.ru> > > The address_space_translate() function cuts the returned plen (page size) > to hardcoded TARGET_PAGE_SIZE. This function can be used on pages bigger > than that so this limiting should not be used on such pages. > > Since originally the limiting was introduced for XEN, we can safely > limit this piece of code to XEN. So does the patch. > > Suggested-by: Paolo Bonzini <pbonzini@redhat.com> > Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> > --- > exec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/exec.c b/exec.c > index 91513c6..cf12049 100644 > --- a/exec.c > +++ b/exec.c > @@ -380,7 +380,7 @@ MemoryRegion *address_space_translate(AddressSpace *as, hwaddr addr, > as = iotlb.target_as; > } > > - if (memory_access_is_direct(mr, is_write)) { > + if (xen_enabled() && memory_access_is_direct(mr, is_write)) { > hwaddr page = ((addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE) - addr; > len = MIN(page, len); > } We should put this patch in (both as an efficiency thing and an expedient fix) but we really need to either track down which callers of this API are relying on the returned plen not being truncated, or we need to fix Xen to not truncate either. This is just a bandaid IMHO. thanks -- PMM
Il 07/05/2014 17:12, Peter Maydell ha scritto: >> > - if (memory_access_is_direct(mr, is_write)) { >> > + if (xen_enabled() && memory_access_is_direct(mr, is_write)) { >> > hwaddr page = ((addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE) - addr; >> > len = MIN(page, len); >> > } > We should put this patch in (both as an efficiency thing and an > expedient fix) but we really need to either track down which > callers of this API are relying on the returned plen not being > truncated, or we need to fix Xen to not truncate either. This > is just a bandaid IMHO. Fixing Xen to not truncate is not possible because of the Xen mapcache, unless of course QEMU is changed to avoid the mapcache completely on 64-bit hosts. I'm not sure if that makes sense from the Xen point of view. Regarding fixing callers, a known one is virtio-scsi which is a bug and on my todo list. But another is VFIO, which cannot accept truncation if the IOMMU page size is greater than TARGET_PAGE_SIZE. Paolo
On Wed, 7 May 2014, Paolo Bonzini wrote: > Il 07/05/2014 17:12, Peter Maydell ha scritto: > > > > - if (memory_access_is_direct(mr, is_write)) { > > > > + if (xen_enabled() && memory_access_is_direct(mr, is_write)) { > > > > hwaddr page = ((addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE) - > > > addr; > > > > len = MIN(page, len); > > > > } > > We should put this patch in (both as an efficiency thing and an > > expedient fix) but we really need to either track down which > > callers of this API are relying on the returned plen not being > > truncated, or we need to fix Xen to not truncate either. This > > is just a bandaid IMHO. > > Fixing Xen to not truncate is not possible because of the Xen mapcache, unless > of course QEMU is changed to avoid the mapcache completely on 64-bit hosts. > I'm not sure if that makes sense from the Xen point of view. Right, it makes sense, however we would still need to keep the 32-bit mapcache code path working. > Regarding fixing callers, a known one is virtio-scsi which is a bug and on my > todo list. But another is VFIO, which cannot accept truncation if the IOMMU > page size is greater than TARGET_PAGE_SIZE.
On 7 May 2014 16:22, Paolo Bonzini <pbonzini@redhat.com> wrote: > Fixing Xen to not truncate is not possible because of the Xen mapcache, > unless of course QEMU is changed to avoid the mapcache completely on 64-bit > hosts. I'm not sure if that makes sense from the Xen point of view. > > Regarding fixing callers, a known one is virtio-scsi which is a bug and on > my todo list. But another is VFIO, which cannot accept truncation if the > IOMMU page size is greater than TARGET_PAGE_SIZE. The API can't simultaneously allow the implementation to truncate and guarantee to the caller that we don't truncate, so one of these has to change, surely? Otherwise we would need to provide some sort of flag for truncation-unacceptable so that incompatible combinations fail nicely rather than silently doing weird stuff, I guess. thanks -- PMM
Il 07/05/2014 17:32, Peter Maydell ha scritto: > > Regarding fixing callers, a known one is virtio-scsi which is a bug and on > > my todo list. But another is VFIO, which cannot accept truncation if the > > IOMMU page size is greater than TARGET_PAGE_SIZE. > > The API can't simultaneously allow the implementation to truncate > and guarantee to the caller that we don't truncate, so one of these > has to change, surely? We can provide a function to return the truncation granularity, and add to VFIO a check that will prevent using VFIO together with Xen. Paolo
On 7 May 2014 16:09, Stefano Stabellini <stefano.stabellini@eu.citrix.com> wrote: > The following changes since commit 951916d02c59cd0eddd57c3d66f87f921931e394: > > Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-6' into staging (2014-05-06 13:06:32 +0100) > > are available in the git repository at: > > > git://xenbits.xen.org/people/sstabellini/qemu-dm.git xen-140507 > > for you to fetch changes up to 6a16be0810eccd3aede1ef592c3c1b64430b3280: > > xen_disk: add discard support (2014-05-07 14:56:54 +0000) Hi; I'm afraid I get merge conflicts when I pull this: From git://xenbits.xen.org/people/sstabellini/qemu-dm * [new branch] xen-140507 -> sstabellini/xen-140507 merging... Auto-merging xen-hvm.c CONFLICT (content): Merge conflict in xen-hvm.c Auto-merging xen-hvm-stub.c CONFLICT (content): Merge conflict in xen-hvm-stub.c Automatic merge failed; fix conflicts and then commit the result. It looks like they're pretty trivial, but since this pull involves file renames and I have no way to test Xen, I'd appreciate it if you could reroll the pull request. thanks -- PMM
On Wed, 7 May 2014, Peter Maydell wrote: > On 7 May 2014 16:09, Stefano Stabellini > <stefano.stabellini@eu.citrix.com> wrote: > > The following changes since commit 951916d02c59cd0eddd57c3d66f87f921931e394: > > > > Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-6' into staging (2014-05-06 13:06:32 +0100) > > > > are available in the git repository at: > > > > > > git://xenbits.xen.org/people/sstabellini/qemu-dm.git xen-140507 > > > > for you to fetch changes up to 6a16be0810eccd3aede1ef592c3c1b64430b3280: > > > > xen_disk: add discard support (2014-05-07 14:56:54 +0000) > > Hi; I'm afraid I get merge conflicts when I pull this: > >From git://xenbits.xen.org/people/sstabellini/qemu-dm > * [new branch] xen-140507 -> sstabellini/xen-140507 > merging... > Auto-merging xen-hvm.c > CONFLICT (content): Merge conflict in xen-hvm.c > Auto-merging xen-hvm-stub.c > CONFLICT (content): Merge conflict in xen-hvm-stub.c > Automatic merge failed; fix conflicts and then commit the result. > > It looks like they're pretty trivial, but since this pull involves > file renames and I have no way to test Xen, I'd appreciate > it if you could reroll the pull request. Sure