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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80DADC7EE22 for ; Thu, 11 May 2023 02:58:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 06C4C6B0072; Wed, 10 May 2023 22:58:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 01C3F6B0074; Wed, 10 May 2023 22:58:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E26776B0075; Wed, 10 May 2023 22:58:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id D4E116B0072 for ; Wed, 10 May 2023 22:58:00 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 9BFD58085F for ; Thu, 11 May 2023 02:58:00 +0000 (UTC) X-FDA: 80776464720.21.703551A Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) by imf18.hostedemail.com (Postfix) with ESMTP id CE4441C0003 for ; Thu, 11 May 2023 02:57:58 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b="A/8Yl5mL"; spf=pass (imf18.hostedemail.com: domain of hughd@google.com designates 209.85.128.169 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1683773878; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=VKY0MPg+ixVSR7jOZPK9uKssH+HTM4GRvqWKWUn/BFA=; b=as6Jxb6EfnEABXS948YVtoOYPBZFAmHj0MRs+HskYeHyhX9T8fV5oyVdkfENSmF+zYU/ij sKYQGig9fUlMQKl1FKReGz9r0FEk4yT4Pw41epfJU9wFBHnW5Q2H+s6NJrnV+ff8hOyk9G PxdlcVFjCSGDsib8Pz8Puc+f0iJR6ZY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1683773878; a=rsa-sha256; cv=none; b=68Uc6REqkPpmQy6sk8juUU8HBkvPkaYhpnpQNUa0qblWd66lC9Z/XZrmUWMx7P9DYmwY2c dVrIjdfvInY0m9xk8fj+w8ki0uu1gophue7MKVZ87cCNb7eVeKYWHb7Y30f1qA9HlwP3Wx xrjJgVVid9tSjZEygAELroyemejXgfg= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b="A/8Yl5mL"; spf=pass (imf18.hostedemail.com: domain of hughd@google.com designates 209.85.128.169 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-55a00da4e53so143679057b3.0 for ; Wed, 10 May 2023 19:57:58 -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=SFxd/bK1l5Vb8EQo8PW2QfP7u7qcIxG9Fr7t6AXFoagCAV3LSujsXH4cu31oo1UELd peXqGOZ938UFIuVTaxOIjS++R0uINRG6Kl3+jecL1sOX0S/gCmeZNjLPFIpmVjqlVo63 QuTvggm7sJI3mMkqNF35mCpmHEh/zPaSYiLjN/+ydSQJhWtCOTuelxL0jntpAvzAVAJh BKmn2qltxZRZJuW0NBlDsKduuNmi9znJ39l0OdXCx78PfU5ySaflXnbk4dDTtIgIFtvH 2Ag2bdYSnKioG6eFhKguJUGVFMKibb/DPfjoWArIT2AVlu90XaY/qs426ZA4nEWuUB92 t8fg== X-Gm-Message-State: AC+VfDzinY5JjwfR9etZhPAlqym+kTapPGVIjIBy+NVLWFI4XnmnVgop FPEIoh5pLJ0sjdYyn7qqX5W0hg== 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 cc: Hugh Dickins , Andrew Morton , Mike Kravetz , Mike Rapoport , "Kirill A. Shutemov" , Matthew Wilcox , David Hildenbrand , Suren Baghdasaryan , Qi Zheng , Russell King , Catalin Marinas , Will Deacon , Greg Ungerer , Michal Simek , Thomas Bogendoerfer , Helge Deller , John David Anglin , "Aneesh Kumar K.V" , Michael Ellerman , Alexandre Ghiti , Palmer Dabbelt , Heiko Carstens , Christian Borntraeger , Claudio Imbrenda , John Paul Adrian Glaubitz , "David S. Miller" , Chris Zankel , Max Filippov , 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 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-Rspamd-Queue-Id: CE4441C0003 X-Stat-Signature: jj7masweoeo7mpmtizsr3nkbmaxgm6bp X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1683773878-647639 X-HE-Meta: U2FsdGVkX1/C0XquYG32d0ssr3PmVJrzMMHWJtqv2YRcFJhWrxAR5vWIr+Xg4YqyIf2IETwRPIhYtTjtCoZm/SE9tL/YqVnzUJK+IGb7Bm+T6q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8qv4s5TKU8SfndHdF9qo11SXjtu0HjhoYWghmcH45zMBR2509h31zULGTOtgmMKWjIHK6kHO/N7zC+bZTAOo2xqP6rH5f1QVz0nU5KuI5aqvybf/ELy4O3GA1bVze5d7mpTT4SMldLzux1usdy1bP4lUWxuOU9NMrEvT1QfqRnwX4Q8Cnut6wJUpkVlJHUivWD++3OsRofKYCy+Y/q/Lig1qprupQPjRa3jE99Oyek/JxMAKthLMaSfsIJs2gjmHAHxe8U4wUgbXmAawTZKcHsbyT+FB4eZdfZl+YNxygQhroJYzPc3W4HUDQKvMaG9U4zU/6CIGhkN/iNKct78UB17Nbh+4TTKZmWziSRe7IXr5zl90tz8ZcuKr3W+136 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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--