All of lore.kernel.org
 help / color / mirror / Atom feed
* Accelerated read from WC mem (i915_memcpy_from_wc()) may not work in virtualization world
@ 2017-12-21  9:52 Du, Changbin
  2017-12-21 10:56 ` Chris Wilson
  2017-12-21 10:58 ` Chris Wilson
  0 siblings, 2 replies; 5+ messages in thread
From: Du, Changbin @ 2017-12-21  9:52 UTC (permalink / raw)
  To: chris; +Cc: Intel-gfx

Hi Chris,
Our QA reported a problem caused by movntdqa instructions. Currently, the KVM
hypervisor doesn't support VEX-prefix instructions emulation. If users passthrough
a GPU to guest with vfio option 'x-no-mmap=on', then all access to the BARs will
be trapped and emulated. The KVM hypervisor would raise an inertal error to qemu
which cause the guest killed. (Since 'movntdqa' ins is not supported.)

One possible solution is that disable this optimization at i915_memcpy_init_early.
This require us to identify the CPUID to check if it is running in guest mode.

What do you think? Thanks.

-- 
Thanks,
Changbin Du
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: Accelerated read from WC mem (i915_memcpy_from_wc()) may not work in virtualization world
  2017-12-21  9:52 Accelerated read from WC mem (i915_memcpy_from_wc()) may not work in virtualization world Du, Changbin
@ 2017-12-21 10:56 ` Chris Wilson
  2017-12-22  2:51   ` Du, Changbin
  2017-12-21 10:58 ` Chris Wilson
  1 sibling, 1 reply; 5+ messages in thread
From: Chris Wilson @ 2017-12-21 10:56 UTC (permalink / raw)
  To: Du, Changbin; +Cc: Intel-gfx

Quoting Du, Changbin (2017-12-21 09:52:16)
> Hi Chris,
> Our QA reported a problem caused by movntdqa instructions. Currently, the KVM
> hypervisor doesn't support VEX-prefix instructions emulation. If users passthrough
> a GPU to guest with vfio option 'x-no-mmap=on', then all access to the BARs will
> be trapped and emulated. The KVM hypervisor would raise an inertal error to qemu
> which cause the guest killed. (Since 'movntdqa' ins is not supported.)
> 
> One possible solution is that disable this optimization at i915_memcpy_init_early.
> This require us to identify the CPUID to check if it is running in guest mode.

Is this mode not detected by intel_vgpu_active() ?

If we need to disable movntdqa, we need to disable it. But not by
directly checking CPUID, it should be already decoded into a cpu feature
flag -- assuming we need more than intel_vgpu_active and possibly
rearranging the init order.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: Accelerated read from WC mem (i915_memcpy_from_wc()) may not work in virtualization world
  2017-12-21  9:52 Accelerated read from WC mem (i915_memcpy_from_wc()) may not work in virtualization world Du, Changbin
  2017-12-21 10:56 ` Chris Wilson
@ 2017-12-21 10:58 ` Chris Wilson
  2017-12-22  2:26   ` Du, Changbin
  1 sibling, 1 reply; 5+ messages in thread
From: Chris Wilson @ 2017-12-21 10:58 UTC (permalink / raw)
  To: Du, Changbin; +Cc: Intel-gfx

Quoting Du, Changbin (2017-12-21 09:52:16)
> Hi Chris,
> Our QA reported a problem caused by movntdqa instructions. Currently, the KVM
> hypervisor doesn't support VEX-prefix instructions emulation. If users passthrough
> a GPU to guest with vfio option 'x-no-mmap=on', then all access to the BARs will
> be trapped and emulated. The KVM hypervisor would raise an inertal error to qemu
> which cause the guest killed. (Since 'movntdqa' ins is not supported.)
> 
> One possible solution is that disable this optimization at i915_memcpy_init_early.
> This require us to identify the CPUID to check if it is running in guest mode.

But do note we are already checking the CPUID/cpuflags for support; is
the hv not correcting them?
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: Accelerated read from WC mem (i915_memcpy_from_wc()) may not work in virtualization world
  2017-12-21 10:58 ` Chris Wilson
@ 2017-12-22  2:26   ` Du, Changbin
  0 siblings, 0 replies; 5+ messages in thread
From: Du, Changbin @ 2017-12-22  2:26 UTC (permalink / raw)
  To: Chris Wilson; +Cc: Intel-gfx

On Thu, Dec 21, 2017 at 10:58:38AM +0000, Chris Wilson wrote:
> Quoting Du, Changbin (2017-12-21 09:52:16)
> > Hi Chris,
> > Our QA reported a problem caused by movntdqa instructions. Currently, the KVM
> > hypervisor doesn't support VEX-prefix instructions emulation. If users passthrough
> > a GPU to guest with vfio option 'x-no-mmap=on', then all access to the BARs will
> > be trapped and emulated. The KVM hypervisor would raise an inertal error to qemu
> > which cause the guest killed. (Since 'movntdqa' ins is not supported.)
> > 
> > One possible solution is that disable this optimization at i915_memcpy_init_early.
> > This require us to identify the CPUID to check if it is running in guest mode.
> 
> But do note we are already checking the CPUID/cpuflags for support; is
> the hv not correcting them?
> -Chris

The CPU does support SSE, but just the KVM ins emulator doesn't. So it is not a
problem if the movntdqa runs on HW directly. But if it is emulated, then run
into failure.


-- 
Thanks,
Changbin Du
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: Accelerated read from WC mem (i915_memcpy_from_wc()) may not work in virtualization world
  2017-12-21 10:56 ` Chris Wilson
@ 2017-12-22  2:51   ` Du, Changbin
  0 siblings, 0 replies; 5+ messages in thread
From: Du, Changbin @ 2017-12-22  2:51 UTC (permalink / raw)
  To: Chris Wilson; +Cc: Intel-gfx

On Thu, Dec 21, 2017 at 10:56:38AM +0000, Chris Wilson wrote:
> Quoting Du, Changbin (2017-12-21 09:52:16)
> > Hi Chris,
> > Our QA reported a problem caused by movntdqa instructions. Currently, the KVM
> > hypervisor doesn't support VEX-prefix instructions emulation. If users passthrough
> > a GPU to guest with vfio option 'x-no-mmap=on', then all access to the BARs will
> > be trapped and emulated. The KVM hypervisor would raise an inertal error to qemu
> > which cause the guest killed. (Since 'movntdqa' ins is not supported.)
> > 
> > One possible solution is that disable this optimization at i915_memcpy_init_early.
> > This require us to identify the CPUID to check if it is running in guest mode.
> 
> Is this mode not detected by intel_vgpu_active() ?
>
Here intel_vgpu_active() is not ready to use. i915_memcpy_init_early is executed
before MMIO mapped.

> If we need to disable movntdqa, we need to disable it. But not by
> directly checking CPUID, it should be already decoded into a cpu feature
> flag -- assuming we need more than intel_vgpu_active and possibly
> rearranging the init order.
> -Chris

Yes, for Intel CPU, Bit 31 of ECX of CPUID leaf 0x1 is Hypervisor Present Bit.
So I will write a patch to disable it in hypervisor guest if you don't have
objections. Thanks.

-- 
Thanks,
Changbin Du
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2017-12-22  2:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-21  9:52 Accelerated read from WC mem (i915_memcpy_from_wc()) may not work in virtualization world Du, Changbin
2017-12-21 10:56 ` Chris Wilson
2017-12-22  2:51   ` Du, Changbin
2017-12-21 10:58 ` Chris Wilson
2017-12-22  2:26   ` Du, Changbin

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.