Message ID | addfcb3-b5f4-976e-e050-a2508e589cfe@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp974926vqr; Thu, 15 Jun 2023 16:23:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Ll3jyJnp28yxgoFzquUfo7DoZR/Lrv+C5ON4d+uvFkYImARR019pc7/gRCqJc0m5SUG1v X-Received: by 2002:aa7:88d4:0:b0:64d:7002:8316 with SMTP id k20-20020aa788d4000000b0064d70028316mr566513pff.9.1686871421929; Thu, 15 Jun 2023 16:23:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686871421; cv=none; d=google.com; s=arc-20160816; b=1DoljWC3QpdHBjZro3lMhoyxOHfw58a25Lpz/M8kBJr38nchHkU2gf2V09S/m1bglx KeCmaimQI6Qo3UngUFvr7EMQO1rhzoeOg9X4j45zfYt0Y2JaN3/aqBgBcD35+LuzRzKE H3EAk20RUu/rqY0oeAM01xCCGjJzfgvuAFuIfE9fArCeCnm2n686qNVqq5jkzLhw8swG wrurj2rQSNw1HJ1jCAJasqu45J3ako8tVwq/tPb//nNb4mRjCBpzImf2FDlSJhJWvaTF HHLJzjvPICXwoRtQCtN+y/+CwlJbFNX7KKuQtT8YiRSy7l2pycT6FBXDHy6FxJS3qqyE OfoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=rocsqxxn2Z+cT1JHYvXfzCdKlHTpr3EP6mTFGVcBZg0=; b=nBkvHP3+VnUXbirAIi1R2q4QQFtyFU578z9Ijwcd1p2rS4YTJN4KDfMtIwxxFOu3wU b434ajkdDzXk1MPAFU7ubS1V+LkdjeJXSv3Qo4YcKxqeU+AsABjorP49iOtQUesktPj0 IBcOC90r1E6XAUsjfSFnmvj0XvAXZf+uZDB7Zp/ik62x5OzD76e89iwL3cJqjx52el/g 3QqS9ayNDn+x4mEMGEMUy/VkYrPOr586WD1oaeTvaWQ2daWN7UXqeG/KG0nL6eOpuQas /xRkEyxd2Xzcoya35ckewMWzXDi7CPNh/aMJd18Av9IjPdDUkGqEG6FzCTudtC7HDhgN umxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=MJTZvP19; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x25-20020aa79579000000b0064d45bbba8csi13916273pfq.62.2023.06.15.16.23.27; Thu, 15 Jun 2023 16:23:41 -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; dkim=pass header.i=@google.com header.s=20221208 header.b=MJTZvP19; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231917AbjFOXDB (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Thu, 15 Jun 2023 19:03:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229475AbjFOXC6 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 15 Jun 2023 19:02:58 -0400 Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7947C294D for <linux-kernel@vger.kernel.org>; Thu, 15 Jun 2023 16:02:55 -0700 (PDT) Received: by mail-yb1-xb33.google.com with SMTP id 3f1490d57ef6-bd20beffda6so36232276.1 for <linux-kernel@vger.kernel.org>; Thu, 15 Jun 2023 16:02:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1686870174; x=1689462174; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=rocsqxxn2Z+cT1JHYvXfzCdKlHTpr3EP6mTFGVcBZg0=; b=MJTZvP19w7L3mwEdMeExhSCW1AUDkDcDZIGA09b4Lsgr6AlQ/Jre5s3pQVCVJJ7rQb 5+EQMNtJaTaY+aRJKrCSqlImib7KZddKIew66TbvLd683FL9AyfE66fgz1T7BtZHDMm8 2jNBCticE3VbvZxgnHDLhllKeMXxMDja6NYMekmWJVMnL0qXYLEhZcbBya6ztZKzets8 eOxxHJ/YfIwfRnvaqFcbsGZUKRVZaOyJdqvanJIQ7D74NV/Gvoq+dfmVK1oXzh1JvH5P 0RtdON+E/jvZHQ2QI/6IDa9W4KDnatFP6KwfH05hk8Ymf0ujYFguYsacUpxAce6WF76M r8mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686870174; x=1689462174; 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=rocsqxxn2Z+cT1JHYvXfzCdKlHTpr3EP6mTFGVcBZg0=; b=OopcDHP9kbSMEe+zEtNgkJgJAlo0NZzCqAk0LxvYX01e7Bptk/zr2EoR6zZcOKqxM7 D8Pi64KvYlRKKnnfHvUYTkLY8x2GK1ZbPj35Hz7IRdBo68iT1YuDfokRFbpSDEBtf10D utSbzKq1W3ok9fIB77mKAYxaSD6iMTPn2WBMYFbj5arZ9WkTtcfjom7Q7Kloh3IWa1iK KvFc2dY3ZzOVqyOeh3++yNztH3Fu3APsHqH/yXEmAAspHh/WJkqo6tCtuPtu6PlyzKdj sMdeHVj3+BFMCNOcdFG7SVEjbMqOE1hpIr77Y45JQ2ZZci4kclgONg90/v71UBEgesvb Se/A== X-Gm-Message-State: AC+VfDxcfmW+sRqlY1cR5Pcd2j9V3CufWJHDEgAFDvENtvaDVlqhcI1+ GZ2YTDXe2ePorRQFLHyVRwR81g== X-Received: by 2002:a81:7bd5:0:b0:56d:2dd6:c5b3 with SMTP id w204-20020a817bd5000000b0056d2dd6c5b3mr138534ywc.31.1686870174477; Thu, 15 Jun 2023 16:02:54 -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 w6-20020a0ded06000000b0056d2a19ad91sm2857020ywe.103.2023.06.15.16.02.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jun 2023 16:02:54 -0700 (PDT) Date: Thu, 15 Jun 2023 16:02:43 -0700 (PDT) From: Hugh Dickins <hughd@google.com> X-X-Sender: hugh@ripple.attlocal.net To: Andrew Morton <akpm@linux-foundation.org> cc: Nathan Chancellor <nathan@kernel.org>, Hugh Dickins <hughd@google.com>, 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>, Peter Zijlstra <peterz@infradead.org>, 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>, Claudio Imbrenda <imbrenda@linux.ibm.com>, Alexander Gordeev <agordeev@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>, Yu Zhao <yuzhao@google.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: [PATCH v2 07/23 replacement] mips: add pte_unmap() to balance pte_offset_map() In-Reply-To: <76b41825-30fa-b9e8-d043-2affcba24317@google.com> Message-ID: <addfcb3-b5f4-976e-e050-a2508e589cfe@google.com> References: <a4963be9-7aa6-350-66d0-2ba843e1af44@google.com> <178970b0-1539-8aac-76fd-972c6c46ec17@google.com> <20230614231758.GA1503611@dev-arch.thelio-3990X> <f5526f17-9d78-f7ea-427a-7e76bfeb6b8@google.com> <344a4da-3890-45fd-607e-b5f85ca6ad48@google.com> <20230615155059.GB3665766@dev-arch.thelio-3990X> <76b41825-30fa-b9e8-d043-2affcba24317@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768812888079782154?= X-GMAIL-MSGID: =?utf-8?q?1768812888079782154?= |
Series |
None
|
|
Commit Message
Hugh Dickins
June 15, 2023, 11:02 p.m. UTC
To keep balance in future, __update_tlb() remember to pte_unmap() after pte_offset_map(). This is an odd case, since the caller has already done pte_offset_map_lock(), then mips forgets the address and recalculates it; but my two naive attempts to clean that up did more harm than good. Tested-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Hugh Dickins <hughd@google.com> --- Andrew, please replace my mips patch, and its build warning fix patch, in mm-unstable by this less ambitious but working replacement - thanks. arch/mips/mm/tlb-r4k.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
Comments
On Thu, Jun 15, 2023 at 04:02:43PM -0700, Hugh Dickins wrote: > To keep balance in future, __update_tlb() remember to pte_unmap() after > pte_offset_map(). This is an odd case, since the caller has already done > pte_offset_map_lock(), then mips forgets the address and recalculates it; > but my two naive attempts to clean that up did more harm than good. > > Tested-by: Nathan Chancellor <nathan@kernel.org> > Signed-off-by: Hugh Dickins <hughd@google.com> FWIW: Tested-by: Yu Zhao <yuzhao@google.com> There is another problem, likely caused by khugepaged, happened multiple times. But I don't think it's related to your series, just FYI. Got mcheck at ffffffff81134ef0 CPU: 3 PID: 36 Comm: khugepaged Not tainted 6.4.0-rc6-00049-g62d8779610bb-dirty #1 $ 0 : 0000000000000000 0000000000000014 40000000011ac004 4000000000000000 $ 4 : c000000000000000 0000000000000045 000000011a80045b 000000011a80045b $ 8 : 8000000080188000 ffffffff81b526c0 0000000000000200 0000000000000000 $12 : 0000000000000028 ffffffff81910cb4 0000000000000000 0000000000000207 $16 : 000000aaab800000 80000000037ee990 ffffffff81b50200 8000000005066ae0 $20 : 0000000000000001 ffffffff80000000 ffffffff81c10000 000000aaab800000 $24 : 0000000000000002 ffffffff812b75f8 $28 : 8000000002310000 8000000002313b00 ffffffff81b50000 ffffffff81134d88 Hi : 000000000000017a Lo : 0000000000000000 epc : ffffffff81134ef0 __update_tlb+0x260/0x2a0 ra : ffffffff81134d88 __update_tlb+0xf8/0x2a0 Status: 14309ce2 KX SX UX KERNEL EXL Cause : 00800060 (ExcCode 18) PrId : 000d9602 (Cavium Octeon III) CPU: 3 PID: 36 Comm: khugepaged Not tainted 6.4.0-rc6-00049-g62d8779610bb-dirty #1 Stack : 0000000000000001 0000000000000000 0000000000000008 8000000002313768 8000000002313768 80000000023138f8 0000000000000000 0000000000000000 a6c8cd76e1667e00 8000000001db4f28 0000000000000001 30302d3663722d30 643236672d393430 0000000000000010 ffffffff81910cc0 0000000000000000 8000000001d96bcc 0000000000000000 0000000000000000 ffffffff81a68ed0 ffffffff81b50000 0000000000000001 ffffffff80000000 ffffffff81c10000 000000aaab800000 0000000000000002 ffffffff815b78c0 ffffffffa184e710 00000000000000c0 8000000002310000 8000000002313760 ffffffff81b50000 ffffffff8111c9cc 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 ffffffff8111c9ec 0000000000000000 ... Call Trace: [<ffffffff8111c9ec>] show_stack+0x64/0x158 [<ffffffff81920078>] dump_stack_lvl+0x5c/0x7c [<ffffffff8111e03c>] do_mcheck+0x2c/0x98 [<ffffffff81118608>] handle_mcheck_int+0x38/0x50 Index : 80000000 PageMask : 1fe000 EntryHi : 000000aaab8000bd EntryLo0 : 40000000011a8004 EntryLo1 : 40000000011ac004 Wired : 0 PageGrain: e8000000 Index: 2 pgmask=4kb va=c00000feffff4000 asid=b9 [ri=0 xi=0 pa=000022a7000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=000022af000 c=0 d=1 v=1 g=1] Index: 3 pgmask=4kb va=c00000feffff8000 asid=b9 [ri=0 xi=0 pa=00002380000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=00002381000 c=0 d=1 v=1 g=1] Index: 4 pgmask=4kb va=c00000feffffa000 asid=b9 [ri=0 xi=0 pa=000023e9000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=000023ea000 c=0 d=1 v=1 g=1] Index: 5 pgmask=4kb va=c00000feffffe000 asid=b9 [ri=0 xi=0 pa=00002881000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=00002882000 c=0 d=1 v=1 g=1] Index: 6 pgmask=4kb va=c00000fefffb0000 asid=b9 [ri=0 xi=0 pa=00002cc2000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=00002cc3000 c=0 d=1 v=1 g=1] Index: 7 pgmask=4kb va=c00000feffffc000 asid=b9 [ri=0 xi=0 pa=000023eb000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=00002880000 c=0 d=1 v=1 g=1] Index: 8 pgmask=4kb va=c00000feffff6000 asid=b9 [ri=0 xi=0 pa=0000237e000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=0000237f000 c=0 d=1 v=1 g=1] Index: 14 pgmask=4kb va=c00000fefff62000 asid=8e [ri=0 xi=0 pa=00007477000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=0000745e000 c=0 d=1 v=1 g=1] Index: 15 pgmask=4kb va=c00000fefff52000 asid=8e [ri=0 xi=0 pa=0000744c000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=0000616d000 c=0 d=1 v=1 g=1] Index: 16 pgmask=4kb va=c00000fefff42000 asid=8e [ri=0 xi=0 pa=00006334000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=0000616b000 c=0 d=1 v=1 g=1] Index: 19 pgmask=4kb va=c00000fefffb6000 asid=8e [ri=0 xi=0 pa=00005050000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=00005051000 c=0 d=1 v=1 g=1] Index: 20 pgmask=4kb va=c00000fefff72000 asid=b9 [ri=0 xi=0 pa=00007504000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=00007503000 c=0 d=1 v=1 g=1] Index: 58 pgmask=4kb va=c00000fefffaa000 asid=8e [ri=0 xi=0 pa=00005126000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=00005127000 c=0 d=1 v=1 g=1] Index: 59 pgmask=4kb va=c00000fefffba000 asid=8e [ri=0 xi=0 pa=00005129000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=0000512a000 c=0 d=1 v=1 g=1] Index: 79 pgmask=4kb va=c000000000060000 asid=8e [ri=0 xi=0 pa=0000534b000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=000062f9000 c=0 d=1 v=1 g=1] Index: 80 pgmask=4kb va=c00000000005e000 asid=8e [ri=0 xi=0 pa=00000000000 c=0 d=0 v=0 g=1] [ri=0 xi=0 pa=00004013000 c=0 d=1 v=1 g=1] Index: 81 pgmask=4kb va=c0000000003a0000 asid=8e [ri=0 xi=0 pa=000060c6000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=0000340e000 c=0 d=1 v=1 g=1] Index: 82 pgmask=4kb va=c00000000039e000 asid=8e [ri=0 xi=0 pa=00000000000 c=0 d=0 v=0 g=1] [ri=0 xi=0 pa=000060c5000 c=0 d=1 v=1 g=1] Index: 83 pgmask=4kb va=c00000000003e000 asid=8e [ri=0 xi=0 pa=00002bf3000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=00002c42000 c=0 d=1 v=1 g=1] Index: 84 pgmask=4kb va=c000000000042000 asid=8e [ri=0 xi=0 pa=00002c45000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=00002c46000 c=0 d=1 v=1 g=1] Index: 85 pgmask=4kb va=0aaab820000 asid=bd [ri=0 xi=0 pa=00000000000 c=0 d=0 v=0 g=0] [ri=0 xi=0 pa=00000000000 c=0 d=0 v=0 g=0] Index: 86 pgmask=4kb va=0aaab748000 asid=bd [ri=0 xi=1 pa=0003c959000 c=0 d=1 v=1 g=0] [ri=0 xi=1 pa=0000f7b6000 c=0 d=0 v=1 g=0] Index: 87 pgmask=4kb va=0fff37c4000 asid=bd [ri=0 xi=0 pa=0000bd23000 c=0 d=0 v=1 g=0] [ri=0 xi=0 pa=0000bd24000 c=0 d=0 v=1 g=0] Index: 88 pgmask=4kb va=0fff3992000 asid=bd [ri=0 xi=1 pa=0000bfcd000 c=0 d=0 v=1 g=0] [ri=0 xi=1 pa=0002977b000 c=0 d=0 v=1 g=0] Index: 89 pgmask=4kb va=0fff3288000 asid=bd [ri=0 xi=0 pa=00032b62000 c=0 d=0 v=1 g=0] [ri=0 xi=0 pa=00032b63000 c=0 d=0 v=1 g=0] Index: 90 pgmask=4kb va=0fff3982000 asid=bd [ri=0 xi=1 pa=0002d6a3000 c=0 d=1 v=1 g=0] [ri=0 xi=1 pa=0002a423000 c=0 d=0 v=1 g=0] Index: 91 pgmask=4kb va=0fffbb5e000 asid=bd [ri=0 xi=0 pa=00028949000 c=0 d=1 v=1 g=0] [ri=0 xi=0 pa=00035060000 c=0 d=1 v=1 g=0] Index: 92 pgmask=4kb va=c00000fefffe2000 asid=8e [ri=0 xi=0 pa=000020f0000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=000020ff000 c=0 d=1 v=1 g=1] Index: 93 pgmask=4kb va=c00000fefffd2000 asid=8e [ri=0 xi=0 pa=000020b7000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=000020fe000 c=0 d=1 v=1 g=1] Index: 94 pgmask=4kb va=c00000fefffc2000 asid=8e [ri=0 xi=0 pa=000020b6000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=000020fd000 c=0 d=1 v=1 g=1] Index: 110 pgmask=4kb va=c00000feffff2000 asid=bc [ri=0 xi=0 pa=000020f1000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=00002100000 c=0 d=1 v=1 g=1] Index: 125 pgmask=4kb va=c00000fefffbe000 asid=bc [ri=0 xi=0 pa=00005268000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=000053dc000 c=0 d=1 v=1 g=1] Index: 126 pgmask=4kb va=c00000fefffbc000 asid=bc [ri=0 xi=0 pa=00005266000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=00005267000 c=0 d=1 v=1 g=1] Index: 188 pgmask=4kb va=c00000fefff76000 asid=bb [ri=0 xi=0 pa=00007576000 c=0 d=1 v=1 g=1] [ri=0 xi=0 pa=00007577000 c=0 d=1 v=1 g=1] Code: 1000ff92 00601025 00000000 <42000006> 1000ffb8 00000000 00000000 8f820018 00021238 Kernel panic - not syncing: Caught Machine Check exception - caused by multiple matching entries in the TLB. ---[ end Kernel panic - not syncing: Caught Machine Check exception - caused by multiple matching entries in the TLB. ]---
On Fri, Jun 16, 2023 at 9:54 PM Yu Zhao <yuzhao@google.com> wrote: > > On Thu, Jun 15, 2023 at 04:02:43PM -0700, Hugh Dickins wrote: > > To keep balance in future, __update_tlb() remember to pte_unmap() after > > pte_offset_map(). This is an odd case, since the caller has already done > > pte_offset_map_lock(), then mips forgets the address and recalculates it; > > but my two naive attempts to clean that up did more harm than good. > > > > Tested-by: Nathan Chancellor <nathan@kernel.org> > > Signed-off-by: Hugh Dickins <hughd@google.com> > > FWIW: Tested-by: Yu Zhao <yuzhao@google.com> > > There is another problem, likely caused by khugepaged, happened multiple times. But I don't think it's related to your series, just FYI. > > Got mcheck at ffffffff81134ef0 > CPU: 3 PID: 36 Comm: khugepaged Not tainted 6.4.0-rc6-00049-g62d8779610bb-dirty #1 ... > Kernel panic - not syncing: Caught Machine Check exception - caused by multiple matching entries in the TLB. In case anyone plans to try to fix this - the problem goes back to at least 5.15 stable. My (educated) guess is that nobody complained about it because all the testing is done in QEMU, which does NOT detect conflicting TLBs. This means the verification of the fix would need to be on a real piece of h/w or an updated QEMU. In target/mips/tcg/sysemu/tlb_helper.c: static void r4k_fill_tlb(CPUMIPSState *env, int idx) { r4k_tlb_t *tlb; uint64_t mask = env->CP0_PageMask >> (TARGET_PAGE_BITS + 1); /* XXX: detect conflicting TLBs and raise a MCHECK exception when needed */ ...
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c index 1b939abbe4ca..93c2d695588a 100644 --- a/arch/mips/mm/tlb-r4k.c +++ b/arch/mips/mm/tlb-r4k.c @@ -297,7 +297,7 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte) p4d_t *p4dp; pud_t *pudp; pmd_t *pmdp; - pte_t *ptep; + pte_t *ptep, *ptemap = NULL; int idx, pid; /* @@ -344,7 +344,12 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte) } else #endif { - ptep = pte_offset_map(pmdp, address); + ptemap = ptep = pte_offset_map(pmdp, address); + /* + * update_mmu_cache() is called between pte_offset_map_lock() + * and pte_unmap_unlock(), so we can assume that ptep is not + * NULL here: and what should be done below if it were NULL? + */ #if defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_CPU_MIPS32) #ifdef CONFIG_XPA @@ -373,6 +378,9 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte) tlbw_use_hazard(); htw_start(); flush_micro_tlb_vm(vma); + + if (ptemap) + pte_unmap(ptemap); local_irq_restore(flags); }