Re: [PATCH 08/23] parisc: add pte_unmap() to balance get_ptep()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Helge Deller <deller@xxxxxx>
- Subject: Re: [PATCH 08/23] parisc: add pte_unmap() to balance get_ptep()
- From: Hugh Dickins <hughd@xxxxxxxxxx>
- Date: Sun, 14 May 2023 11:20:16 -0700 (PDT)
- Cc: Hugh Dickins <hughd@xxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Mike Kravetz <mike.kravetz@xxxxxxxxxx>, Mike Rapoport <rppt@xxxxxxxxxx>, "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx>, Matthew Wilcox <willy@xxxxxxxxxxxxx>, David Hildenbrand <david@xxxxxxxxxx>, Suren Baghdasaryan <surenb@xxxxxxxxxx>, Qi Zheng <zhengqi.arch@xxxxxxxxxxxxx>, Russell King <linux@xxxxxxxxxxxxxxx>, Catalin Marinas <catalin.marinas@xxxxxxx>, Will Deacon <will@xxxxxxxxxx>, Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>, Greg Ungerer <gerg@xxxxxxxxxxxxxx>, Michal Simek <monstr@xxxxxxxxx>, Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>, John David Anglin <dave.anglin@xxxxxxxx>, "Aneesh Kumar K.V" <aneesh.kumar@xxxxxxxxxxxxx>, Michael Ellerman <mpe@xxxxxxxxxxxxxx>, Alexandre Ghiti <alexghiti@xxxxxxxxxxxx>, Palmer Dabbelt <palmer@xxxxxxxxxxx>, Heiko Carstens <hca@xxxxxxxxxxxxx>, Christian Borntraeger <borntraeger@xxxxxxxxxxxxx>, Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>, John Paul Adrian Glaubitz <glaubitz@xxxxxxxxxxxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, Chris Zankel <chris@xxxxxxxxxx>, Max Filippov <jcmvbkbc@xxxxxxxxx>, x86@xxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linux-m68k@xxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, linux-parisc@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, linux-riscv@xxxxxxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, linux-sh@xxxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx
- In-reply-to: <ca4ac780-42b0-4818-bd84-e1a4acbb28dd@gmx.de>
- References: <77a5d8c-406b-7068-4f17-23b7ac53bc83@google.com> <44ebbf90-5fbb-2815-17c7-fcfe3c87d78e@google.com> <ca4ac780-42b0-4818-bd84-e1a4acbb28dd@gmx.de>
On Sat, 13 May 2023, Helge Deller wrote:
> Hi Hugh,
>
> On 5/10/23 06:52, Hugh Dickins wrote:
> > To keep balance in future, remember to pte_unmap() after a successful
> > get_ptep(). And (we might as well) pretend that flush_cache_pages()
> > really needed a map there, to read the pfn before "unmapping".
> >
> > Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx>
> > ---
> > arch/parisc/kernel/cache.c | 26 +++++++++++++++++++++-----
> > 1 file changed, 21 insertions(+), 5 deletions(-)
> >
> > diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
> > index 1d3b8bc8a623..b0c969b3a300 100644
> > --- a/arch/parisc/kernel/cache.c
> > +++ b/arch/parisc/kernel/cache.c
> > @@ -425,10 +425,15 @@ void flush_dcache_page(struct page *page)
> > offset = (pgoff - mpnt->vm_pgoff) << PAGE_SHIFT;
> > addr = mpnt->vm_start + offset;
> > if (parisc_requires_coherency()) {
> > + bool needs_flush = false;
> > pte_t *ptep;
> >
> > ptep = get_ptep(mpnt->vm_mm, addr);
> > - if (ptep && pte_needs_flush(*ptep))
> > + if (ptep) {
> > + needs_flush = pte_needs_flush(*ptep);
> > + pte_unmap(ptep);
> > + }
> > + if (needs_flush)
> > flush_user_cache_page(mpnt, addr);
> > } else {
> > /*
> > @@ -560,14 +565,20 @@ EXPORT_SYMBOL(flush_kernel_dcache_page_addr);
> > static void flush_cache_page_if_present(struct vm_area_struct *vma,
> > unsigned long vmaddr, unsigned long pfn)
> > {
> > - pte_t *ptep = get_ptep(vma->vm_mm, vmaddr);
> > + bool needs_flush = false;
> > + pte_t *ptep;
> >
> > /*
> > * The pte check is racy and sometimes the flush will trigger
> > * a non-access TLB miss. Hopefully, the page has already been
> > * flushed.
> > */
> > - if (ptep && pte_needs_flush(*ptep))
> > + ptep = get_ptep(vma->vm_mm, vmaddr);
> > + if (ptep) {
> > + needs_flush = pte_needs_flush(*ptep))
>
> ^^^^^
> One ")" too much and lacks a trailing ";"
> Should be:
> needs_flush = pte_needs_flush(*ptep);
>
> With that fixed the kernel compiles and boots sucessfully on parisc.
Urgh! Indeed, thanks a lot Helge: I'll fold that in.
Hugh
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]