Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6895705rwr; Wed, 10 May 2023 00:28:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5VmAIUMMdUnGBpLt6/w4nfAZ013eTjaDOVwkeFA7UPZGE3ITaZNCrnuDjuVD4lg9dgqAZk X-Received: by 2002:aa7:88ce:0:b0:645:6142:7f5a with SMTP id k14-20020aa788ce000000b0064561427f5amr13539690pff.3.1683703730855; Wed, 10 May 2023 00:28:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683703730; cv=none; d=google.com; s=arc-20160816; b=TUJsiuk3DjTdvRC3r/0wOX97TyjswRctyIh2dG/QKku6+6PSXUMupy0G/D0986+Moc Tvwpjtwz8QLcU/YwWQvYb2g75tLz/s1MRGaQ/HmEU/1Ouux6SijgMUM4gyY0tWZsdIvS jFzwKj3cZaSBQvzwUvxwYPrGgudIJ6ES9XWpDCpSs2xFZ5OtTeTX5QosuIze7YpmIHh3 bCba+8ve62UThU2GlXB3Ilo+RIt/wDAQ72iX77wZIMzeoFe2J/IZiAZaWqHlTuJVBcZz jnjoNN9jpX8RwtF4DYMAL9qIHxy0NldZt3C788MRrZ7n+JMQgdsGDmMlLsd+yAhNDLPD hBqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=5O6+PjOTKXW4ZbTSDRvHHdf3+JwUsh1bL3mAeLh05MA=; b=TKjXfbWUgX+ftH0satCnENSxMF3BoDv/Pt7zKtjssll6guZVqFxdL3zV8vxDtw7LPa tVE2ZvaldERd92Yk0cnLPAkOYB+yokc2TexJDEMVMTUwYVRaRv5/DajU61t3MatAW5xC ntCb3iEM6SBhtrCIwwNOSxPAKVxfmba9trCa6Cp+eRwUKtO6J0rEK1C1vUgmuNr0EPBJ b3B38Qinq238t43k2LN1g6kxNoC3sgFDffKA8aH3ONTnBWy5LMoO9lqDH81zaUr0Bevk 3aMc1YsLddyWazx5Ah96XFIsZjmgDsI3LYiR0L1Ug6Bbu0BauTRqbezAQf+PBV40Li/+ CogQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l189-20020a6388c6000000b0052e91ef3a59si3581271pgd.99.2023.05.10.00.28.36; Wed, 10 May 2023 00:28:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236484AbjEJHOd convert rfc822-to-8bit (ORCPT + 99 others); Wed, 10 May 2023 03:14:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236456AbjEJHO0 (ORCPT ); Wed, 10 May 2023 03:14:26 -0400 Received: from mail-vk1-f174.google.com (mail-vk1-f174.google.com [209.85.221.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AACC240EB; Wed, 10 May 2023 00:14:24 -0700 (PDT) Received: by mail-vk1-f174.google.com with SMTP id 71dfb90a1353d-44fc0b53a8aso4356461e0c.0; Wed, 10 May 2023 00:14:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683702863; x=1686294863; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bvYmUAzo0cwOybz0hjxV39+5gh/FQ5/NU0n3aFKpLiE=; b=Xk8jO34Hm7UQ0bioDM/IACHOs6jnBoIM/S6IW1QFpG+Jgug1rDItKgpWRy2YiVG+y5 cctnO6ZdInRr+C3aC3BMG4XLQq5eLZMiq6LE4dHhN71Ff8Lb7C2Ac1mxxSdTsAO93HIh f4II7oyySHXHCr/roUDaZ2cBXdVKtcU576BiqT49ciYRxqX84zaAZ6ReMmN2onWcFn2d yW6S9GyYDK2P1vYmrh+HtC3bQfVQoQGiuhGl/RjPqmLgniokFq1zxPJ1sOq7kHdEKDEu moS1ifJHLtf0Agr8UteIhcpXHuAmhN1KpsQeURE/XgTLwe49aYFjm3KRWrrIJK4MZZAU 5sQA== X-Gm-Message-State: AC+VfDzF/uStQqhdP7m4bwTFdJyxsf2/++bc5x9vMo1gUwsZQEyy1dUh b841MSC+3tAmibdzMopdubGxzHJkizOCug== X-Received: by 2002:a1f:bfc4:0:b0:440:7261:c77e with SMTP id p187-20020a1fbfc4000000b004407261c77emr5260479vkf.1.1683702863444; Wed, 10 May 2023 00:14:23 -0700 (PDT) Received: from mail-vk1-f177.google.com (mail-vk1-f177.google.com. [209.85.221.177]) by smtp.gmail.com with ESMTPSA id b137-20020a1fb28f000000b00443bcc4131dsm1898612vkf.13.2023.05.10.00.14.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 May 2023 00:14:23 -0700 (PDT) Received: by mail-vk1-f177.google.com with SMTP id 71dfb90a1353d-44ffef66dabso3763567e0c.2; Wed, 10 May 2023 00:14:22 -0700 (PDT) X-Received: by 2002:a05:6902:1147:b0:b99:4ac6:3c75 with SMTP id p7-20020a056902114700b00b994ac63c75mr18672301ybu.10.1683702842290; Wed, 10 May 2023 00:14:02 -0700 (PDT) MIME-Version: 1.0 References: <77a5d8c-406b-7068-4f17-23b7ac53bc83@google.com> <237c8410-ce61-94c-4260-7318ad6a4f3@google.com> In-Reply-To: <237c8410-ce61-94c-4260-7318ad6a4f3@google.com> From: Geert Uytterhoeven Date: Wed, 10 May 2023 09:13:50 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 05/23] m68k: allow pte_offset_map[_lock]() to fail To: Hugh Dickins Cc: 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Hugh, Thanks for your patch! On Wed, May 10, 2023 at 6:48 AM Hugh Dickins 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. > > Restructure cf_tlb_miss() with a pte_unmap() (previously omitted) > at label out, followed by one local_irq_restore() for all. That's a bug fix, which should be a separate patch? > > Signed-off-by: Hugh Dickins > --- 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 *task) > p4d_t *p4d; > pud_t *pud; > pmd_t *pmd; > - pte_t *pte; > + pte_t *pte = NULL; > unsigned long mmuar; > > local_irq_save(flags); > @@ -139,7 +139,7 @@ static inline void load_ksp_mmu(struct task_struct *task) > > pte = (mmuar >= 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; 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. > > 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=0x%p ksp=0x08%lx\n", mm, mmuar); > end: > + if (pte && mmuar < PAGE_OFFSET) > + pte_unmap(pte); Is this also a bugfix, not mentioned in the patch description? > local_irq_restore(flags); > } > Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org 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