Re: [linux-next:master] [x86/module] 6661cae1aa: WARNING:at_arch/x86/mm/pat/set_memory.c:#__cpa_process_fault

From: Mike Rapoport
Date: Sun Oct 13 2024 - 04:21:42 EST


On Fri, Oct 11, 2024 at 09:30:33AM -0700, Dave Hansen wrote:
> On 10/11/24 08:40, Mike Rapoport wrote:
> > On Fri, Oct 11, 2024 at 07:00:01AM -0700, Dave Hansen wrote:
> >> On 10/11/24 06:08, Mike Rapoport wrote:
> >>> This patch disables ROX caches on 32-bit, it should fix the issue.
> >> While I'm not going to shed a tear for 32-bit, what's the actual
> >> compatibility issue with 32-bit?
> > From the stack trace it looks like execmem tries to update the direct map
> > for highmem memory, and cpa is not happy about it.
>
> First of all, if it's a highmem problem, shouldn't the check be for
> CONFIG_HIGHMEM and not on 32-bit vs. 64-bit? We do have non-highmem
> 32-bit configs.

32 bit also does not have ARCH_HUGE_VMALLOC and execmem cache will be
anyway populated with 4k pages, so I don't see why it would be useful on 32
bit all.

> Also, where did the highmem come from? All of the execmem allocations
> look like they're some variant of PAGE_KERNEL, but no __GFP_HIGHMEM.

Despite that execmem allocations are PAGE_KERNEL, __vmalloc_area_node()
implicitly adds __GFP_HIGHMEM for !DMA allocations.

cpa->vaddr = 0 here:

[ 8.161035][ T98] CPA: called for zero pte. vaddr = 0 cpa->vaddr = 0

means that page_address() returned NULL which can happen only for highmem
pages.

set_direct_map_valid_noflush()
__set_pages_np()
unsigned long tempaddr = (unsigned long) page_address(page);
struct cpa_data cpa = { .vaddr = &tempaddr,
...

__change_page_attr_set_clr(&cpa, 1);


--
Sincerely yours,
Mike.