* [PATCH] mm/arm64: Drop dead code for pud special bit handling
@ 2025-03-20 18:34 Peter Xu
2025-03-20 21:03 ` Donald Dutile
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Peter Xu @ 2025-03-20 18:34 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: Andrew Morton, peterx, Alex Williamson, Donald Dutile,
Catalin Marinas, Will Deacon, Keith Busch
Keith Busch observed some incorrect macros defined in arm64 code [1].
It turns out the two lines should never be needed and won't be exposed to
anyone, because aarch64 doesn't select HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD,
hence ARCH_SUPPORTS_PUD_PFNMAP is always N. The only archs that support
THP PUDs so far are x86 and powerpc.
Instead of fixing the lines (with no way to test it..), remove the two
lines that are in reality dead code, to avoid confusing readers.
Fixes tag is attached to reflect where the wrong macros were introduced,
but explicitly not copying stable, because there's no real issue to be
fixed. So it's only about removing the dead code so far.
[1] https://lore.kernel.org/all/Z9tDjOk-JdV_fCY4@kbusch-mbp.dhcp.thefacebook.com/#t
Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: Donald Dutile <ddutile@redhat.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Fixes: 3e509c9b03f9 ("mm/arm64: support large pfn mappings")
Reported-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Peter Xu <peterx@redhat.com>
---
arch/arm64/include/asm/pgtable.h | 5 -----
1 file changed, 5 deletions(-)
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 0b2a2ad1b9e8..15211f74b035 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -620,11 +620,6 @@ static inline pmd_t pmd_mkspecial(pmd_t pmd)
#define pud_pfn(pud) ((__pud_to_phys(pud) & PUD_MASK) >> PAGE_SHIFT)
#define pfn_pud(pfn,prot) __pud(__phys_to_pud_val((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
-#ifdef CONFIG_ARCH_SUPPORTS_PUD_PFNMAP
-#define pud_special(pte) pte_special(pud_pte(pud))
-#define pud_mkspecial(pte) pte_pud(pte_mkspecial(pud_pte(pud)))
-#endif
-
#define pmd_pgprot pmd_pgprot
static inline pgprot_t pmd_pgprot(pmd_t pmd)
{
--
2.48.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm/arm64: Drop dead code for pud special bit handling
2025-03-20 18:34 [PATCH] mm/arm64: Drop dead code for pud special bit handling Peter Xu
@ 2025-03-20 21:03 ` Donald Dutile
2025-03-20 21:45 ` Peter Xu
2025-03-21 4:21 ` Anshuman Khandual
2025-03-28 20:08 ` Catalin Marinas
2 siblings, 1 reply; 5+ messages in thread
From: Donald Dutile @ 2025-03-20 21:03 UTC (permalink / raw)
To: Peter Xu, linux-mm, linux-kernel
Cc: Andrew Morton, Alex Williamson, Catalin Marinas, Will Deacon,
Keith Busch
Peter,
Thanks for the cc, as I have the original commit in a recent, proposed backport that now needs an edit...
or, since harmless, maybe this patch to additionally backport, once committed. :-)
On 3/20/25 2:34 PM, Peter Xu wrote:
> Keith Busch observed some incorrect macros defined in arm64 code [1].
>
> It turns out the two lines should never be needed and won't be exposed to
> anyone, because aarch64 doesn't select HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD,
> hence ARCH_SUPPORTS_PUD_PFNMAP is always N. The only archs that support
> THP PUDs so far are x86 and powerpc.
>
> Instead of fixing the lines (with no way to test it..), remove the two
> lines that are in reality dead code, to avoid confusing readers.
>
> Fixes tag is attached to reflect where the wrong macros were introduced,
> but explicitly not copying stable, because there's no real issue to be
> fixed. So it's only about removing the dead code so far.
>
> [1] https://lore.kernel.org/all/Z9tDjOk-JdV_fCY4@kbusch-mbp.dhcp.thefacebook.com/#t
>
> Cc: Alex Williamson <alex.williamson@redhat.com>
> Cc: Donald Dutile <ddutile@redhat.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Fixes: 3e509c9b03f9 ("mm/arm64: support large pfn mappings")
> Reported-by: Keith Busch <kbusch@kernel.org>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
> arch/arm64/include/asm/pgtable.h | 5 -----
> 1 file changed, 5 deletions(-)
>
> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
> index 0b2a2ad1b9e8..15211f74b035 100644
> --- a/arch/arm64/include/asm/pgtable.h
> +++ b/arch/arm64/include/asm/pgtable.h
> @@ -620,11 +620,6 @@ static inline pmd_t pmd_mkspecial(pmd_t pmd)
> #define pud_pfn(pud) ((__pud_to_phys(pud) & PUD_MASK) >> PAGE_SHIFT)
> #define pfn_pud(pfn,prot) __pud(__phys_to_pud_val((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
>
> -#ifdef CONFIG_ARCH_SUPPORTS_PUD_PFNMAP
> -#define pud_special(pte) pte_special(pud_pte(pud))
> -#define pud_mkspecial(pte) pte_pud(pte_mkspecial(pud_pte(pud)))
> -#endif
> -
> #define pmd_pgprot pmd_pgprot
> static inline pgprot_t pmd_pgprot(pmd_t pmd)
> {
Reviewed-by: Donald Dutile <ddutile@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm/arm64: Drop dead code for pud special bit handling
2025-03-20 21:03 ` Donald Dutile
@ 2025-03-20 21:45 ` Peter Xu
0 siblings, 0 replies; 5+ messages in thread
From: Peter Xu @ 2025-03-20 21:45 UTC (permalink / raw)
To: Donald Dutile
Cc: linux-mm, linux-kernel, Andrew Morton, Alex Williamson,
Catalin Marinas, Will Deacon, Keith Busch
On Thu, Mar 20, 2025 at 05:03:05PM -0400, Donald Dutile wrote:
> Peter,
Hello, Don,
>
> Thanks for the cc, as I have the original commit in a recent, proposed backport that now needs an edit...
> or, since harmless, maybe this patch to additionally backport, once committed. :-)
I would suggest not having the backport blocked by this. :)
Thanks for the quick review!
--
Peter Xu
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm/arm64: Drop dead code for pud special bit handling
2025-03-20 18:34 [PATCH] mm/arm64: Drop dead code for pud special bit handling Peter Xu
2025-03-20 21:03 ` Donald Dutile
@ 2025-03-21 4:21 ` Anshuman Khandual
2025-03-28 20:08 ` Catalin Marinas
2 siblings, 0 replies; 5+ messages in thread
From: Anshuman Khandual @ 2025-03-21 4:21 UTC (permalink / raw)
To: Peter Xu, linux-mm, linux-kernel
Cc: Andrew Morton, Alex Williamson, Donald Dutile, Catalin Marinas,
Will Deacon, Keith Busch
On 3/21/25 00:04, Peter Xu wrote:
> Keith Busch observed some incorrect macros defined in arm64 code [1].
>
> It turns out the two lines should never be needed and won't be exposed to
> anyone, because aarch64 doesn't select HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD,
> hence ARCH_SUPPORTS_PUD_PFNMAP is always N. The only archs that support
> THP PUDs so far are x86 and powerpc.
Correct.
>
> Instead of fixing the lines (with no way to test it..), remove the two
> lines that are in reality dead code, to avoid confusing readers.
Agreed. Because ARCH_SUPPORTS_PUD_PFNMAP is always N and hence these lines
are never reachable. So removing these lines will be preferred than fixing.
>
> Fixes tag is attached to reflect where the wrong macros were introduced,
> but explicitly not copying stable, because there's no real issue to be
> fixed. So it's only about removing the dead code so far.
Makes sense.
>
> [1] https://lore.kernel.org/all/Z9tDjOk-JdV_fCY4@kbusch-mbp.dhcp.thefacebook.com/#t
>
> Cc: Alex Williamson <alex.williamson@redhat.com>
> Cc: Donald Dutile <ddutile@redhat.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Fixes: 3e509c9b03f9 ("mm/arm64: support large pfn mappings")
The commit ID checks out.
> Reported-by: Keith Busch <kbusch@kernel.org>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
> arch/arm64/include/asm/pgtable.h | 5 -----
> 1 file changed, 5 deletions(-)
>
> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
> index 0b2a2ad1b9e8..15211f74b035 100644
> --- a/arch/arm64/include/asm/pgtable.h
> +++ b/arch/arm64/include/asm/pgtable.h
> @@ -620,11 +620,6 @@ static inline pmd_t pmd_mkspecial(pmd_t pmd)
> #define pud_pfn(pud) ((__pud_to_phys(pud) & PUD_MASK) >> PAGE_SHIFT)
> #define pfn_pud(pfn,prot) __pud(__phys_to_pud_val((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
>
> -#ifdef CONFIG_ARCH_SUPPORTS_PUD_PFNMAP
> -#define pud_special(pte) pte_special(pud_pte(pud))
> -#define pud_mkspecial(pte) pte_pud(pte_mkspecial(pud_pte(pud)))
> -#endif
> -
> #define pmd_pgprot pmd_pgprot
> static inline pgprot_t pmd_pgprot(pmd_t pmd)
> {
LGTM
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm/arm64: Drop dead code for pud special bit handling
2025-03-20 18:34 [PATCH] mm/arm64: Drop dead code for pud special bit handling Peter Xu
2025-03-20 21:03 ` Donald Dutile
2025-03-21 4:21 ` Anshuman Khandual
@ 2025-03-28 20:08 ` Catalin Marinas
2 siblings, 0 replies; 5+ messages in thread
From: Catalin Marinas @ 2025-03-28 20:08 UTC (permalink / raw)
To: linux-mm, linux-kernel, Peter Xu
Cc: Will Deacon, Andrew Morton, Alex Williamson, Donald Dutile, Keith Busch
On Thu, 20 Mar 2025 14:34:05 -0400, Peter Xu wrote:
> Keith Busch observed some incorrect macros defined in arm64 code [1].
>
> It turns out the two lines should never be needed and won't be exposed to
> anyone, because aarch64 doesn't select HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD,
> hence ARCH_SUPPORTS_PUD_PFNMAP is always N. The only archs that support
> THP PUDs so far are x86 and powerpc.
>
> [...]
Applied to arm64 (for-next/core), thanks!
[1/1] mm/arm64: Drop dead code for pud special bit handling
https://git.kernel.org/arm64/c/0fff2aa96f6b
--
Catalin
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-03-28 20:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-20 18:34 [PATCH] mm/arm64: Drop dead code for pud special bit handling Peter Xu
2025-03-20 21:03 ` Donald Dutile
2025-03-20 21:45 ` Peter Xu
2025-03-21 4:21 ` Anshuman Khandual
2025-03-28 20:08 ` Catalin Marinas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox