* [PATCH 2/2] Reapply "x86/mm: Remove unused __set_memory_prot()"
2026-01-06 9:50 [PATCH 1/2] x86/crash: Use set_memory_p instead of __set_memory_prot Coiby Xu
@ 2026-01-06 9:50 ` Coiby Xu
2026-01-09 20:11 ` [PATCH 1/2] x86/crash: Use set_memory_p instead of __set_memory_prot Borislav Petkov
2026-01-13 15:12 ` [tip: x86/cleanups] x86/crash: Use set_memory_p() instead of __set_memory_prot() tip-bot2 for Coiby Xu
2 siblings, 0 replies; 7+ messages in thread
From: Coiby Xu @ 2026-01-06 9:50 UTC (permalink / raw)
To: kexec, x86
Cc: Andrew Morton, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, H. Peter Anvin, Andy Lutomirski, Peter Zijlstra,
open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)
This reverts commit e1e6cd01d93359e22be84a23c8bb24ee4e04e142 as
__set_memory_prot is unsued (again) after set_memory_p is used instead
for x86_64 kdump LUKS support (CONFIG_CRASH_DM_CRYPT).
Signed-off-by: Coiby Xu <coxu@redhat.com>
---
arch/x86/include/asm/set_memory.h | 2 --
arch/x86/mm/pat/set_memory.c | 13 -------------
2 files changed, 15 deletions(-)
diff --git a/arch/x86/include/asm/set_memory.h b/arch/x86/include/asm/set_memory.h
index 61f56cdaccb5..8d9f1c9aaa4c 100644
--- a/arch/x86/include/asm/set_memory.h
+++ b/arch/x86/include/asm/set_memory.h
@@ -4,7 +4,6 @@
#include <asm/page.h>
#include <asm-generic/set_memory.h>
-#include <asm/pgtable.h>
#define set_memory_rox set_memory_rox
int set_memory_rox(unsigned long addr, int numpages);
@@ -38,7 +37,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 6c6eb486f7a6..40581a720fe8 100644
--- a/arch/x86/mm/pat/set_memory.c
+++ b/arch/x86/mm/pat/set_memory.c
@@ -2145,19 +2145,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.52.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 1/2] x86/crash: Use set_memory_p instead of __set_memory_prot
2026-01-06 9:50 [PATCH 1/2] x86/crash: Use set_memory_p instead of __set_memory_prot Coiby Xu
2026-01-06 9:50 ` [PATCH 2/2] Reapply "x86/mm: Remove unused __set_memory_prot()" Coiby Xu
@ 2026-01-09 20:11 ` Borislav Petkov
2026-01-13 10:14 ` Coiby Xu
2026-01-13 15:12 ` [tip: x86/cleanups] x86/crash: Use set_memory_p() instead of __set_memory_prot() tip-bot2 for Coiby Xu
2 siblings, 1 reply; 7+ messages in thread
From: Borislav Petkov @ 2026-01-09 20:11 UTC (permalink / raw)
To: Coiby Xu
Cc: kexec, x86, Andrew Morton, Thomas Gleixner, Ingo Molnar,
Dave Hansen, H. Peter Anvin,
open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)
On Tue, Jan 06, 2026 at 05:50:58PM +0800, Coiby Xu wrote:
> set_memory_p has been introduced since commit 030ad7af9437 ("x86/mm:
> Regularize set_memory_p() parameters and make non-static"). There is no
> need to use __set_memory_prot.
>
> Signed-off-by: Coiby Xu <coxu@redhat.com>
> ---
> arch/x86/kernel/machine_kexec_64.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
Why aren't those a single patch?
---
From: Coiby Xu <coxu@redhat.com>
Date: Tue, 6 Jan 2026 17:50:58 +0800
Subject: [PATCH] x86/crash: Use set_memory_p() instead of __set_memory_prot()
set_memory_p() is available to use outside of its compilation unit since:
030ad7af9437 ("x86/mm: Regularize set_memory_p() parameters and make non-static").
There is no use for __set_memory_prot() anymore so drop it too.
[ bp: Massage commit message. ]
Signed-off-by: Coiby Xu <coxu@redhat.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://patch.msgid.link/20260106095100.656292-1-coxu@redhat.com
---
arch/x86/include/asm/set_memory.h | 1 -
arch/x86/kernel/machine_kexec_64.c | 5 +----
arch/x86/mm/pat/set_memory.c | 13 -------------
3 files changed, 1 insertion(+), 18 deletions(-)
diff --git a/arch/x86/include/asm/set_memory.h b/arch/x86/include/asm/set_memory.h
index 61f56cdaccb5..4362c26aa992 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/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
index 201137b98fb8..0590d399d4f1 100644
--- a/arch/x86/kernel/machine_kexec_64.c
+++ b/arch/x86/kernel/machine_kexec_64.c
@@ -673,10 +673,7 @@ static void kexec_mark_dm_crypt_keys(bool protect)
if (protect)
set_memory_np((unsigned long)phys_to_virt(start_paddr), nr_pages);
else
- __set_memory_prot(
- (unsigned long)phys_to_virt(start_paddr),
- nr_pages,
- __pgprot(_PAGE_PRESENT | _PAGE_NX | _PAGE_RW));
+ set_memory_p((unsigned long)phys_to_virt(start_paddr), nr_pages);
}
}
diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c
index 6c6eb486f7a6..40581a720fe8 100644
--- a/arch/x86/mm/pat/set_memory.c
+++ b/arch/x86/mm/pat/set_memory.c
@@ -2145,19 +2145,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.51.0
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 1/2] x86/crash: Use set_memory_p instead of __set_memory_prot
2026-01-09 20:11 ` [PATCH 1/2] x86/crash: Use set_memory_p instead of __set_memory_prot Borislav Petkov
@ 2026-01-13 10:14 ` Coiby Xu
2026-01-13 14:27 ` Borislav Petkov
0 siblings, 1 reply; 7+ messages in thread
From: Coiby Xu @ 2026-01-13 10:14 UTC (permalink / raw)
To: Borislav Petkov
Cc: kexec, x86, Andrew Morton, Thomas Gleixner, Ingo Molnar,
Dave Hansen, H. Peter Anvin,
open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)
On Fri, Jan 09, 2026 at 09:11:42PM +0100, Borislav Petkov wrote:
>On Tue, Jan 06, 2026 at 05:50:58PM +0800, Coiby Xu wrote:
>> set_memory_p has been introduced since commit 030ad7af9437 ("x86/mm:
>> Regularize set_memory_p() parameters and make non-static"). There is no
>> need to use __set_memory_prot.
>>
>> Signed-off-by: Coiby Xu <coxu@redhat.com>
>> ---
>> arch/x86/kernel/machine_kexec_64.c | 5 +----
>> 1 file changed, 1 insertion(+), 4 deletions(-)
>
>Why aren't those a single patch?
Hi Borislav,
I thought smaller patches are easier to review. But seems it's
unnecessary for this case.
Thanks for squashing the two commits and also updating the commit
message! I notice you also added a Link tag. Does it mean there is no
need for me to re-send your new patch as v2?
>
>---
>From: Coiby Xu <coxu@redhat.com>
>Date: Tue, 6 Jan 2026 17:50:58 +0800
>Subject: [PATCH] x86/crash: Use set_memory_p() instead of __set_memory_prot()
>
>set_memory_p() is available to use outside of its compilation unit since:
>
> 030ad7af9437 ("x86/mm: Regularize set_memory_p() parameters and make non-static").
>
>There is no use for __set_memory_prot() anymore so drop it too.
>
> [ bp: Massage commit message. ]
>
>Signed-off-by: Coiby Xu <coxu@redhat.com>
>Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
>Link: https://patch.msgid.link/20260106095100.656292-1-coxu@redhat.com
>---
> arch/x86/include/asm/set_memory.h | 1 -
> arch/x86/kernel/machine_kexec_64.c | 5 +----
> arch/x86/mm/pat/set_memory.c | 13 -------------
> 3 files changed, 1 insertion(+), 18 deletions(-)
>
>diff --git a/arch/x86/include/asm/set_memory.h b/arch/x86/include/asm/set_memory.h
>index 61f56cdaccb5..4362c26aa992 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/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
>index 201137b98fb8..0590d399d4f1 100644
>--- a/arch/x86/kernel/machine_kexec_64.c
>+++ b/arch/x86/kernel/machine_kexec_64.c
>@@ -673,10 +673,7 @@ static void kexec_mark_dm_crypt_keys(bool protect)
> if (protect)
> set_memory_np((unsigned long)phys_to_virt(start_paddr), nr_pages);
> else
>- __set_memory_prot(
>- (unsigned long)phys_to_virt(start_paddr),
>- nr_pages,
>- __pgprot(_PAGE_PRESENT | _PAGE_NX | _PAGE_RW));
>+ set_memory_p((unsigned long)phys_to_virt(start_paddr), nr_pages);
> }
> }
>
>diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c
>index 6c6eb486f7a6..40581a720fe8 100644
>--- a/arch/x86/mm/pat/set_memory.c
>+++ b/arch/x86/mm/pat/set_memory.c
>@@ -2145,19 +2145,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.51.0
>
>--
>Regards/Gruss,
> Boris.
>
>https://people.kernel.org/tglx/notes-about-netiquette
>
--
Best regards,
Coiby
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 1/2] x86/crash: Use set_memory_p instead of __set_memory_prot
2026-01-13 10:14 ` Coiby Xu
@ 2026-01-13 14:27 ` Borislav Petkov
2026-01-14 2:36 ` Coiby Xu
0 siblings, 1 reply; 7+ messages in thread
From: Borislav Petkov @ 2026-01-13 14:27 UTC (permalink / raw)
To: Coiby Xu
Cc: kexec, x86, Andrew Morton, Thomas Gleixner, Ingo Molnar,
Dave Hansen, H. Peter Anvin,
open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)
On Tue, Jan 13, 2026 at 06:14:38PM +0800, Coiby Xu wrote:
> I thought smaller patches are easier to review. But seems it's unnecessary
> for this case.
Right, especially if the two patches do one logical thing - removing
__set_memory_prot(). Then one patch is better.
> Thanks for squashing the two commits and also updating the commit
> message! I notice you also added a Link tag. Does it mean there is no
> need for me to re-send your new patch as v2?
Yap, I can queue it, no need.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 1/2] x86/crash: Use set_memory_p instead of __set_memory_prot
2026-01-13 14:27 ` Borislav Petkov
@ 2026-01-14 2:36 ` Coiby Xu
0 siblings, 0 replies; 7+ messages in thread
From: Coiby Xu @ 2026-01-14 2:36 UTC (permalink / raw)
To: Borislav Petkov
Cc: kexec, x86, Andrew Morton, Thomas Gleixner, Ingo Molnar,
Dave Hansen, H. Peter Anvin,
open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)
On Tue, Jan 13, 2026 at 03:27:33PM +0100, Borislav Petkov wrote:
>On Tue, Jan 13, 2026 at 06:14:38PM +0800, Coiby Xu wrote:
>> I thought smaller patches are easier to review. But seems it's unnecessary
>> for this case.
>
>Right, especially if the two patches do one logical thing - removing
>__set_memory_prot(). Then one patch is better.
I see, thanks for the explanation!
>
>> Thanks for squashing the two commits and also updating the commit
>> message! I notice you also added a Link tag. Does it mean there is no
>> need for me to re-send your new patch as v2?
>
>Yap, I can queue it, no need.
Great, thanks for taking care of the patch!
>
>Thx.
>
>--
>Regards/Gruss,
> Boris.
>
>https://people.kernel.org/tglx/notes-about-netiquette
>
--
Best regards,
Coiby
^ permalink raw reply [flat|nested] 7+ messages in thread
* [tip: x86/cleanups] x86/crash: Use set_memory_p() instead of __set_memory_prot()
2026-01-06 9:50 [PATCH 1/2] x86/crash: Use set_memory_p instead of __set_memory_prot Coiby Xu
2026-01-06 9:50 ` [PATCH 2/2] Reapply "x86/mm: Remove unused __set_memory_prot()" Coiby Xu
2026-01-09 20:11 ` [PATCH 1/2] x86/crash: Use set_memory_p instead of __set_memory_prot Borislav Petkov
@ 2026-01-13 15:12 ` tip-bot2 for Coiby Xu
2 siblings, 0 replies; 7+ messages in thread
From: tip-bot2 for Coiby Xu @ 2026-01-13 15:12 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Coiby Xu, Borislav Petkov (AMD), x86, linux-kernel
The following commit has been merged into the x86/cleanups branch of tip:
Commit-ID: 8a4e92b3260ae7664d0531e1b42c38d336e7717a
Gitweb: https://git.kernel.org/tip/8a4e92b3260ae7664d0531e1b42c38d336e7717a
Author: Coiby Xu <coxu@redhat.com>
AuthorDate: Tue, 06 Jan 2026 17:50:58 +08:00
Committer: Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Tue, 13 Jan 2026 15:28:59 +01:00
x86/crash: Use set_memory_p() instead of __set_memory_prot()
set_memory_p() is available to use outside of its compilation unit since:
030ad7af9437 ("x86/mm: Regularize set_memory_p() parameters and make non-static").
There is no use for __set_memory_prot() anymore so drop it too.
[ bp: Massage commit message. ]
Signed-off-by: Coiby Xu <coxu@redhat.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://patch.msgid.link/20260106095100.656292-1-coxu@redhat.com
---
arch/x86/include/asm/set_memory.h | 1 -
arch/x86/kernel/machine_kexec_64.c | 5 +----
arch/x86/mm/pat/set_memory.c | 13 -------------
3 files changed, 1 insertion(+), 18 deletions(-)
diff --git a/arch/x86/include/asm/set_memory.h b/arch/x86/include/asm/set_memory.h
index 61f56cd..4362c26 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/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
index 201137b..0590d39 100644
--- a/arch/x86/kernel/machine_kexec_64.c
+++ b/arch/x86/kernel/machine_kexec_64.c
@@ -673,10 +673,7 @@ static void kexec_mark_dm_crypt_keys(bool protect)
if (protect)
set_memory_np((unsigned long)phys_to_virt(start_paddr), nr_pages);
else
- __set_memory_prot(
- (unsigned long)phys_to_virt(start_paddr),
- nr_pages,
- __pgprot(_PAGE_PRESENT | _PAGE_NX | _PAGE_RW));
+ set_memory_p((unsigned long)phys_to_virt(start_paddr), nr_pages);
}
}
diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c
index 6c6eb48..40581a7 100644
--- a/arch/x86/mm/pat/set_memory.c
+++ b/arch/x86/mm/pat/set_memory.c
@@ -2145,19 +2145,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] 7+ messages in thread