[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241210184610.2080727-1-kevin.brodsky@arm.com>
Date: Tue, 10 Dec 2024 18:46:06 +0000
From: Kevin Brodsky <kevin.brodsky@....com>
To: x86@...nel.org
Cc: linux-kernel@...r.kernel.org,
Kevin Brodsky <kevin.brodsky@....com>,
bp@...en8.de,
dan.j.williams@...el.com,
dave.hansen@...ux.intel.com,
david@...hat.com,
jane.chu@...cle.com,
osalvador@...e.de,
tglx@...utronix.de
Subject: [PATCH 0/4] Remove problematic include in <asm/set_memory.h>
The need for this series arose from a completely unrelated series [1].
Long story short, that series causes <linux/mm.h> to include
<linux/set_memory.h>, which doesn't feel too unreasonable.
That works fine on arm64 and probably most other architectures, but not
on x86 [2]: <asm/set_memory.h> itself includes <linux/mm.h>, creating a
circular dependency.
set_memory.h doesn't really need <linux/mm.h>, so removing that include
seems like the right thing to do. That turned out to be a little more
involved than expected, hence this series:
* Patch 1-2 ensure that code doesn't rely on <asm/set_memory.h>
including <linux/mm.h>. The errors that these patches fix are included
at the end of this email.
* Patch 3 removes an unused function whose declaration relied on
<linux/mm.h> being included.
* Patch 4 actually remove the include.
I've build-tested this series with x86_64_defconfig and allyesconfig.
- Kevin
[1] https://lore.kernel.org/linux-hardening/20241206101110.1646108-1-kevin.brodsky@arm.com/
[2] https://lore.kernel.org/oe-kbuild-all/202412062006.C23V9ESs-lkp@intel.com/
Cc: bp@...en8.de
Cc: dan.j.williams@...el.com
Cc: dave.hansen@...ux.intel.com
Cc: david@...hat.com
Cc: jane.chu@...cle.com
Cc: osalvador@...e.de
Cc: tglx@...utronix.de
---
Build errors caused by patch 4 and fixed by patch 1-2:
CC drivers/gpu/drm/i915/gt/intel_ggtt.o
In file included from arch/x86/include/asm/smp.h:9,
from drivers/gpu/drm/i915/gt/intel_ggtt.c:7:
arch/x86/include/asm/thread_info.h: In function 'arch_within_stack_frames':
arch/x86/include/asm/thread_info.h:212:16: error: 'NOT_STACK' undeclared (first use in this function)
212 | return NOT_STACK;
| ^~~~~~~~~
arch/x86/include/asm/thread_info.h:212:16: note: each undeclared identifier is reported only once for each function it appears in
CC drivers/virt/coco/sev-guest/sev-guest.o
drivers/virt/coco/sev-guest/sev-guest.c: In function 'free_shared_pages':
drivers/virt/coco/sev-guest/sev-guest.c:621:31: error: implicit declaration of function 'PAGE_ALIGN'; did you mean 'PFN_ALIGN'? [-Wimplicit-function-declaration]
621 | unsigned int npages = PAGE_ALIGN(sz) >> PAGE_SHIFT;
| ^~~~~~~~~~
| PFN_ALIGN
CC drivers/infiniband/hw/mlx5/ib_rep.o
drivers/virt/coco/sev-guest/sev-guest.c: In function 'alloc_shared_pages':
drivers/virt/coco/sev-guest/sev-guest.c:646:51: error: implicit declaration of function 'page_address'; did you mean 'pbe_address'? [-Wimplicit-function-declaration]
646 | ret = set_memory_decrypted((unsigned long)page_address(page), npages);
| ^~~~~~~~~~~~
| pbe_address
drivers/virt/coco/sev-guest/sev-guest.c:653:16: error: returning 'int' from a function with return type 'void *' makes pointer from integer without a cast [-Wint-conversion]
653 | return page_address(page);
| ^~~~~~~~~~~~~~~~~~
---
Kevin Brodsky (4):
x86/smp: Explicitly include <linux/thread_info.h>
x86/sev: Explicitly include <linux/mm.h>
x86/mm: Remove unused __set_memory_prot()
x86/mm: Remove unnecessary include in set_memory.h
arch/x86/include/asm/set_memory.h | 2 --
arch/x86/include/asm/smp.h | 2 +-
arch/x86/mm/pat/set_memory.c | 13 -------------
drivers/virt/coco/sev-guest/sev-guest.c | 1 +
4 files changed, 2 insertions(+), 16 deletions(-)
base-commit: fac04efc5c793dccbd07e2d59af9f90b7fc0dca4
--
2.47.0
Powered by blists - more mailing lists