* [PATCH] powerpc/8xx: use pmd_off() to access a PMD entry in pte_update()
@ 2020-06-15 9:22 Mike Rapoport
2020-06-15 9:32 ` Christophe Leroy
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Mike Rapoport @ 2020-06-15 9:22 UTC (permalink / raw)
To: Andrew Morton, Michael Ellerman
Cc: Christophe Leroy, linuxppc-dev, linux-mm, linux-kernel,
Mike Rapoport, Mike Rapoport
From: Mike Rapoport <rppt@linux.ibm.com>
The pte_update() implementation for PPC_8xx unfolds page table from the PGD
level to access a PMD entry. Since 8xx has only 2-level page table this can
be simplified with pmd_off() shortcut.
Replace explicit unfolding with pmd_off() and drop defines of pgd_index()
and pgd_offset() that are no longer needed.
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
I think it's powerpc material, but I won't mind if Andrew picks it up :)
arch/powerpc/include/asm/nohash/32/pgtable.h | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/include/asm/nohash/32/pgtable.h b/arch/powerpc/include/asm/nohash/32/pgtable.h
index b56f14160ae5..5a590ceaec14 100644
--- a/arch/powerpc/include/asm/nohash/32/pgtable.h
+++ b/arch/powerpc/include/asm/nohash/32/pgtable.h
@@ -205,10 +205,6 @@ static inline void pmd_clear(pmd_t *pmdp)
*pmdp = __pmd(0);
}
-/* to find an entry in a page-table-directory */
-#define pgd_index(address) ((address) >> PGDIR_SHIFT)
-#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
-
/*
* PTE updates. This function is called whenever an existing
* valid PTE is updated. This does -not- include set_pte_at()
@@ -230,6 +226,8 @@ static inline void pmd_clear(pmd_t *pmdp)
* For other page sizes, we have a single entry in the table.
*/
#ifdef CONFIG_PPC_8xx
+static pmd_t *pmd_off(struct mm_struct *mm, unsigned long addr);
+
static inline pte_basic_t pte_update(struct mm_struct *mm, unsigned long addr, pte_t *p,
unsigned long clr, unsigned long set, int huge)
{
@@ -237,7 +235,7 @@ static inline pte_basic_t pte_update(struct mm_struct *mm, unsigned long addr, p
pte_basic_t old = pte_val(*p);
pte_basic_t new = (old & ~(pte_basic_t)clr) | set;
int num, i;
- pmd_t *pmd = pmd_offset(pud_offset(p4d_offset(pgd_offset(mm, addr), addr), addr), addr);
+ pmd_t *pmd = pmd_off(mm, addr);
if (!huge)
num = PAGE_SIZE / SZ_4K;
--
2.26.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc/8xx: use pmd_off() to access a PMD entry in pte_update()
2020-06-15 9:22 [PATCH] powerpc/8xx: use pmd_off() to access a PMD entry in pte_update() Mike Rapoport
@ 2020-06-15 9:32 ` Christophe Leroy
2020-06-16 19:43 ` Andrew Morton
2020-06-18 12:37 ` Michael Ellerman
2 siblings, 0 replies; 7+ messages in thread
From: Christophe Leroy @ 2020-06-15 9:32 UTC (permalink / raw)
To: Mike Rapoport, Andrew Morton, Michael Ellerman
Cc: Christophe Leroy, linuxppc-dev, linux-mm, linux-kernel, Mike Rapoport
Le 15/06/2020 à 11:22, Mike Rapoport a écrit :
> From: Mike Rapoport <rppt@linux.ibm.com>
>
> The pte_update() implementation for PPC_8xx unfolds page table from the PGD
> level to access a PMD entry. Since 8xx has only 2-level page table this can
> be simplified with pmd_off() shortcut.
>
> Replace explicit unfolding with pmd_off() and drop defines of pgd_index()
> and pgd_offset() that are no longer needed.
>
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Nice. When I implemented this function, I was not able to use pmd_ptr()
due to some circular header inclusion (See comment in commit log). Looks
like since the replacement of pmd_ptr() by pmd_off(), it works.
Reviewed-by: Christophe Leroy <christophe.leroy@c-s.fr>
Christophe
> ---
>
> I think it's powerpc material, but I won't mind if Andrew picks it up :)
>
>
> arch/powerpc/include/asm/nohash/32/pgtable.h | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/nohash/32/pgtable.h b/arch/powerpc/include/asm/nohash/32/pgtable.h
> index b56f14160ae5..5a590ceaec14 100644
> --- a/arch/powerpc/include/asm/nohash/32/pgtable.h
> +++ b/arch/powerpc/include/asm/nohash/32/pgtable.h
> @@ -205,10 +205,6 @@ static inline void pmd_clear(pmd_t *pmdp)
> *pmdp = __pmd(0);
> }
>
> -/* to find an entry in a page-table-directory */
> -#define pgd_index(address) ((address) >> PGDIR_SHIFT)
> -#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
> -
> /*
> * PTE updates. This function is called whenever an existing
> * valid PTE is updated. This does -not- include set_pte_at()
> @@ -230,6 +226,8 @@ static inline void pmd_clear(pmd_t *pmdp)
> * For other page sizes, we have a single entry in the table.
> */
> #ifdef CONFIG_PPC_8xx
> +static pmd_t *pmd_off(struct mm_struct *mm, unsigned long addr);
> +
> static inline pte_basic_t pte_update(struct mm_struct *mm, unsigned long addr, pte_t *p,
> unsigned long clr, unsigned long set, int huge)
> {
> @@ -237,7 +235,7 @@ static inline pte_basic_t pte_update(struct mm_struct *mm, unsigned long addr, p
> pte_basic_t old = pte_val(*p);
> pte_basic_t new = (old & ~(pte_basic_t)clr) | set;
> int num, i;
> - pmd_t *pmd = pmd_offset(pud_offset(p4d_offset(pgd_offset(mm, addr), addr), addr), addr);
> + pmd_t *pmd = pmd_off(mm, addr);
>
> if (!huge)
> num = PAGE_SIZE / SZ_4K;
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc/8xx: use pmd_off() to access a PMD entry in pte_update()
2020-06-15 9:22 [PATCH] powerpc/8xx: use pmd_off() to access a PMD entry in pte_update() Mike Rapoport
2020-06-15 9:32 ` Christophe Leroy
@ 2020-06-16 19:43 ` Andrew Morton
2020-06-16 23:21 ` Michael Ellerman
2020-06-18 12:37 ` Michael Ellerman
2 siblings, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2020-06-16 19:43 UTC (permalink / raw)
To: Mike Rapoport
Cc: Michael Ellerman, Christophe Leroy, linuxppc-dev, linux-mm,
linux-kernel, Mike Rapoport
On Mon, 15 Jun 2020 12:22:29 +0300 Mike Rapoport <rppt@kernel.org> wrote:
> From: Mike Rapoport <rppt@linux.ibm.com>
>
> The pte_update() implementation for PPC_8xx unfolds page table from the PGD
> level to access a PMD entry. Since 8xx has only 2-level page table this can
> be simplified with pmd_off() shortcut.
>
> Replace explicit unfolding with pmd_off() and drop defines of pgd_index()
> and pgd_offset() that are no longer needed.
>
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> ---
>
> I think it's powerpc material, but I won't mind if Andrew picks it up :)
Via the powerpc tree would be better, please.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc/8xx: use pmd_off() to access a PMD entry in pte_update()
2020-06-16 19:43 ` Andrew Morton
@ 2020-06-16 23:21 ` Michael Ellerman
2020-06-17 4:16 ` Mike Rapoport
0 siblings, 1 reply; 7+ messages in thread
From: Michael Ellerman @ 2020-06-16 23:21 UTC (permalink / raw)
To: Andrew Morton, Mike Rapoport
Cc: Christophe Leroy, linuxppc-dev, linux-mm, linux-kernel, Mike Rapoport
Andrew Morton <akpm@linux-foundation.org> writes:
> On Mon, 15 Jun 2020 12:22:29 +0300 Mike Rapoport <rppt@kernel.org> wrote:
>
>> From: Mike Rapoport <rppt@linux.ibm.com>
>>
>> The pte_update() implementation for PPC_8xx unfolds page table from the PGD
>> level to access a PMD entry. Since 8xx has only 2-level page table this can
>> be simplified with pmd_off() shortcut.
>>
>> Replace explicit unfolding with pmd_off() and drop defines of pgd_index()
>> and pgd_offset() that are no longer needed.
>>
>> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
>> ---
>>
>> I think it's powerpc material, but I won't mind if Andrew picks it up :)
>
> Via the powerpc tree would be better, please.
I'll take it into next for v5.9, unless there's a reason it needs to go
into v5.8.
cheers
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc/8xx: use pmd_off() to access a PMD entry in pte_update()
2020-06-16 23:21 ` Michael Ellerman
@ 2020-06-17 4:16 ` Mike Rapoport
2020-06-17 13:05 ` Michael Ellerman
0 siblings, 1 reply; 7+ messages in thread
From: Mike Rapoport @ 2020-06-17 4:16 UTC (permalink / raw)
To: Michael Ellerman
Cc: Andrew Morton, Christophe Leroy, linuxppc-dev, linux-mm,
linux-kernel, Mike Rapoport
On Wed, Jun 17, 2020 at 09:21:42AM +1000, Michael Ellerman wrote:
> Andrew Morton <akpm@linux-foundation.org> writes:
> > On Mon, 15 Jun 2020 12:22:29 +0300 Mike Rapoport <rppt@kernel.org> wrote:
> >
> >> From: Mike Rapoport <rppt@linux.ibm.com>
> >>
> >> The pte_update() implementation for PPC_8xx unfolds page table from the PGD
> >> level to access a PMD entry. Since 8xx has only 2-level page table this can
> >> be simplified with pmd_off() shortcut.
> >>
> >> Replace explicit unfolding with pmd_off() and drop defines of pgd_index()
> >> and pgd_offset() that are no longer needed.
> >>
> >> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> >> ---
> >>
> >> I think it's powerpc material, but I won't mind if Andrew picks it up :)
> >
> > Via the powerpc tree would be better, please.
>
> I'll take it into next for v5.9, unless there's a reason it needs to go
> into v5.8.
I consider it a fixup for 5.8 merge window conflicts. Besides, mering it
now may avoid new conflicts in 5.9 ;-)
> cheers
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc/8xx: use pmd_off() to access a PMD entry in pte_update()
2020-06-17 4:16 ` Mike Rapoport
@ 2020-06-17 13:05 ` Michael Ellerman
0 siblings, 0 replies; 7+ messages in thread
From: Michael Ellerman @ 2020-06-17 13:05 UTC (permalink / raw)
To: Mike Rapoport
Cc: Andrew Morton, Christophe Leroy, linuxppc-dev, linux-mm,
linux-kernel, Mike Rapoport
Mike Rapoport <rppt@kernel.org> writes:
> On Wed, Jun 17, 2020 at 09:21:42AM +1000, Michael Ellerman wrote:
>> Andrew Morton <akpm@linux-foundation.org> writes:
>> > On Mon, 15 Jun 2020 12:22:29 +0300 Mike Rapoport <rppt@kernel.org> wrote:
>> >
>> >> From: Mike Rapoport <rppt@linux.ibm.com>
>> >>
>> >> The pte_update() implementation for PPC_8xx unfolds page table from the PGD
>> >> level to access a PMD entry. Since 8xx has only 2-level page table this can
>> >> be simplified with pmd_off() shortcut.
>> >>
>> >> Replace explicit unfolding with pmd_off() and drop defines of pgd_index()
>> >> and pgd_offset() that are no longer needed.
>> >>
>> >> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
>> >> ---
>> >>
>> >> I think it's powerpc material, but I won't mind if Andrew picks it up :)
>> >
>> > Via the powerpc tree would be better, please.
>>
>> I'll take it into next for v5.9, unless there's a reason it needs to go
>> into v5.8.
>
> I consider it a fixup for 5.8 merge window conflicts. Besides, mering it
> now may avoid new conflicts in 5.9 ;-)
OK, I'll pick it up for v5.8.
cheers
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc/8xx: use pmd_off() to access a PMD entry in pte_update()
2020-06-15 9:22 [PATCH] powerpc/8xx: use pmd_off() to access a PMD entry in pte_update() Mike Rapoport
2020-06-15 9:32 ` Christophe Leroy
2020-06-16 19:43 ` Andrew Morton
@ 2020-06-18 12:37 ` Michael Ellerman
2 siblings, 0 replies; 7+ messages in thread
From: Michael Ellerman @ 2020-06-18 12:37 UTC (permalink / raw)
To: Michael Ellerman, Andrew Morton, Mike Rapoport
Cc: linuxppc-dev, linux-kernel, Christophe Leroy, Mike Rapoport, linux-mm
On Mon, 15 Jun 2020 12:22:29 +0300, Mike Rapoport wrote:
> The pte_update() implementation for PPC_8xx unfolds page table from the PGD
> level to access a PMD entry. Since 8xx has only 2-level page table this can
> be simplified with pmd_off() shortcut.
>
> Replace explicit unfolding with pmd_off() and drop defines of pgd_index()
> and pgd_offset() that are no longer needed.
Applied to powerpc/fixes.
[1/1] powerpc/8xx: use pmd_off() to access a PMD entry in pte_update()
https://git.kernel.org/powerpc/c/687993ccf3b05070598b89fad97410b26d7bc9d2
cheers
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-06-18 12:37 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-15 9:22 [PATCH] powerpc/8xx: use pmd_off() to access a PMD entry in pte_update() Mike Rapoport
2020-06-15 9:32 ` Christophe Leroy
2020-06-16 19:43 ` Andrew Morton
2020-06-16 23:21 ` Michael Ellerman
2020-06-17 4:16 ` Mike Rapoport
2020-06-17 13:05 ` Michael Ellerman
2020-06-18 12:37 ` Michael Ellerman
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).