From: Claudio Imbrenda <imbrenda@linux.ibm.com>
To: Hugh Dickins <hughd@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Mike Kravetz <mike.kravetz@oracle.com>,
Mike Rapoport <rppt@kernel.org>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Matthew Wilcox <willy@infradead.org>,
David Hildenbrand <david@redhat.com>,
Suren Baghdasaryan <surenb@google.com>,
Qi Zheng <zhengqi.arch@bytedance.com>,
Russell King <linux@armlinux.org.uk>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Greg Ungerer <gerg@linux-m68k.org>,
Michal Simek <monstr@monstr.eu>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Helge Deller <deller@gmx.de>,
John David Anglin <dave.anglin@bell.net>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Alexandre Ghiti <alexghiti@rivosinc.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Heiko Carstens <hca@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
"David S. Miller" <davem@davemloft.net>,
Chris Zankel <chris@zankel.net>,
Max Filippov <jcmvbkbc@gmail.com>,
x86@kernel.org, linux-arm-kernel@lists.infradead.org,
linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org,
linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org,
linux-s390@vger.kernel.org, linux-sh@vger.kernel.org,
sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [PATCH 15/23] s390: allow pte_offset_map_lock() to fail
Date: Wed, 17 May 2023 12:35:46 +0200 [thread overview]
Message-ID: <20230517123546.672fb9b0@p-imbrenda> (raw)
In-Reply-To: <94aec8fe-383f-892-dcbf-d4c14e460a7@google.com>
On Tue, 9 May 2023 22:01:16 -0700 (PDT)
Hugh Dickins <hughd@google.com> wrote:
> In rare transient cases, not yet made possible, pte_offset_map() and
> pte_offset_map_lock() may not find a page table: handle appropriately.
>
> Signed-off-by: Hugh Dickins <hughd@google.com>
> ---
> arch/s390/kernel/uv.c | 2 ++
> arch/s390/mm/gmap.c | 2 ++
> arch/s390/mm/pgtable.c | 12 +++++++++---
> 3 files changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/arch/s390/kernel/uv.c b/arch/s390/kernel/uv.c
> index cb2ee06df286..3c62d1b218b1 100644
> --- a/arch/s390/kernel/uv.c
> +++ b/arch/s390/kernel/uv.c
> @@ -294,6 +294,8 @@ int gmap_make_secure(struct gmap *gmap, unsigned long gaddr, void *uvcb)
>
> rc = -ENXIO;
> ptep = get_locked_pte(gmap->mm, uaddr, &ptelock);
> + if (!ptep)
> + goto out;
> if (pte_present(*ptep) && !(pte_val(*ptep) & _PAGE_INVALID) && pte_write(*ptep)) {
> page = pte_page(*ptep);
> rc = -EAGAIN;
> diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c
> index dc90d1eb0d55..d198fc9475a2 100644
> --- a/arch/s390/mm/gmap.c
> +++ b/arch/s390/mm/gmap.c
> @@ -2549,6 +2549,8 @@ static int __zap_zero_pages(pmd_t *pmd, unsigned long start,
> spinlock_t *ptl;
>
> ptep = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
> + if (!ptep)
> + break;
so if pte_offset_map_lock fails, we abort and skip both the failed
entry and the rest of the entries?
can pte_offset_map_lock be retried immediately if it fails? (consider
that we currently don't allow THP with KVM guests)
Would something like this:
do {
ptep = pte_offset_map_lock(...);
mb(); /* maybe? */
} while (!ptep);
make sense?
otherwise maybe it's better to return an error and retry the whole
walk_page_range() in s390_enable_sie() ? it's a slow path anyway.
> if (is_zero_pfn(pte_pfn(*ptep)))
> ptep_xchg_direct(walk->mm, addr, ptep, __pte(_PAGE_INVALID));
> pte_unmap_unlock(ptep, ptl);
[...]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-05-17 10:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <77a5d8c-406b-7068-4f17-23b7ac53bc83@google.com>
[not found] ` <ZFs0k2rrLPH9A/UU@casper.infradead.org>
[not found] ` <d7f3c7b2-25b8-ef66-98a8-43d68f4499f@google.com>
[not found] ` <ZFz1j1slZHCQmwMJ@casper.infradead.org>
2023-05-16 10:41 ` [PATCH 00/23] arch: allow pte_offset_map[_lock]() to fail Peter Zijlstra
[not found] ` <94aec8fe-383f-892-dcbf-d4c14e460a7@google.com>
2023-05-17 10:35 ` Claudio Imbrenda [this message]
2023-05-17 21:50 ` [PATCH 15/23] s390: allow pte_offset_map_lock() " Hugh Dickins
2023-05-23 12:00 ` Claudio Imbrenda
2023-05-24 1:49 ` Hugh Dickins
2023-05-25 7:23 ` Claudio Imbrenda
[not found] ` <5579873-d7b-65e-5de0-a2ba8a144e7@google.com>
2023-05-17 11:28 ` [PATCH 16/23] s390: gmap use pte_unmap_unlock() not spin_unlock() Alexander Gordeev
[not found] ` <e72f6f3e-a8d4-3ed-2b4-5d3ced41484@google.com>
2023-05-25 16:37 ` [PATCH 02/23] arm64: allow pte_offset_map() to fail Catalin Marinas
[not found] ` <dda2885-929b-c278-14e-5f447e9eec52@google.com>
2023-05-25 16:37 ` [PATCH 03/23] arm64/hugetlb: pte_alloc_huge() pte_offset_huge() Catalin Marinas
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=20230517123546.672fb9b0@p-imbrenda \
--to=imbrenda@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=alexghiti@rivosinc.com \
--cc=aneesh.kumar@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=catalin.marinas@arm.com \
--cc=chris@zankel.net \
--cc=dave.anglin@bell.net \
--cc=davem@davemloft.net \
--cc=david@redhat.com \
--cc=deller@gmx.de \
--cc=geert@linux-m68k.org \
--cc=gerg@linux-m68k.org \
--cc=glaubitz@physik.fu-berlin.de \
--cc=hca@linux.ibm.com \
--cc=hughd@google.com \
--cc=jcmvbkbc@gmail.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mike.kravetz@oracle.com \
--cc=monstr@monstr.eu \
--cc=mpe@ellerman.id.au \
--cc=palmer@dabbelt.com \
--cc=rppt@kernel.org \
--cc=sparclinux@vger.kernel.org \
--cc=surenb@google.com \
--cc=tsbogend@alpha.franken.de \
--cc=will@kernel.org \
--cc=willy@infradead.org \
--cc=x86@kernel.org \
--cc=zhengqi.arch@bytedance.com \
/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).