All of lore.kernel.org
 help / color / mirror / Atom feed
* i915 and PAT attributes on Xen PV
@ 2022-12-08 13:55 ` Marek Marczykowski-Górecki
  0 siblings, 0 replies; 18+ messages in thread
From: Marek Marczykowski-Górecki @ 2022-12-08 13:55 UTC (permalink / raw)
  To: intel-gfx
  Cc: xen-devel, Demi M. Obenour, Jani Nikula, Joonas Lahtinen,
	Rodrigo Vivi, Tvrtko Ursulin, Matt Roper, Lucas De Marchi,
	José Roberto de Souza

[-- Attachment #1: Type: text/plain, Size: 2242 bytes --]

Hi,

There is an issue with i915 on Xen PV (dom0). The end result is a lot of
glitches, like here: https://openqa.qubes-os.org/tests/54748#step/startup/8
(this one is on ADL, Linux 6.1-rc7 as a Xen PV dom0). It's using Xorg
with "modesetting" driver.

After some iterations of debugging, we narrowed it down to i915 handling
caching. The main difference is that PAT is setup differently on Xen PV
than on native Linux. Normally, Linux does have appropriate abstraction
for that, but apparently something related to i915 doesn't play well
with it. The specific difference is:
native linux:
x86/PAT: Configuration [0-7]: WB  WC  UC- UC  WB  WP  UC- WT
xen pv:
x86/PAT: Configuration [0-7]: WB  WT  UC- UC  WC  WP  UC  UC
                                  ~~          ~~      ~~  ~~

The specific impact depends on kernel version and the hardware. The most
severe issues I see on >=ADL, but some older hardware is affected too -
sometimes only if composition is disabled in the window manager.
Some more information is collected at
https://github.com/QubesOS/qubes-issues/issues/4782 (and few linked
duplicates...).

Kind-of related commit is here:
https://github.com/torvalds/linux/commit/bdd8b6c98239cad ("drm/i915:
replace X86_FEATURE_PAT with pat_enabled()") - it is the place where
i915 explicitly checks for PAT support, so I'm cc-ing people mentioned
there too.

Any ideas?

The issue can be easily reproduced without Xen too, by adjusting PAT in
Linux:
-----8<-----
diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c
index 66a209f7eb86..319ab60c8d8c 100644
--- a/arch/x86/mm/pat/memtype.c
+++ b/arch/x86/mm/pat/memtype.c
@@ -400,8 +400,8 @@ void pat_init(void)
 		 * The reserved slots are unused, but mapped to their
 		 * corresponding types in the presence of PAT errata.
 		 */
-		pat = PAT(0, WB) | PAT(1, WC) | PAT(2, UC_MINUS) | PAT(3, UC) |
-		      PAT(4, WB) | PAT(5, WP) | PAT(6, UC_MINUS) | PAT(7, WT);
+		pat = PAT(0, WB) | PAT(1, WT) | PAT(2, UC_MINUS) | PAT(3, UC) |
+		      PAT(4, WC) | PAT(5, WP) | PAT(6, UC)       | PAT(7, UC);
 	}
 
 	if (!pat_bp_initialized) {
-----8<-----

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2023-01-03 11:59 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-08 13:55 i915 and PAT attributes on Xen PV Marek Marczykowski-Górecki
2022-12-08 13:55 ` [Intel-gfx] " Marek Marczykowski-Górecki
2022-12-08 16:24 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2022-12-08 16:51 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2022-12-16 15:30 ` [cache coherency bug] i915 and PAT attributes Andrew Cooper
2022-12-16 15:30   ` [Intel-gfx] " Andrew Cooper
2022-12-22  8:29   ` Ville Syrjälä
2022-12-22  8:29     ` Ville Syrjälä
2023-01-01 23:24     ` Marek Marczykowski-Górecki
2023-01-02  0:03       ` Demi Marie Obenour
2023-01-02  1:00         ` Marek Marczykowski-Górecki
2023-01-02  1:00           ` Marek Marczykowski-Górecki
2023-01-02  1:17           ` Demi Marie Obenour
2023-01-02  1:17             ` Demi Marie Obenour
2023-01-02  1:48             ` Demi Marie Obenour
2023-01-02  1:48               ` Demi Marie Obenour
2023-01-02  1:58               ` [Intel-gfx] [cache coherency bug] [hw bug?] " Marek Marczykowski-Górecki
2023-01-02  1:58                 ` Marek Marczykowski-Górecki

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.