* [PATCH] mips: define pud_index() regardless of page table folding
@ 2020-04-02 8:16 Mike Rapoport
2020-04-13 6:21 ` Huacai Chen
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Mike Rapoport @ 2020-04-02 8:16 UTC (permalink / raw)
To: Thomas Bogendoerfer
Cc: Paolo Bonzini, Peter Xu, maobibo, Sergei Shtylyov, linux-mips,
kvm, linux-kernel, Mike Rapoport, Mike Rapoport
From: Mike Rapoport <rppt@linux.ibm.com>
Commit 31168f033e37 ("mips: drop __pXd_offset() macros that duplicate
pXd_index() ones") is correct that pud_index() & __pud_offset() are the
same when pud_index() is actually provided, however it does not take into
account the __PAGETABLE_PUD_FOLDED case. This has broken MIPS KVM
compilation because it relied on availability of pud_index().
Define pud_index() regardless of page table folded. It will evaluate to
actual index for 4-level pagetables and to 0 for folded PUD level.
Link: https://lore.kernel.org/lkml/20200331154749.5457-1-pbonzini@redhat.com
Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
arch/mips/include/asm/pgtable-64.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h
index f92716cfa4f4..ee5dc0c145b9 100644
--- a/arch/mips/include/asm/pgtable-64.h
+++ b/arch/mips/include/asm/pgtable-64.h
@@ -172,6 +172,8 @@
extern pte_t invalid_pte_table[PTRS_PER_PTE];
+#define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))
+
#ifndef __PAGETABLE_PUD_FOLDED
/*
* For 4-level pagetables we defines these ourselves, for 3-level the
@@ -210,8 +212,6 @@ static inline void p4d_clear(p4d_t *p4dp)
p4d_val(*p4dp) = (unsigned long)invalid_pud_table;
}
-#define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))
-
static inline unsigned long p4d_page_vaddr(p4d_t p4d)
{
return p4d_val(p4d);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mips: define pud_index() regardless of page table folding
2020-04-02 8:16 [PATCH] mips: define pud_index() regardless of page table folding Mike Rapoport
@ 2020-04-13 6:21 ` Huacai Chen
2020-04-15 6:43 ` Philippe Mathieu-Daudé
2020-04-16 16:35 ` Thomas Bogendoerfer
2 siblings, 0 replies; 4+ messages in thread
From: Huacai Chen @ 2020-04-13 6:21 UTC (permalink / raw)
To: Mike Rapoport
Cc: Thomas Bogendoerfer, Paolo Bonzini, Peter Xu, maobibo,
Sergei Shtylyov, open list:MIPS, kvm, LKML, Mike Rapoport
Tested-by: Huacai Chen <chenhc@lemote.com>
On Thu, Apr 2, 2020 at 4:17 PM Mike Rapoport <rppt@kernel.org> wrote:
>
> From: Mike Rapoport <rppt@linux.ibm.com>
>
> Commit 31168f033e37 ("mips: drop __pXd_offset() macros that duplicate
> pXd_index() ones") is correct that pud_index() & __pud_offset() are the
> same when pud_index() is actually provided, however it does not take into
> account the __PAGETABLE_PUD_FOLDED case. This has broken MIPS KVM
> compilation because it relied on availability of pud_index().
>
> Define pud_index() regardless of page table folded. It will evaluate to
> actual index for 4-level pagetables and to 0 for folded PUD level.
>
> Link: https://lore.kernel.org/lkml/20200331154749.5457-1-pbonzini@redhat.com
> Reported-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> ---
> arch/mips/include/asm/pgtable-64.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h
> index f92716cfa4f4..ee5dc0c145b9 100644
> --- a/arch/mips/include/asm/pgtable-64.h
> +++ b/arch/mips/include/asm/pgtable-64.h
> @@ -172,6 +172,8 @@
>
> extern pte_t invalid_pte_table[PTRS_PER_PTE];
>
> +#define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))
> +
> #ifndef __PAGETABLE_PUD_FOLDED
> /*
> * For 4-level pagetables we defines these ourselves, for 3-level the
> @@ -210,8 +212,6 @@ static inline void p4d_clear(p4d_t *p4dp)
> p4d_val(*p4dp) = (unsigned long)invalid_pud_table;
> }
>
> -#define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))
> -
> static inline unsigned long p4d_page_vaddr(p4d_t p4d)
> {
> return p4d_val(p4d);
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mips: define pud_index() regardless of page table folding
2020-04-02 8:16 [PATCH] mips: define pud_index() regardless of page table folding Mike Rapoport
2020-04-13 6:21 ` Huacai Chen
@ 2020-04-15 6:43 ` Philippe Mathieu-Daudé
2020-04-16 16:35 ` Thomas Bogendoerfer
2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-15 6:43 UTC (permalink / raw)
To: Mike Rapoport, Thomas Bogendoerfer
Cc: Paolo Bonzini, Peter Xu, maobibo, Sergei Shtylyov, linux-mips,
kvm, linux-kernel, Mike Rapoport
On 4/2/20 10:16 AM, Mike Rapoport wrote:
> From: Mike Rapoport <rppt@linux.ibm.com>
>
> Commit 31168f033e37 ("mips: drop __pXd_offset() macros that duplicate
> pXd_index() ones") is correct that pud_index() & __pud_offset() are the
> same when pud_index() is actually provided, however it does not take into
> account the __PAGETABLE_PUD_FOLDED case. This has broken MIPS KVM
> compilation because it relied on availability of pud_index().
>
> Define pud_index() regardless of page table folded. It will evaluate to
> actual index for 4-level pagetables and to 0 for folded PUD level.
>
> Link: https://lore.kernel.org/lkml/20200331154749.5457-1-pbonzini@redhat.com
> Reported-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> arch/mips/include/asm/pgtable-64.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h
> index f92716cfa4f4..ee5dc0c145b9 100644
> --- a/arch/mips/include/asm/pgtable-64.h
> +++ b/arch/mips/include/asm/pgtable-64.h
> @@ -172,6 +172,8 @@
>
> extern pte_t invalid_pte_table[PTRS_PER_PTE];
>
> +#define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))
> +
> #ifndef __PAGETABLE_PUD_FOLDED
> /*
> * For 4-level pagetables we defines these ourselves, for 3-level the
> @@ -210,8 +212,6 @@ static inline void p4d_clear(p4d_t *p4dp)
> p4d_val(*p4dp) = (unsigned long)invalid_pud_table;
> }
>
> -#define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))
> -
> static inline unsigned long p4d_page_vaddr(p4d_t p4d)
> {
> return p4d_val(p4d);
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mips: define pud_index() regardless of page table folding
2020-04-02 8:16 [PATCH] mips: define pud_index() regardless of page table folding Mike Rapoport
2020-04-13 6:21 ` Huacai Chen
2020-04-15 6:43 ` Philippe Mathieu-Daudé
@ 2020-04-16 16:35 ` Thomas Bogendoerfer
2 siblings, 0 replies; 4+ messages in thread
From: Thomas Bogendoerfer @ 2020-04-16 16:35 UTC (permalink / raw)
To: Mike Rapoport
Cc: Paolo Bonzini, Peter Xu, maobibo, Sergei Shtylyov, linux-mips,
kvm, linux-kernel, Mike Rapoport
On Thu, Apr 02, 2020 at 11:16:14AM +0300, Mike Rapoport wrote:
> From: Mike Rapoport <rppt@linux.ibm.com>
>
> Commit 31168f033e37 ("mips: drop __pXd_offset() macros that duplicate
> pXd_index() ones") is correct that pud_index() & __pud_offset() are the
> same when pud_index() is actually provided, however it does not take into
> account the __PAGETABLE_PUD_FOLDED case. This has broken MIPS KVM
> compilation because it relied on availability of pud_index().
>
> Define pud_index() regardless of page table folded. It will evaluate to
> actual index for 4-level pagetables and to 0 for folded PUD level.
>
> Link: https://lore.kernel.org/lkml/20200331154749.5457-1-pbonzini@redhat.com
> Reported-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> ---
> arch/mips/include/asm/pgtable-64.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-04-16 16:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-02 8:16 [PATCH] mips: define pud_index() regardless of page table folding Mike Rapoport
2020-04-13 6:21 ` Huacai Chen
2020-04-15 6:43 ` Philippe Mathieu-Daudé
2020-04-16 16:35 ` Thomas Bogendoerfer
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).