linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Kevin Brodsky <kevin.brodsky@arm.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org, bp@alien8.de,
	dan.j.williams@intel.com, dave.hansen@linux.intel.com,
	david@redhat.com, jane.chu@oracle.com, osalvador@suse.de,
	tglx@linutronix.de
Subject: Re: [PATCH v2 2/2] x86/mm: Remove unnecessary include in set_memory.h
Date: Thu, 27 Feb 2025 14:02:10 +0100	[thread overview]
Message-ID: <Z8BiUnkPnvrx06vp@gmail.com> (raw)
In-Reply-To: <20241212080904.2089632-3-kevin.brodsky@arm.com>


* Kevin Brodsky <kevin.brodsky@arm.com> wrote:

> Commit 03b122da74b2 ("x86/sgx: Hook arch_memory_failure() into
> mainline code") included <linux/mm.h> in asm/set_memory.h to provide
> some helper. However commit b3fdf9398a16 ("x86/mce: relocate
> set{clear}_mce_nospec() functions") moved the inline definitions
> someplace else, and now set_memory.h just declares a bunch of
> functions.
> 
> No need for the whole linux/mm.h for declaring functions; just
> remove that include. This helps avoid circular dependency headaches
> (e.g. if linux/mm.h ends up including <linux/set_memory.h>).
> 
> This change requires a couple of include fixups not to break the
> build:
> 
> * asm/smp.h: including <asm/thread_info.h> directly relies on
>   <linux/thread_info.h> having already been included, because the
>   former needs the BAD_STACK/NOT_STACK constants defined in the
>   latter. This is no longer the case when asm/smp.h is included from
>   some driver file - just include <linux/thread_info.h> to stay out
>   of trouble.
> 
> * sev-guest.c relies on <asm/set_memory.h> including <linux/mm.h>,
>   so we just need to make that include explicit.
> 
> Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
> ---
>  arch/x86/include/asm/set_memory.h       | 1 -
>  arch/x86/include/asm/smp.h              | 2 +-
>  drivers/virt/coco/sev-guest/sev-guest.c | 1 +
>  3 files changed, 2 insertions(+), 2 deletions(-)

So I tried to pick up this patch belatedly, but there's more places 
that mistakenly learned to rely on the stray <linux/mm.h> inclusion, 
for example on x86 defconfig-ish kernels:


  In file included from drivers/gpu/drm/i915/gt/intel_ggtt.c:6:
  ./arch/x86/include/asm/set_memory.h:40:57: error: unknown type name ‘pgprot_t’
  40 | int __set_memory_prot(unsigned long addr, int numpages, pgprot_t prot);
  |                                                         ^~~~~~~~

Thanks,

	Ingo

  reply	other threads:[~2025-02-27 13:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-12  8:09 [PATCH v2 0/2] Remove problematic include in <asm/set_memory.h> Kevin Brodsky
2024-12-12  8:09 ` [PATCH v2 1/2] x86/mm: Remove unused __set_memory_prot() Kevin Brodsky
2025-02-28 17:03   ` [tip: x86/headers] " tip-bot2 for Kevin Brodsky
2024-12-12  8:09 ` [PATCH v2 2/2] x86/mm: Remove unnecessary include in set_memory.h Kevin Brodsky
2025-02-27 13:02   ` Ingo Molnar [this message]
2025-02-27 13:03     ` Ingo Molnar
2025-02-28 10:56       ` Kevin Brodsky
2025-02-28 17:14         ` Ingo Molnar
2025-02-28 17:43           ` Kevin Brodsky
2025-02-28 17:03   ` [tip: x86/headers] x86/mm: Reduce header dependencies in <asm/set_memory.h> tip-bot2 for Kevin Brodsky
2024-12-20 10:28 ` [PATCH v2 0/2] Remove problematic include " David Hildenbrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z8BiUnkPnvrx06vp@gmail.com \
    --to=mingo@kernel.org \
    --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=kevin.brodsky@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=osalvador@suse.de \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).