drm/i915: Do not enable movntdqa optimization in hypervisor guest
Subsystems (2)
PATCH 1/1 drm/i915: Do not enable movntdqa optimization in hypervisor guest
From: Changbin Du <[email protected]>
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.)
This patch try not to enable movntdqa optimization if the driver is running in hypervisor guest.
--- drivers/gpu/drm/i915/i915_memcpy.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_memcpy.c +6 -1
@@ -96,6 +96,11 @@ bool i915_memcpy_from_wc(void *dst, const void *src, unsigned long len)void i915_memcpy_init_early (struct drm_i915_private *dev_priv) { -if (static_cpu_has (X86_FEATURE_XMM4_1 )) +/** +* Some hypervisors (e.g. KVM) don't support VEX-prefix instructions +* emulation. So don't enable movntdqa in hypervisor guest. +*/ +if (static_cpu_has (X86_FEATURE_XMM4_1 ) && + !boot_cpu_has (X86_FEATURE_HYPERVISOR ))static_branch_enable (&has_movntdqa); }
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915: Do not enable movntdqa optimization in hypervisor guest
== Series Details ==
== Series Details ==
Series: drm/i915: Do not enable movntdqa optimization in hypervisor guest
URL : https://patchwork.freedesktop.org/series/35711/
State : success
== Summary ==
Series 35711v1 drm/i915: Do not enable movntdqa optimization in hypervisor guest
https://patchwork.freedesktop.org/api/1.0/series/35711/revisions/1/mbox/
Test debugfs_test:
Subgroup read_all_entries:
incomplete -> PASS (fi-snb-2520m) fdo#103713
Test gem_exec_suspend:
Subgroup basic-s4-devices:
dmesg-warn -> PASS (fi-elk-e7500) fdo#103989
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-b:
dmesg-warn -> PASS (fi-kbl-r) fdo#104172 +1
Test kms_psr_sink_crc:
Subgroup psr_basic:
pass -> DMESG-WARN (fi-skl-6700hq) fdo#101144fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#103989 https://bugs.freedesktop.org/show_bug.cgi?id=103989
fdo#104172 https://bugs.freedesktop.org/show_bug.cgi?id=104172
fdo#101144 https://bugs.freedesktop.org/show_bug.cgi?id=101144
fi-bdw-5557u total:288 pass:267 dwarn:0 dfail:0 fail:0 skip:21 time:438s fi-bdw-gvtdvm total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:436s fi-blb-e6850 total:288 pass:223 dwarn:1 dfail:0 fail:0 skip:64 time:383s fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:496s fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:277s fi-bxt-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:491s fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:502s fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:477s fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:463s fi-elk-e7500 total:224 pass:164 dwarn:14 dfail:0 fail:0 skip:45 fi-gdg-551 total:288 pass:179 dwarn:0 dfail:0 fail:1 skip:108 time:261s fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:529s fi-hsw-4770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:406s fi-hsw-4770r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:414s fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:468s fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:424s fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:483s fi-kbl-7560u total:288 pass:268 dwarn:1 dfail:0 fail:0 skip:19 time:520s fi-kbl-7567u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:467s fi-kbl-r total:288 pass:260 dwarn:1 dfail:0 fail:0 skip:27 time:519s fi-pnv-d510 total:288 pass:222 dwarn:1 dfail:0 fail:0 skip:65 time:581s fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:439s fi-skl-6600u total:288 pass:260 dwarn:1 dfail:0 fail:0 skip:27 time:529s fi-skl-6700hq total:288 pass:261 dwarn:1 dfail:0 fail:0 skip:26 time:552s fi-skl-6700k2 total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:508s fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:500s fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:445s fi-snb-2520m total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:546s fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:411s Blacklisted hosts: fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:593s fi-cnl-y total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:624s fi-glk-dsi total:288 pass:189 dwarn:1 dfail:4 fail:0 skip:94 time:404s
c0a64101df89fe312cb41d27e184555400d0e3b9 drm-tip: 2017y-12m-21d-18h-02m-56s UTC integration manifest af8be38582f2 drm/i915: Do not enable movntdqa optimization in hypervisor guest
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7562/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.IGT: warning for drm/i915: Do not enable movntdqa optimization in hypervisor guest
In reply to [email protected]== Series Details ==
== Series Details ==
Series: drm/i915: Do not enable movntdqa optimization in hypervisor guest
URL : https://patchwork.freedesktop.org/series/35711/
State : warning
== Summary ==
Test pm_rpm:
Subgroup system-suspend:
skip -> PASS (shard-hsw) fdo#103375
Subgroup system-suspend-modeset:
pass -> SKIP (shard-hsw)
Test gem_tiled_swapping:
Subgroup non-threaded:
pass -> INCOMPLETE (shard-snb) fdo#104218 +1
Test drv_suspend:
Subgroup fence-restore-tiled2untiled:
skip -> PASS (shard-snb)
Subgroup sysfs-reader:
skip -> PASS (shard-hsw)
Test gem_exec_suspend:
Subgroup basic-s3:
pass -> SKIP (shard-hsw) fdo#103540fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#104218 https://bugs.freedesktop.org/show_bug.cgi?id=104218
fdo#103540 https://bugs.freedesktop.org/show_bug.cgi?id=103540
shard-hsw total:2712 pass:1534 dwarn:1 dfail:0 fail:10 skip:1167 time:9395s shard-snb total:2640 pass:1283 dwarn:1 dfail:0 fail:10 skip:1345 time:7824s Blacklisted hosts: shard-apl total:2712 pass:1685 dwarn:1 dfail:0 fail:24 skip:1001 time:13756s shard-kbl total:2653 pass:1753 dwarn:10 dfail:1 fail:24 skip:864 time:10677s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7562/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting [email protected] (2017-12-22 06:31:49)
Quoted 22 lines
From: Changbin Du <[email protected]>
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.)
This patch try not to enable movntdqa optimization if the driver is running in hypervisor guest.
Signed-off-by Changbin Du <[email protected]>--- drivers/gpu/drm/i915/i915_memcpy.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_memcpy.c +0
-0
drivers/gpu/drm/i915/i915_memcpy.c bool i915_memcpy_from_wc(void *dst, const void *src, unsigned long len) · line 99
Quoted 5 lines
drivers/gpu/drm/i915/i915_memcpy.c +1
-1@@ -96,6 +96,11 @@ bool i915_memcpy_from_wc(void *dst, const void *src, unsigned long len)void i915_memcpy_init_early (struct drm_i915_private *dev_priv) { -if (static_cpu_has (X86_FEATURE_XMM4_1 )) +/**
This isn't a kerneldoc, so just /* for a regular comment.
drivers/gpu/drm/i915/i915_memcpy.c bool i915_memcpy_from_wc(void *dst, const void *src, unsigned long len) · line 105
Quoted 6 lines
drivers/gpu/drm/i915/i915_memcpy.c +5
-0+* Some hypervisors (e.g. KVM) don't support VEX-prefix instructions +* emulation. So don't enable movntdqa in hypervisor guest. +*/ +if (static_cpu_has (X86_FEATURE_XMM4_1 ) && + !boot_cpu_has (X86_FEATURE_HYPERVISOR ))static_branch_enable (&has_movntdqa);
Code checks out, and I believe you that some hypervisor setups may trap those instructions, so
We could try and jigger the init order about, but we do need this setup quite early so that we use the knowledge in other setup. Considering that, an explicit check for a hypervisor seems sensible. -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 24 lines · Chris Wilson
Quoting [email protected] (2017-12-22 06:31:49)
Quoted 23 lines
From: Changbin Du <[email protected]>
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.)
This patch try not to enable movntdqa optimization if the driver is running in hypervisor guest.
Signed-off-by Changbin Du <[email protected]>--- drivers/gpu/drm/i915/i915_memcpy.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_memcpy.c +0
-0@@ -96,6 +96,11 @@ bool i915_memcpy_from_wc(void *dst, const void *src, unsigned long len)
Quoted 7 lines
drivers/gpu/drm/i915/i915_memcpy.c bool i915_memcpy_from_wc(void *dst, const void *src, unsigned long len) · line 99
Quoted 4 lines
drivers/gpu/drm/i915/i915_memcpy.c +1
-1void i915_memcpy_init_early (struct drm_i915_private *dev_priv) { -if (static_cpu_has (X86_FEATURE_XMM4_1 )) +/** This isn't a kerneldoc, so just /* for a regular comment.
Thanks, will update.
Quoted 10 lines
drivers/gpu/drm/i915/i915_memcpy.c bool i915_memcpy_from_wc(void *dst, const void *src, unsigned long len) · line 105
Quoted 6 lines
drivers/gpu/drm/i915/i915_memcpy.c +5
-0+* Some hypervisors (e.g. KVM) don't support VEX-prefix instructions +* emulation. So don't enable movntdqa in hypervisor guest. +*/ +if (static_cpu_has (X86_FEATURE_XMM4_1 ) && + !boot_cpu_has (X86_FEATURE_HYPERVISOR ))static_branch_enable (&has_movntdqa);Code checks out, and I believe you that some hypervisor setups may trap those instructions, so
Quoted 6 lines
Reviewed-by Chris Wilson <[email protected]>We could try and jigger the init order about, but we do need this setup quite early so that we use the knowledge in other setup. Considering that, an explicit check for a hypervisor seems sensible. -Chris
And this check is not only for GVTg, but also for physical GPU passthrough. So it is beyong intel_vgpu_active().
Signature · 6 lines
Thanks, Changbin Du _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx