From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5B556C7EE22 for ; Thu, 11 May 2023 02:58:53 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4QGxRv53fvz3fPq for ; Thu, 11 May 2023 12:58:51 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20221208 header.b=A/8Yl5mL; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=google.com (client-ip=2607:f8b0:4864:20::b36; helo=mail-yb1-xb36.google.com; envelope-from=hughd@google.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20221208 header.b=A/8Yl5mL; dkim-atps=neutral Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4QGxQz5Gxgz3bqB for ; Thu, 11 May 2023 12:58:02 +1000 (AEST) Received: by mail-yb1-xb36.google.com with SMTP id 3f1490d57ef6-b9a7e639656so11925205276.0 for ; Wed, 10 May 2023 19:58:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683773878; x=1686365878; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=VKY0MPg+ixVSR7jOZPK9uKssH+HTM4GRvqWKWUn/BFA=; b=A/8Yl5mLDDyzpMzxH/65tVA6ZiqBtbA3d9RA8fCNCX4cspZ3FSeBdW0oUC/QrOwu05 JoxxoIZTWWZvG9sUA5Kt4j/mCk5PbrWXYCjVoAOE6DA24+iPz85mkYE73LNDr0oFWCdT rH/bRk56/wMHo6z0qHtG+YSqxp4dd4t3ZJ8DxDyJqTsMSx9i6fBtQEQ4PO2NHpeCsaUL CWzLaMlncwyqAXylxS2D1Zyo1qpYkgLrxXJlwsKj/b67fZ4WppqlP9S5HEb7GRAykDlw k/Vb5i8FWzhnGt6pe/zFYyUpDBBrPTmJLrRKIFY1WW7hoXogJGukSIZoffaAETEPY/4t xZVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683773878; x=1686365878; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VKY0MPg+ixVSR7jOZPK9uKssH+HTM4GRvqWKWUn/BFA=; b=Rgfv1QauYRMayyBCn9QhzmeFL1COKB4daktMLBbcavHYLr4YIkBSjwA+WUkXwAw51A smQGN/TqShzC7EpLPVXivOBWil5Tu7iEM8MpK+1Qiw1/lkGuBQQTqlnZRsBtsZiu5Wwd 8ro7z3DKZ9ZZfAvWiL7GUsMBxWrCY7tXAJNLfA6qRiNYAXEmqZAofIzLUvkUFjguV6RC fMfh6Hw0BUonTgsSe/wzs7i4FCTQzv9J/Dzym/tzbskGfTuQ6LJ/hshqS5n74B+3WvjP RdGfDUBVbgvfnaGnEISwercYSxUX8SEzy+S/NAD+1oAFWPgH7JMkxGuECzDcNgWu/Q9e G3EQ== X-Gm-Message-State: AC+VfDwMJiH2OVL/MCiZf/XG00GQJJi0SHHt22n0H2065FvT/L7V309B h11ViA/+oNr8GyFIX9IH2+n/cA== X-Google-Smtp-Source: ACHHUZ6C0n0sBeLY7gcn1OD5R2jloe8ods8pFVDt6dBMBTUUJpoOKztQObF61f5mEv/MRTTUjmAJWA== X-Received: by 2002:a81:d54b:0:b0:55a:2102:1699 with SMTP id l11-20020a81d54b000000b0055a21021699mr20828006ywj.11.1683773877637; Wed, 10 May 2023 19:57:57 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id q6-20020a0de706000000b0055a07e36659sm4496591ywe.145.2023.05.10.19.57.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 May 2023 19:57:57 -0700 (PDT) Date: Wed, 10 May 2023 19:57:46 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Geert Uytterhoeven Subject: Re: [PATCH 05/23] m68k: allow pte_offset_map[_lock]() to fail In-Reply-To: Message-ID: References: <77a5d8c-406b-7068-4f17-23b7ac53bc83@google.com> <237c8410-ce61-94c-4260-7318ad6a4f3@google.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="-1463760895-840625160-1683773877=:9548" X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-ia64@vger.kernel.org, David Hildenbrand , Catalin Marinas , Qi Zheng , linux-kernel@vger.kernel.org, Max Filippov , sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org, Claudio Imbrenda , Will Deacon , Greg Ungerer , linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, Helge Deller , x86@kernel.org, Hugh Dickins , Russell King , Matthew Wilcox , Christian Borntraeger , Alexandre Ghiti , Heiko Carstens , linux-m68k@lists.linux-m68k.org, John Paul Adrian Glaubitz , John David Anglin , Suren Baghdasaryan , linux-arm-kernel@lists.infradead.org, Chris Zankel , Michal Simek , Thomas Bogendoerfer , linux-parisc@vger.kernel.org, linux-mm@kvack.org, linux-mips@vger.kernel.org, Palmer Dabbelt , "Kirill A. Shutemov" , "Aneesh Kumar K.V" , Andrew Morton , linuxppc-dev@lists.ozlabs.org, "David S. Miller" , Mike Rapoport , Mike Kravetz Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---1463760895-840625160-1683773877=:9548 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Wed, 10 May 2023, Geert Uytterhoeven wrote: > Hi Hugh, >=20 > Thanks for your patch! And thank you for looking so quickly, Geert. >=20 > On Wed, May 10, 2023 at 6:48=E2=80=AFAM Hugh Dickins w= rote: > > In rare transient cases, not yet made possible, pte_offset_map() and > > pte_offset_map_lock() may not find a page table: handle appropriately. > > > > Restructure cf_tlb_miss() with a pte_unmap() (previously omitted) > > at label out, followed by one local_irq_restore() for all. >=20 > That's a bug fix, which should be a separate patch? No, that's not a bug fix for the current tree, since m68k does not offer CONFIG_HIGHPTE, so pte_unmap() is never anything but a no-op for m68k (see include/linux/pgtable.h). But I want to change pte_unmap() to do something even without CONFIG_HIGHPTE, so have to fix up any such previously harmless omissions in this series first. >=20 > > > > Signed-off-by: Hugh Dickins >=20 >=20 > > --- a/arch/m68k/include/asm/mmu_context.h > > +++ b/arch/m68k/include/asm/mmu_context.h > > @@ -99,7 +99,7 @@ static inline void load_ksp_mmu(struct task_struct *t= ask) > > p4d_t *p4d; > > pud_t *pud; > > pmd_t *pmd; > > - pte_t *pte; > > + pte_t *pte =3D NULL; > > unsigned long mmuar; > > > > local_irq_save(flags); > > @@ -139,7 +139,7 @@ static inline void load_ksp_mmu(struct task_struct = *task) > > > > pte =3D (mmuar >=3D PAGE_OFFSET) ? pte_offset_kernel(pmd, mmuar= ) > > : pte_offset_map(pmd, mmuar); > > - if (pte_none(*pte) || !pte_present(*pte)) > > + if (!pte || pte_none(*pte) || !pte_present(*pte)) > > goto bug; >=20 > If the absence of a pte is to become a non-abnormal case, it should > probably jump to "end" instead, to avoid spamming the kernel log. I don't think so (but of course it's hard for you to tell, without seeing all completed series of series). If pmd_none(*pmd) can safely goto bug just above, and pte_none(*pte) goto bug here, well, the !pte case is going to be stranger than either of those. My understanding of this function, load_ksp_mmu(), is that it's dealing at context switch with a part of userspace which very much needs to be present: whatever keeps that from being swapped out or migrated at present, will be sure to keep the !pte case away - we cannot steal its page table just at random (and a THP on m68k would be surprising too). Though there is one case I can think of which will cause !pte here, and so goto bug: if the pmd entry has got corrupted, and counts as pmd_bad(), which will be tested (and cleared) in pte_offset_map(). But it is okay to report a bug in that case. I can certainly change this to goto end instead if you still prefer, no problem; but I'd rather keep it as is, if only for me to be proved wrong by you actually seeing spam there. >=20 > > > > set_pte(pte, pte_mkyoung(*pte)); > > @@ -161,6 +161,8 @@ static inline void load_ksp_mmu(struct task_struct = *task) > > bug: > > pr_info("ksp load failed: mm=3D0x%p ksp=3D0x08%lx\n", mm, mmuar= ); > > end: > > + if (pte && mmuar < PAGE_OFFSET) > > + pte_unmap(pte); >=20 > Is this also a bugfix, not mentioned in the patch description? I'm not sure whether you're referring to the pte_unmap() which we already discussed above, or you're seeing something else in addition; but I don't think there's a bugfix here, just a rearrangement because we now want lots of cases to do the pte_unmap() and local_irq_restore(). Hugh >=20 > > local_irq_restore(flags); > > } > > >=20 > Gr{oetje,eeting}s, >=20 > Geert >=20 > --=20 > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m6= 8k.org >=20 > In personal conversations with technical people, I call myself a hacker. = But > when I'm talking to journalists I just say "programmer" or something like= that. > -- Linus Torvalds ---1463760895-840625160-1683773877=:9548--