* [PATCH v2 0/2] Remove problematic include in <asm/set_memory.h>
@ 2024-12-12 8:09 Kevin Brodsky
2024-12-12 8:09 ` [PATCH v2 1/2] x86/mm: Remove unused __set_memory_prot() Kevin Brodsky
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Kevin Brodsky @ 2024-12-12 8:09 UTC (permalink / raw)
To: x86
Cc: linux-kernel, Kevin Brodsky, bp, dan.j.williams, dave.hansen,
david, jane.chu, osalvador, tglx
This series removes an unnecessary and potentially problematic include
of <linux/mm.h> in <asm/set_memory.h>. There is no functional difference
in v2 compared to v1.
v1..v2:
* Squashed include fixups into the last patch removing the include from
<asm/set_memory.h>. [Borislav's suggestion]
* Moved new include in <asm/smp.h>. [Borislav's suggestion]
v1: https://lore.kernel.org/all/20241210184610.2080727-1-kevin.brodsky@arm.com/
- Kevin
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
---
Kevin Brodsky (2):
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
* [PATCH v2 1/2] x86/mm: Remove unused __set_memory_prot()
2024-12-12 8:09 [PATCH v2 0/2] Remove problematic include in <asm/set_memory.h> Kevin Brodsky
@ 2024-12-12 8:09 ` 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
2024-12-20 10:28 ` [PATCH v2 0/2] Remove problematic include " David Hildenbrand
2 siblings, 1 reply; 11+ messages in thread
From: Kevin Brodsky @ 2024-12-12 8:09 UTC (permalink / raw)
To: x86
Cc: linux-kernel, Kevin Brodsky, bp, dan.j.williams, dave.hansen,
david, jane.chu, osalvador, tglx
__set_memory_prot() is unused since commit 5c11f00b09c1 ("x86:
remove memory hotplug support on X86_32"). Let's remove it.
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
---
arch/x86/include/asm/set_memory.h | 1 -
arch/x86/mm/pat/set_memory.c | 13 -------------
2 files changed, 14 deletions(-)
diff --git a/arch/x86/include/asm/set_memory.h b/arch/x86/include/asm/set_memory.h
index cc62ef70ccc0..6586d533fe3a 100644
--- a/arch/x86/include/asm/set_memory.h
+++ b/arch/x86/include/asm/set_memory.h
@@ -38,7 +38,6 @@ int set_memory_rox(unsigned long addr, int numpages);
* The caller is required to take care of these.
*/
-int __set_memory_prot(unsigned long addr, int numpages, pgprot_t prot);
int _set_memory_uc(unsigned long addr, int numpages);
int _set_memory_wc(unsigned long addr, int numpages);
int _set_memory_wt(unsigned long addr, int numpages);
diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c
index 95bc50a8541c..2dc1145cfdb8 100644
--- a/arch/x86/mm/pat/set_memory.c
+++ b/arch/x86/mm/pat/set_memory.c
@@ -1944,19 +1944,6 @@ static inline int cpa_clear_pages_array(struct page **pages, int numpages,
CPA_PAGES_ARRAY, pages);
}
-/*
- * __set_memory_prot is an internal helper for callers that have been passed
- * a pgprot_t value from upper layers and a reservation has already been taken.
- * If you want to set the pgprot to a specific page protocol, use the
- * set_memory_xx() functions.
- */
-int __set_memory_prot(unsigned long addr, int numpages, pgprot_t prot)
-{
- return change_page_attr_set_clr(&addr, numpages, prot,
- __pgprot(~pgprot_val(prot)), 0, 0,
- NULL);
-}
-
int _set_memory_uc(unsigned long addr, int numpages)
{
/*
--
2.47.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 2/2] x86/mm: Remove unnecessary include in set_memory.h
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
@ 2024-12-12 8:09 ` Kevin Brodsky
2025-02-27 13:02 ` Ingo Molnar
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
2 siblings, 2 replies; 11+ messages in thread
From: Kevin Brodsky @ 2024-12-12 8:09 UTC (permalink / raw)
To: x86
Cc: linux-kernel, Kevin Brodsky, bp, dan.j.williams, dave.hansen,
david, jane.chu, osalvador, tglx
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(-)
diff --git a/arch/x86/include/asm/set_memory.h b/arch/x86/include/asm/set_memory.h
index 6586d533fe3a..8d9f1c9aaa4c 100644
--- a/arch/x86/include/asm/set_memory.h
+++ b/arch/x86/include/asm/set_memory.h
@@ -2,7 +2,6 @@
#ifndef _ASM_X86_SET_MEMORY_H
#define _ASM_X86_SET_MEMORY_H
-#include <linux/mm.h>
#include <asm/page.h>
#include <asm-generic/set_memory.h>
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index ca073f40698f..2ca1da5f16d9 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -3,10 +3,10 @@
#define _ASM_X86_SMP_H
#ifndef __ASSEMBLY__
#include <linux/cpumask.h>
+#include <linux/thread_info.h>
#include <asm/cpumask.h>
#include <asm/current.h>
-#include <asm/thread_info.h>
DECLARE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_sibling_map);
DECLARE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_core_map);
diff --git a/drivers/virt/coco/sev-guest/sev-guest.c b/drivers/virt/coco/sev-guest/sev-guest.c
index b699771be029..e134bee818fa 100644
--- a/drivers/virt/coco/sev-guest/sev-guest.c
+++ b/drivers/virt/coco/sev-guest/sev-guest.c
@@ -23,6 +23,7 @@
#include <linux/cleanup.h>
#include <linux/uuid.h>
#include <linux/configfs.h>
+#include <linux/mm.h>
#include <uapi/linux/sev-guest.h>
#include <uapi/linux/psp-sev.h>
--
2.47.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2 0/2] Remove problematic include in <asm/set_memory.h>
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
2024-12-12 8:09 ` [PATCH v2 2/2] x86/mm: Remove unnecessary include in set_memory.h Kevin Brodsky
@ 2024-12-20 10:28 ` David Hildenbrand
2 siblings, 0 replies; 11+ messages in thread
From: David Hildenbrand @ 2024-12-20 10:28 UTC (permalink / raw)
To: Kevin Brodsky, x86
Cc: linux-kernel, bp, dan.j.williams, dave.hansen, jane.chu,
osalvador, tglx
On 12.12.24 09:09, Kevin Brodsky wrote:
> This series removes an unnecessary and potentially problematic include
> of <linux/mm.h> in <asm/set_memory.h>. There is no functional difference
> in v2 compared to v1.
>
> v1..v2:
> * Squashed include fixups into the last patch removing the include from
> <asm/set_memory.h>. [Borislav's suggestion]
> * Moved new include in <asm/smp.h>. [Borislav's suggestion]
>
> v1: https://lore.kernel.org/all/20241210184610.2080727-1-kevin.brodsky@arm.com/
>
LGTM
Acked-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/2] x86/mm: Remove unnecessary include in set_memory.h
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
2025-02-27 13:03 ` Ingo Molnar
2025-02-28 17:03 ` [tip: x86/headers] x86/mm: Reduce header dependencies in <asm/set_memory.h> tip-bot2 for Kevin Brodsky
1 sibling, 1 reply; 11+ messages in thread
From: Ingo Molnar @ 2025-02-27 13:02 UTC (permalink / raw)
To: Kevin Brodsky
Cc: x86, linux-kernel, bp, dan.j.williams, dave.hansen, david,
jane.chu, osalvador, tglx
* 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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/2] x86/mm: Remove unnecessary include in set_memory.h
2025-02-27 13:02 ` Ingo Molnar
@ 2025-02-27 13:03 ` Ingo Molnar
2025-02-28 10:56 ` Kevin Brodsky
0 siblings, 1 reply; 11+ messages in thread
From: Ingo Molnar @ 2025-02-27 13:03 UTC (permalink / raw)
To: Kevin Brodsky
Cc: x86, linux-kernel, bp, dan.j.williams, dave.hansen, david,
jane.chu, osalvador, tglx
* Ingo Molnar <mingo@kernel.org> wrote:
> 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);
> | ^~~~~~~~
BTW., I did a few touchups to the changelog (see below) - mind picking
that up once you submit -v2?
Thanks,
Ingo
======================>
From: Kevin Brodsky <kevin.brodsky@arm.com>
Date: Thu, 12 Dec 2024 08:09:04 +0000
Subject: [PATCH] x86/mm: Reduce header dependencies in <asm/set_memory.h>
Commit:
03b122da74b2 ("x86/sgx: Hook arch_memory_failure() into mainline code")
... added <linux/mm.h> to <asm/set_memory.h> to provide some helpers.
However the following commit:
b3fdf9398a16 ("x86/mce: relocate set{clear}_mce_nospec() functions")
... moved the inline definitions someplace else, and now <asm/set_memory.h>
just declares a bunch of mostly self-contained functions.
No need for the whole <linux/mm.h> inclusion to declare 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.
[ mingo: Cleaned up the changelog ]
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: David Hildenbrand <david@redhat.com>
Link: https://lore.kernel.org/r/20241212080904.2089632-3-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(-)
diff --git a/arch/x86/include/asm/set_memory.h b/arch/x86/include/asm/set_memory.h
index cc62ef70ccc0..023994fe6115 100644
--- a/arch/x86/include/asm/set_memory.h
+++ b/arch/x86/include/asm/set_memory.h
@@ -2,7 +2,6 @@
#ifndef _ASM_X86_SET_MEMORY_H
#define _ASM_X86_SET_MEMORY_H
-#include <linux/mm.h>
#include <asm/page.h>
#include <asm-generic/set_memory.h>
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index ca073f40698f..2ca1da5f16d9 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -3,10 +3,10 @@
#define _ASM_X86_SMP_H
#ifndef __ASSEMBLY__
#include <linux/cpumask.h>
+#include <linux/thread_info.h>
#include <asm/cpumask.h>
#include <asm/current.h>
-#include <asm/thread_info.h>
DECLARE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_sibling_map);
DECLARE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_core_map);
diff --git a/drivers/virt/coco/sev-guest/sev-guest.c b/drivers/virt/coco/sev-guest/sev-guest.c
index 264b6523fe52..ddec5677e247 100644
--- a/drivers/virt/coco/sev-guest/sev-guest.c
+++ b/drivers/virt/coco/sev-guest/sev-guest.c
@@ -23,6 +23,7 @@
#include <linux/cleanup.h>
#include <linux/uuid.h>
#include <linux/configfs.h>
+#include <linux/mm.h>
#include <uapi/linux/sev-guest.h>
#include <uapi/linux/psp-sev.h>
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/2] x86/mm: Remove unnecessary include in set_memory.h
2025-02-27 13:03 ` Ingo Molnar
@ 2025-02-28 10:56 ` Kevin Brodsky
2025-02-28 17:14 ` Ingo Molnar
0 siblings, 1 reply; 11+ messages in thread
From: Kevin Brodsky @ 2025-02-28 10:56 UTC (permalink / raw)
To: Ingo Molnar
Cc: x86, linux-kernel, bp, dan.j.williams, dave.hansen, david,
jane.chu, osalvador, tglx
On 27/02/2025 14:03, Ingo Molnar wrote:
> * Ingo Molnar <mingo@kernel.org> wrote:
>
>> 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);
>> | ^~~~~~~~
This patch relies on patch 1 in this series, which removes
__set_memory_prot(). I seem to be able to build x86_64_defconfig without
issue with both patches applies on the latest mainline.
> BTW., I did a few touchups to the changelog (see below) - mind picking
> that up once you submit -v2?
Very happy with the touchups, thanks for having a look! Given my comment
above, I don't believe there is a need to post a v3 - feel free to amend
the commit message when applying the patches.
- Kevin
^ permalink raw reply [flat|nested] 11+ messages in thread
* [tip: x86/headers] x86/mm: Reduce header dependencies in <asm/set_memory.h>
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
@ 2025-02-28 17:03 ` tip-bot2 for Kevin Brodsky
1 sibling, 0 replies; 11+ messages in thread
From: tip-bot2 for Kevin Brodsky @ 2025-02-28 17:03 UTC (permalink / raw)
To: linux-tip-commits
Cc: Kevin Brodsky, Ingo Molnar, David Hildenbrand, x86, linux-kernel
The following commit has been merged into the x86/headers branch of tip:
Commit-ID: 95c4cc5a585400982ae5b3bf9e3be6de71768376
Gitweb: https://git.kernel.org/tip/95c4cc5a585400982ae5b3bf9e3be6de71768376
Author: Kevin Brodsky <kevin.brodsky@arm.com>
AuthorDate: Thu, 12 Dec 2024 08:09:04
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 28 Feb 2025 17:35:22 +01:00
x86/mm: Reduce header dependencies in <asm/set_memory.h>
Commit:
03b122da74b2 ("x86/sgx: Hook arch_memory_failure() into mainline code")
... added <linux/mm.h> to <asm/set_memory.h> to provide some helpers.
However the following commit:
b3fdf9398a16 ("x86/mce: relocate set{clear}_mce_nospec() functions")
... moved the inline definitions someplace else, and now <asm/set_memory.h>
just declares a bunch of mostly self-contained functions.
No need for the whole <linux/mm.h> inclusion to declare 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.
[ mingo: Cleaned up the changelog ]
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: David Hildenbrand <david@redhat.com>
Link: https://lore.kernel.org/r/20241212080904.2089632-3-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(-)
diff --git a/arch/x86/include/asm/set_memory.h b/arch/x86/include/asm/set_memory.h
index 6586d53..8d9f1c9 100644
--- a/arch/x86/include/asm/set_memory.h
+++ b/arch/x86/include/asm/set_memory.h
@@ -2,7 +2,6 @@
#ifndef _ASM_X86_SET_MEMORY_H
#define _ASM_X86_SET_MEMORY_H
-#include <linux/mm.h>
#include <asm/page.h>
#include <asm-generic/set_memory.h>
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index ca073f4..2ca1da5 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -3,10 +3,10 @@
#define _ASM_X86_SMP_H
#ifndef __ASSEMBLY__
#include <linux/cpumask.h>
+#include <linux/thread_info.h>
#include <asm/cpumask.h>
#include <asm/current.h>
-#include <asm/thread_info.h>
DECLARE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_sibling_map);
DECLARE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_core_map);
diff --git a/drivers/virt/coco/sev-guest/sev-guest.c b/drivers/virt/coco/sev-guest/sev-guest.c
index 264b652..ddec567 100644
--- a/drivers/virt/coco/sev-guest/sev-guest.c
+++ b/drivers/virt/coco/sev-guest/sev-guest.c
@@ -23,6 +23,7 @@
#include <linux/cleanup.h>
#include <linux/uuid.h>
#include <linux/configfs.h>
+#include <linux/mm.h>
#include <uapi/linux/sev-guest.h>
#include <uapi/linux/psp-sev.h>
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [tip: x86/headers] x86/mm: Remove unused __set_memory_prot()
2024-12-12 8:09 ` [PATCH v2 1/2] x86/mm: Remove unused __set_memory_prot() Kevin Brodsky
@ 2025-02-28 17:03 ` tip-bot2 for Kevin Brodsky
0 siblings, 0 replies; 11+ messages in thread
From: tip-bot2 for Kevin Brodsky @ 2025-02-28 17:03 UTC (permalink / raw)
To: linux-tip-commits
Cc: Kevin Brodsky, Ingo Molnar, David Hildenbrand, x86, linux-kernel
The following commit has been merged into the x86/headers branch of tip:
Commit-ID: 693bbf2a50447353c6a47961e6a7240a823ace02
Gitweb: https://git.kernel.org/tip/693bbf2a50447353c6a47961e6a7240a823ace02
Author: Kevin Brodsky <kevin.brodsky@arm.com>
AuthorDate: Thu, 12 Dec 2024 08:09:03
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 28 Feb 2025 17:35:14 +01:00
x86/mm: Remove unused __set_memory_prot()
__set_memory_prot() is unused since:
5c11f00b09c1 ("x86: remove memory hotplug support on X86_32")
Let's remove it.
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: David Hildenbrand <david@redhat.com>
Link: https://lore.kernel.org/r/20241212080904.2089632-2-kevin.brodsky@arm.com
---
arch/x86/include/asm/set_memory.h | 1 -
arch/x86/mm/pat/set_memory.c | 13 -------------
2 files changed, 14 deletions(-)
diff --git a/arch/x86/include/asm/set_memory.h b/arch/x86/include/asm/set_memory.h
index cc62ef7..6586d53 100644
--- a/arch/x86/include/asm/set_memory.h
+++ b/arch/x86/include/asm/set_memory.h
@@ -38,7 +38,6 @@ int set_memory_rox(unsigned long addr, int numpages);
* The caller is required to take care of these.
*/
-int __set_memory_prot(unsigned long addr, int numpages, pgprot_t prot);
int _set_memory_uc(unsigned long addr, int numpages);
int _set_memory_wc(unsigned long addr, int numpages);
int _set_memory_wt(unsigned long addr, int numpages);
diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c
index ef4514d..b289667 100644
--- a/arch/x86/mm/pat/set_memory.c
+++ b/arch/x86/mm/pat/set_memory.c
@@ -1942,19 +1942,6 @@ static inline int cpa_clear_pages_array(struct page **pages, int numpages,
CPA_PAGES_ARRAY, pages);
}
-/*
- * __set_memory_prot is an internal helper for callers that have been passed
- * a pgprot_t value from upper layers and a reservation has already been taken.
- * If you want to set the pgprot to a specific page protocol, use the
- * set_memory_xx() functions.
- */
-int __set_memory_prot(unsigned long addr, int numpages, pgprot_t prot)
-{
- return change_page_attr_set_clr(&addr, numpages, prot,
- __pgprot(~pgprot_val(prot)), 0, 0,
- NULL);
-}
-
int _set_memory_uc(unsigned long addr, int numpages)
{
/*
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/2] x86/mm: Remove unnecessary include in set_memory.h
2025-02-28 10:56 ` Kevin Brodsky
@ 2025-02-28 17:14 ` Ingo Molnar
2025-02-28 17:43 ` Kevin Brodsky
0 siblings, 1 reply; 11+ messages in thread
From: Ingo Molnar @ 2025-02-28 17:14 UTC (permalink / raw)
To: Kevin Brodsky
Cc: x86, linux-kernel, bp, dan.j.williams, dave.hansen, david,
jane.chu, osalvador, tglx
* Kevin Brodsky <kevin.brodsky@arm.com> wrote:
> On 27/02/2025 14:03, Ingo Molnar wrote:
> > * Ingo Molnar <mingo@kernel.org> wrote:
> >
> >> 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);
> >> | ^~~~~~~~
>
> This patch relies on patch 1 in this series, which removes
> __set_memory_prot(). I seem to be able to build x86_64_defconfig
> without issue with both patches applies on the latest mainline.
Oh, the 1/2 patch was missing from my mailbox (my mbox's fault, not yours),
and apparently the 'PATCH 2/2' tag wasn't a big enough of a clue for me
that there's a dependent patch. ;-)
Anyway, I re-tested it with both patches applied and it's all looking
good now, and I have applied them to tip:x86/headers.
Thanks,
Ingo
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/2] x86/mm: Remove unnecessary include in set_memory.h
2025-02-28 17:14 ` Ingo Molnar
@ 2025-02-28 17:43 ` Kevin Brodsky
0 siblings, 0 replies; 11+ messages in thread
From: Kevin Brodsky @ 2025-02-28 17:43 UTC (permalink / raw)
To: Ingo Molnar
Cc: x86, linux-kernel, bp, dan.j.williams, dave.hansen, david,
jane.chu, osalvador, tglx
On 28/02/2025 18:14, Ingo Molnar wrote:
> * Kevin Brodsky <kevin.brodsky@arm.com> wrote:
>
>> On 27/02/2025 14:03, Ingo Molnar wrote:
>>> * Ingo Molnar <mingo@kernel.org> wrote:
>>>
>>>> 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);
>>>> | ^~~~~~~~
>> This patch relies on patch 1 in this series, which removes
>> __set_memory_prot(). I seem to be able to build x86_64_defconfig
>> without issue with both patches applies on the latest mainline.
> Oh, the 1/2 patch was missing from my mailbox (my mbox's fault, not yours),
> and apparently the 'PATCH 2/2' tag wasn't a big enough of a clue for me
> that there's a dependent patch. ;-)
Ah that would explain it! Naughty mailbox eating patches :)
> Anyway, I re-tested it with both patches applied and it's all looking
> good now, and I have applied them to tip:x86/headers.
Great, thank you!
- Kevin
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2025-02-28 17:43 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
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).