Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5570920rwd; Sun, 18 Jun 2023 14:37:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ53zcAN93BXgayR03DT1g8755bz9cauAWO/Ba9Tix7YowPgU+owrXBz+UV7/9qnntEu9N3F X-Received: by 2002:aca:f09:0:b0:39e:a8e5:c18c with SMTP id 9-20020aca0f09000000b0039ea8e5c18cmr6538299oip.8.1687124247647; Sun, 18 Jun 2023 14:37:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687124247; cv=none; d=google.com; s=arc-20160816; b=YJmCCDNtg2/RzXn2bBx/9csiaBS8ik9K12INE6J6HF4RabohHyMWGIssMHBSpzpkPN dndAvd0Pq9xQdov56Yormip4c63uscXVuI8KNy7f0IbkWOwAlMbnamZn2jWicDvBExGI 2wlU7fiQjneD3fs0cAz4lSUpsFslI5k26QHz5sNDfl5eBPXwYeKkAuGggrsa7Eks85I2 Rp1F5nNLZJDyPs033ZESit0C5VWmxVhbd8gqsskgOLKHkUMUnB6acdO1iPzDuT7dcqv7 ZTKmxKDYrr79RnBBHND/x4U+5ZQSHLH5xZcfpT+WxoPbQkr3rtri28yEnGVHPsofYJQ2 y5lw== 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 :dkim-signature; bh=FZtyfCTAVMiPGQWHjgwoE9XDDUe5Zitl3naYIJu5u8M=; b=l65MV628HQs/5z7HAw90PcB8FFx2r5VirYZ3DgVc6DniDIaZdPV2t5KE9yoDYyQ0Ub P8myBlqgkOKrjSwsgh1NLJOngWt+YxpvG67fL5X8owTqFSrGp4xAdPZdKLQsfBoEcWai NqmPiSyM2qOLd6/WmrjlTq+t9ARbqUYymFzriNfhJ/Po3sXmXlMKGr3bJO+Kzw98QWgw 5xuCt8eo45s5LXF+aXQByzQqy1hbCtQqV4zgusylU5h8xFclXrN8444aKTYM+4IfwP7t uREv8qkF+LpBbzQC7/YhT9XZjzIfaxoSywTBBHSivS7o6yRIWSqyk5iRcqgIFu9F57oG d2ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=ZVT9TlvX; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 24-20020a631258000000b0051b37c000dcsi15437339pgs.81.2023.06.18.14.37.14; Sun, 18 Jun 2023 14:37:27 -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=ZVT9TlvX; 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 S229538AbjFRU6N (ORCPT + 99 others); Sun, 18 Jun 2023 16:58:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229650AbjFRU6L (ORCPT ); Sun, 18 Jun 2023 16:58:11 -0400 Received: from mail-qt1-x835.google.com (mail-qt1-x835.google.com [IPv6:2607:f8b0:4864:20::835]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09324E4E for ; Sun, 18 Jun 2023 13:58:09 -0700 (PDT) Received: by mail-qt1-x835.google.com with SMTP id d75a77b69052e-3f9d619103dso205581cf.1 for ; Sun, 18 Jun 2023 13:58:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687121888; x=1689713888; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=FZtyfCTAVMiPGQWHjgwoE9XDDUe5Zitl3naYIJu5u8M=; b=ZVT9TlvXekbzjsIk4FVN6w5b3V3bL2g07xM58CsOQEKlBliMaOMo4yZji4Q+4M2pTX PwOyYLy6AVqkAYYG8oZQzsoJ5wXO3fYU4dvuBveWcoPn/DBqA76dOm2wErETk5RMX4DF Pdjj7y7tVBfSg3bUPlVpNbbP9RKpJTFpWfMqG6NS8ogCoI9SFLLQjHjuiJCl9wmx/QMI sfudbAhw5Fv3ydEbSaSvd7K7sWgk9eaIp4KEVRbqeVVI+v27ojzRWzN3DHLLYoRPb3Uw 6IMcAn+rqIjZUCyYlDlj0BpHHcpwknOPBIBYMxSFkst2yjNHbhKR20MPChNpYuTjpIYD wwUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687121888; x=1689713888; 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=FZtyfCTAVMiPGQWHjgwoE9XDDUe5Zitl3naYIJu5u8M=; b=DsDLCOdAUcqkOnVFZKY+voUPiB9b6MPocp+PjWN+IZE5OffHcHIhsPDra+yV2qIgsj pCD5pDhw8VPfyfHi3hP7WohlB+E9LkBa0s3d2DZcOU04bnnZFUQU99jYKhKMgPEwOARD NtQbQOd2wHXdcMUMZBds5HEXyWzVhAdHHFA3xt2xUyX+M1JqU+vG14cX5APEY2PbHAiq zV5Xp8oc1aiz1u3lbkK9L6zPyMTGgkJ8oUflAyu0VabLahoNu+vIC6ToKhkQFpmmjG0t mcFQ8p8ErW7m+8k9vgsU+aeuF2i+Whz8f6jyRngJQuDRrheVfeYDgR1XpTmGcy2eOvFp BjSA== X-Gm-Message-State: AC+VfDz7anqEwNh2Wl8IVmAWnk5g0IGndYJCy4ELlvMp5vGAFLMaaSFH kkNkT0BKvqqjNqjiGIToHh9j5uQv00n3TLgis2TgSA== X-Received: by 2002:a05:622a:20a:b0:3f9:a78f:c527 with SMTP id b10-20020a05622a020a00b003f9a78fc527mr291449qtx.21.1687121888063; Sun, 18 Jun 2023 13:58:08 -0700 (PDT) MIME-Version: 1.0 References: <178970b0-1539-8aac-76fd-972c6c46ec17@google.com> <20230614231758.GA1503611@dev-arch.thelio-3990X> <344a4da-3890-45fd-607e-b5f85ca6ad48@google.com> <20230615155059.GB3665766@dev-arch.thelio-3990X> <76b41825-30fa-b9e8-d043-2affcba24317@google.com> In-Reply-To: From: Yu Zhao Date: Sun, 18 Jun 2023 14:57:31 -0600 Message-ID: Subject: Re: [PATCH v2 07/23 replacement] mips: add pte_unmap() to balance pte_offset_map() To: Hugh Dickins , Nathan Chancellor , Thomas Bogendoerfer Cc: Andrew Morton , Mike Kravetz , Mike Rapoport , "Kirill A. Shutemov" , Matthew Wilcox , David Hildenbrand , Suren Baghdasaryan , Qi Zheng , Peter Zijlstra , Russell King , Catalin Marinas , Will Deacon , Geert Uytterhoeven , Greg Ungerer , Michal Simek , Helge Deller , John David Anglin , "Aneesh Kumar K.V" , Michael Ellerman , Alexandre Ghiti , Palmer Dabbelt , Heiko Carstens , Christian Borntraeger , Claudio Imbrenda , Alexander Gordeev , 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-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, linux-mips@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 16, 2023 at 9:54=E2=80=AFPM Yu Zhao 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 do= ne > > pte_offset_map_lock(), then mips forgets the address and recalculates i= t; > > but my two naive attempts to clean that up did more harm than good. > > > > Tested-by: Nathan Chancellor > > Signed-off-by: Hugh Dickins > > FWIW: Tested-by: Yu Zhao > > 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-g62d8779610= bb-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 =3D env->CP0_PageMask >> (TARGET_PAGE_BITS + 1); /* XXX: detect conflicting TLBs and raise a MCHECK exception when neede= d */ ...