mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] x86/mm/pat: HIGHMEM pages in set_pages_array_*()
@ 2026-11-17  9:49 Christian
  2026-11-17  9:49 ` [PATCH 1/2] x86/mm/pat: skip HIGHMEM pages in a page array Christian
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christian @ 2026-11-17  9:49 UTC (permalink / raw)
  To: Dave Hansen, Andy Lutomirski, Peter Zijlstra, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86
  Cc: H. Peter Anvin, linux-kernel

On i386 without PAE nearly all memory is HIGHMEM, and a DRM driver that
keeps its shmem buffers there (drm_gem_shmem_get_pages_locked() ->
set_pages_array_wc()) hits two problems in the page-array CPA paths:

1. The CPA walk takes __cpa_addr()'s 0 for a HIGHMEM page as a virtual
   address and oopses in __cpa_process_fault()'s warning path, with the
   CPA lock held, so every later CPA user hangs.

2. _set_pages_array() and set_pages_array_wb() skip HIGHMEM pages when
   they reserve and free the memory type, so a write-combined user mapping
   of such a page is left write-back by PAT. A device that does not snoop
   the CPU's caches then reads stale data.

Patch 1 skips HIGHMEM pages in the CPA walk, as there is nothing there for
it to change. Patch 2 reserves and frees their memory type like any other
page's.

Found and tested on an HP ElitePad 900 G1 (Atom Z2760, Clover Trail, i386
without PAE, 2 GB) running an out-of-tree PowerVR SGX545 DRM driver with
its buffers in HIGHMEM. Before: an oops in set_pages_array_wc() on the
first buffer and an unreachable machine (patch 1), then continuous GPU page
faults and firmware resets until the GPU wedged (patch 2). With both: no
GPU faults or kernel warnings through the driver's uAPI tests (50/50), 100
rendered frames checked against a reference, glmark2 and video playback.
Written and tested on 7.3.4; this series is rebased on v7.4-rc3, where it
builds for i386.

Christian (2):
  x86/mm/pat: skip HIGHMEM pages in a page array
  x86/mm/pat: track the memory type of HIGHMEM pages in a page array

 arch/x86/mm/pat/set_memory.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

-- 
2.47.3

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

end of thread, other threads:[~2026-11-19 19:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-17  9:49 [PATCH 0/2] x86/mm/pat: HIGHMEM pages in set_pages_array_*() Christian
2026-11-17  9:49 ` [PATCH 1/2] x86/mm/pat: skip HIGHMEM pages in a page array Christian
2026-11-17  9:49 ` [PATCH 2/2] x86/mm/pat: track the memory type of " Christian
2026-11-19 19:45 ` [PATCH 0/2] x86/mm/pat: HIGHMEM pages in set_pages_array_*() Dave Hansen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®