mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/4] Remove problematic include in <asm/set_memory.h>
@ 2024-12-10 18:46 Kevin Brodsky
  2024-12-10 18:46 ` [PATCH 1/4] x86/smp: Explicitly include <linux/thread_info.h> Kevin Brodsky
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Kevin Brodsky @ 2024-12-10 18:46 UTC (permalink / raw)
  To: x86
  Cc: linux-kernel, Kevin Brodsky, bp, dan.j.williams, dave.hansen,
	david, jane.chu, osalvador, tglx

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@alien8.de
Cc: dan.j.williams@intel.com
Cc: dave.hansen@linux.intel.com
Cc: david@redhat.com
Cc: jane.chu@oracle.com
Cc: osalvador@suse.de
Cc: tglx@linutronix.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


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

end of thread, other threads:[~2024-12-12  5:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-10 18:46 [PATCH 0/4] Remove problematic include in <asm/set_memory.h> Kevin Brodsky
2024-12-10 18:46 ` [PATCH 1/4] x86/smp: Explicitly include <linux/thread_info.h> Kevin Brodsky
2024-12-10 21:36   ` Borislav Petkov
2024-12-11  8:06     ` Kevin Brodsky
2024-12-10 18:46 ` [PATCH 2/4] x86/sev: Explicitly include <linux/mm.h> Kevin Brodsky
2024-12-10 18:46 ` [PATCH 3/4] x86/mm: Remove unused __set_memory_prot() Kevin Brodsky
2024-12-10 18:46 ` [PATCH 4/4] x86/mm: Remove unnecessary include in set_memory.h Kevin Brodsky
2024-12-10 19:57 ` [PATCH 0/4] Remove problematic include in <asm/set_memory.h> David Hildenbrand
2024-12-11  5:04 ` Christoph Hellwig
2024-12-11  8:14   ` Kevin Brodsky
2024-12-12  5:46     ` Christoph Hellwig

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®