linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Rohan McLure <rmclure@linux.ibm.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH v6 2/7] powerpc/64s: mm: Introduce __pmdp_collapse_flush with mm_struct argument
Date: Wed, 15 Feb 2023 11:40:22 +1100	[thread overview]
Message-ID: <DD3ED59C-DCD0-4439-8964-179096E79E2A@linux.ibm.com> (raw)
In-Reply-To: <FA939CA4-75C6-441C-8289-EB669C9777D5@linux.ibm.com>

> On 15 Feb 2023, at 11:17 am, Rohan McLure <rmclure@linux.ibm.com> wrote:
> 
>> On 14 Feb 2023, at 5:02 pm, Christophe Leroy <christophe.leroy@csgroup.eu> wrote:
>> 
>> 
>> 
>> Le 14/02/2023 à 02:59, Rohan McLure a écrit :
>>> pmdp_collapse_flush has references in generic code with just three
>>> parameters, due to the choice of mm context being implied by the vm_area
>>> context parameter.
>>> 
>>> Define __pmdp_collapse_flush to accept an additional mm_struct *
>>> parameter, with pmdp_collapse_flush a macro that unpacks the vma and
>>> calls __pmdp_collapse_flush. The mm_struct * parameter is needed in a
>>> future patch providing Page Table Check support, which is defined in
>>> terms of mm context objects.
>>> 
>>> Signed-off-by: Rohan McLure <rmclure@linux.ibm.com>
>>> ---
>>> v6: New patch
>>> ---
>>> arch/powerpc/include/asm/book3s/64/pgtable.h | 14 +++++++++++---
>>> 1 file changed, 11 insertions(+), 3 deletions(-)
>>> 
>>> diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h
>>> index cb4c67bf45d7..9d8b4e25f5ed 100644
>>> --- a/arch/powerpc/include/asm/book3s/64/pgtable.h
>>> +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h
>>> @@ -1244,14 +1244,22 @@ static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm,
>>>  return hash__pmdp_huge_get_and_clear(mm, addr, pmdp);
>>> }
>>> 
>>> -static inline pmd_t pmdp_collapse_flush(struct vm_area_struct *vma,
>>> - unsigned long address, pmd_t *pmdp)
>>> +static inline pmd_t __pmdp_collapse_flush(struct vm_area_struct *vma, struct mm_struct *mm,
>>> +  unsigned long address, pmd_t *pmdp)
>>> {
>>>  if (radix_enabled())
>>>  return radix__pmdp_collapse_flush(vma, address, pmdp);
>>>  return hash__pmdp_collapse_flush(vma, address, pmdp);
>>> }
>>> -#define pmdp_collapse_flush pmdp_collapse_flush
>>> +#define pmdp_collapse_flush(vma, addr, pmdp) \
>>> +({ \
>>> + struct vm_area_struct *_vma = (vma); \
>>> + pmd_t _r; \
>>> + \
>>> + _r = __pmdp_collapse_flush(_vma, _vma->vm_mm, (addr), (pmdp)); \
>>> + \
>>> + _r; \
>>> +})
>> 
>> Can you make it a static inline function instead of a ugly macro ?
> 
> Due to some header hell, it’s looking like this location only has access to
> a prototype for struct vm_area_struct. Might have to remain a macro then.
> 
> Probably don’t need to expliclty declare a variable for the macro ‘return’
> though.

It’s the same solution opted for by ptep_test_and_clear_young.

#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
#define ptep_test_and_clear_young(__vma, __addr, __ptep)	\
({								\
	__ptep_test_and_clear_young((__vma)->vm_mm, __addr, __ptep); \
})

> 
>> 
>>> 
>>> #define __HAVE_ARCH_PMDP_HUGE_GET_AND_CLEAR_FULL
>>> pmd_t pmdp_huge_get_and_clear_full(struct vm_area_struct *vma,



  reply	other threads:[~2023-02-15  0:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-14  1:59 [PATCH v6 0/7] Support page table check Rohan McLure
2023-02-14  1:59 ` [PATCH v6 1/7] powerpc: mm: Separate set_pte, set_pte_at for internal, external use Rohan McLure
2023-02-14  5:59   ` Christophe Leroy
2023-02-14  1:59 ` [PATCH v6 2/7] powerpc/64s: mm: Introduce __pmdp_collapse_flush with mm_struct argument Rohan McLure
2023-02-14  6:02   ` Christophe Leroy
2023-02-15  0:17     ` Rohan McLure
2023-02-15  0:40       ` Rohan McLure [this message]
2023-02-14  1:59 ` [PATCH v6 3/7] powerpc: mm: Replace p{u,m,4}d_is_leaf with p{u,m,4}_leaf Rohan McLure
2023-02-14  1:59 ` [PATCH v6 4/7] powerpc: mm: Implement p{m,u,4}d_leaf on all platforms Rohan McLure
2023-02-14  1:59 ` [PATCH v6 5/7] powerpc: mm: Add common pud_pfn stub for " Rohan McLure
2023-02-14  1:59 ` [PATCH v6 6/7] powerpc: mm: Add p{te,md,ud}_user_accessible_page helpers Rohan McLure
2023-02-14  1:59 ` [PATCH v6 7/7] powerpc: mm: Support page table check Rohan McLure
2023-02-14  6:14   ` 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=DD3ED59C-DCD0-4439-8964-179096E79E2A@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).