From: Rohan McLure <rmclure@linux.ibm.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH v9 4/7] powerpc: mm: Default p{m,u}d_pte implementations
Date: Mon, 11 Dec 2023 13:53:40 +1100 [thread overview]
Message-ID: <8ff974c9-994d-7aae-39cb-dfe69646ce9d@linux.ibm.com> (raw)
In-Reply-To: <5305d752-5161-41ea-9832-c629dc93dc3b@csgroup.eu>
On 11/30/23 18:35, Christophe Leroy wrote:
>
> Le 30/11/2023 à 03:53, Rohan McLure a écrit :
>> For 32-bit systems which have no usecases for p{m,u}d_pte() prior to
>> page table checking, implement default stubs.
> Is that the best solution ?
>
> If I understand correctly, it is only needed for
> pmd_user_accessible_page(). Why not provide a stub
> pmd_user_accessible_page() that returns false on those architectures ?
Yep, this seems reasonable to me.
>
> Same for pud_user_accessible_page()
>
> But if you decide to keep it I think that:
> - It should be squashed with following patch to make it clear it's
> needed for that only.
> - Remove the WARN_ONCE().
I might however move those WARN_ONCE() calls to the default, false-returning
p{m,u}d_user_accessible_page() implementations, to be consistent with
pud_pfn().
> - Only have a special one for books/64 and a generic only common to he 3
> others.
>
>> Signed-off-by: Rohan McLure <rmclure@linux.ibm.com>
>> ---
>> v9: New patch
>> ---
>> arch/powerpc/include/asm/book3s/64/pgtable.h | 3 +++
>> arch/powerpc/include/asm/nohash/64/pgtable.h | 2 ++
>> arch/powerpc/include/asm/pgtable.h | 17 +++++++++++++++++
>> 3 files changed, 22 insertions(+)
>>
>> diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h
>> index 8fdb7667c509..2454174b26cb 100644
>> --- a/arch/powerpc/include/asm/book3s/64/pgtable.h
>> +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h
>> @@ -887,6 +887,8 @@ static inline int pud_present(pud_t pud)
>>
>> extern struct page *pud_page(pud_t pud);
>> extern struct page *pmd_page(pmd_t pmd);
>> +
>> +#define pud_pte pud_pte
>> static inline pte_t pud_pte(pud_t pud)
>> {
>> return __pte_raw(pud_raw(pud));
>> @@ -1043,6 +1045,7 @@ static inline void __kernel_map_pages(struct page *page, int numpages, int enabl
>> }
>> #endif
>>
>> +#define pmd_pte pmd_pte
>> static inline pte_t pmd_pte(pmd_t pmd)
>> {
>> return __pte_raw(pmd_raw(pmd));
>> diff --git a/arch/powerpc/include/asm/nohash/64/pgtable.h b/arch/powerpc/include/asm/nohash/64/pgtable.h
>> index f58cbebde26e..09a34fe196ae 100644
>> --- a/arch/powerpc/include/asm/nohash/64/pgtable.h
>> +++ b/arch/powerpc/include/asm/nohash/64/pgtable.h
>> @@ -93,6 +93,7 @@ static inline void pmd_clear(pmd_t *pmdp)
>> *pmdp = __pmd(0);
>> }
>>
>> +#define pmd_pte pmd_pte
>> static inline pte_t pmd_pte(pmd_t pmd)
>> {
>> return __pte(pmd_val(pmd));
>> @@ -134,6 +135,7 @@ static inline pmd_t *pud_pgtable(pud_t pud)
>>
>> extern struct page *pud_page(pud_t pud);
>>
>> +#define pud_pte pud_pte
>> static inline pte_t pud_pte(pud_t pud)
>> {
>> return __pte(pud_val(pud));
>> diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
>> index 9c0f2151f08f..d7d0f47760d3 100644
>> --- a/arch/powerpc/include/asm/pgtable.h
>> +++ b/arch/powerpc/include/asm/pgtable.h
>> @@ -233,6 +233,23 @@ static inline int pud_pfn(pud_t pud)
>> }
>> #endif
>>
>> +#ifndef pmd_pte
>> +#define pmd_pte pmd_pte
>> +static inline pte_t pmd_pte(pmd_t pmd)
>> +{
>> + WARN_ONCE(1, "pmd: platform does not use pmd entries directly");
>> + return __pte(pmd_val(pmd));
>> +}
>> +#endif
>> +
>> +#ifndef pud_pte
>> +#define pud_pte pud_pte
>> +static inline pte_t pud_pte(pud_t pud)
>> +{
>> + WARN_ONCE(1, "pud: platform does not use pud entries directly");
>> + return __pte(pud_val(pud));
>> +}
>> +#endif
>> #endif /* __ASSEMBLY__ */
>>
>> #endif /* _ASM_POWERPC_PGTABLE_H */
next prev parent reply other threads:[~2023-12-11 2:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-30 2:53 [PATCH v9 0/7] Support page table check Rohan McLure
2023-11-30 2:53 ` [PATCH v9 1/7] powerpc: mm: Replace p{u,m,4}d_is_leaf with p{u,m,4}_leaf Rohan McLure
2023-11-30 2:53 ` [PATCH v9 2/7] powerpc: mm: Implement p{m,u,4}d_leaf on all platforms Rohan McLure
2023-11-30 6:36 ` Christophe Leroy
2023-11-30 2:53 ` [PATCH v9 3/7] powerpc: mm: Add common pud_pfn stub for " Rohan McLure
2023-11-30 6:43 ` Christophe Leroy
2023-11-30 2:53 ` [PATCH v9 4/7] powerpc: mm: Default p{m,u}d_pte implementations Rohan McLure
2023-11-30 7:35 ` Christophe Leroy
2023-12-11 2:53 ` Rohan McLure [this message]
2023-11-30 2:53 ` [PATCH v9 5/7] poweprc: mm: Implement *_user_accessible_page() for ptes Rohan McLure
2023-11-30 7:01 ` Christophe Leroy
2023-11-30 2:53 ` [PATCH v9 6/7] powerpc: mm: Use __set_pte_at() for early-boot / internal usages Rohan McLure
2023-11-30 7:18 ` Christophe Leroy
2023-11-30 2:54 ` [PATCH v9 7/7] powerpc: mm: Support page table check Rohan McLure
2023-11-30 7:28 ` Christophe Leroy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8ff974c9-994d-7aae-39cb-dfe69646ce9d@linux.ibm.com \
--to=rmclure@linux.ibm.com \
--cc=christophe.leroy@csgroup.eu \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).