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 A1EE0C46CD2 for ; Sat, 30 Dec 2023 09:54:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E29D76B009A; Sat, 30 Dec 2023 04:54:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DDA4C6B013C; Sat, 30 Dec 2023 04:54:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C7B006B00A5; Sat, 30 Dec 2023 04:54:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id B362A6B013C for ; Sat, 30 Dec 2023 04:54:23 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B1B6B16027D for ; Sat, 30 Dec 2023 09:54:22 +0000 (UTC) X-FDA: 81623024364.27.BE5D3DA Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) by imf16.hostedemail.com (Postfix) with ESMTP id 48C4818001A for ; Sat, 30 Dec 2023 09:54:19 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=broadcom.com header.s=google header.b="UgwX/RQl"; dmarc=pass (policy=quarantine) header.from=broadcom.com; spf=pass (imf16.hostedemail.com: domain of nadav.amit@broadcom.com designates 209.85.208.49 as permitted sender) smtp.mailfrom=nadav.amit@broadcom.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1703930059; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=abUTt15ozYHOLG/fk60Lc57aa9WtZ24J7IwER8hUXeE=; b=isoU5CLP7tPUKmC7iPoI0xKzNQmAyzYU7BVTILPZ8OiLUI3qFpxs0bvHVWrikayK+nAa6s AKjr43Bk+ZXAh1fO7xTdf7cvxLysYHl0YiRPWxGnMXT7n4yJNBZseuSuUEQKhxsa6/m4Ge JIu1yBSfNrwcU61UZ0Lp4Ot6elKiZG4= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=broadcom.com header.s=google header.b="UgwX/RQl"; dmarc=pass (policy=quarantine) header.from=broadcom.com; spf=pass (imf16.hostedemail.com: domain of nadav.amit@broadcom.com designates 209.85.208.49 as permitted sender) smtp.mailfrom=nadav.amit@broadcom.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1703930059; a=rsa-sha256; cv=none; b=Il+UgPPgRj0IOXcMNIceK4v8siOS58LjiOvcLVzINUm7FLaEBAu/xr9oEulT97HYe6qlcL 1mZpka8HDXc3OPrNlvwKFzrn+vbcsp+C/vge0jLr0jwC93qUAC8khzgKNxNdjeQWQC3toc xRLraBT1IllLgaxquWfWme0GwThgscg= Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-55559e26ccfso3295176a12.3 for ; Sat, 30 Dec 2023 01:54:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1703930058; x=1704534858; darn=kvack.org; h=content-transfer-encoding:to:references:message-id:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=abUTt15ozYHOLG/fk60Lc57aa9WtZ24J7IwER8hUXeE=; b=UgwX/RQlNLMBvXbJ/oPg7p3R+oXEuS2rkBR9ZA/MAceLxiI/7B1ErH+5h89tLFQoPS QKVjPWcZ4mySdluM/ib+0eABeoKbTE/QROsDJoxH3Yr9Y5KfNnNSWDh994XYLAJ78tMm EQjqNGsIqrOFGeLyN3yinJ4QX8vheMLry+MEg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703930058; x=1704534858; h=content-transfer-encoding:to:references:message-id:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=abUTt15ozYHOLG/fk60Lc57aa9WtZ24J7IwER8hUXeE=; b=hF/6CZE6disM/7IKFkX27XxMrFqQ+FnS8YQSWEwazeSBY48L6WrVeOoQnwZFBOEJKA GaOmn5bVZvNWTp0MH9P3OLURdxTy3nNY7q47g4v/v9SD4E3+Gq7poOX9bgAstSubFdg+ 4FbJzc8zsqUgozZP27a4LkCezHA2dm9iovibmBviS2D+afzRkHDtV/W5jMrQHWH5o2QE C+i+yl5zQbdfhKoOdQiOa1XH587fDl2/enfADFZ29unqwQQbNAUwJc21fbayx7QNVHRL d2JizVRs9LRSYGnkci6nCUbdmDmj/cvfPwyStjtLPKhjYEvyh36vPV6movurwRqTdk++ COmg== X-Gm-Message-State: AOJu0YxlLXBTlS0lx4lMHtrwye/m4vZvrhl6Z9MGNiV2t/R5irJqKqF8 R9syvIUzGgqsJLdMaJ8vtWRXRHJQhYWojnNZ0P8w7X4/gO+NNP+4AnTCrXegeSYrH0nr7vsjc4g j3s48/7PK X-Google-Smtp-Source: AGHT+IGK1uGrlady2TpLBMfqqY9A7tHn9+lcZGtpiYGeIBTdCURXuQcXKU0VKUNz5G0qW4/zkYvz4w== X-Received: by 2002:a05:6402:ca3:b0:54c:9dbe:5c03 with SMTP id cn3-20020a0564020ca300b0054c9dbe5c03mr5290445edb.40.1703930057752; Sat, 30 Dec 2023 01:54:17 -0800 (PST) Received: from smtpclient.apple ([132.69.236.92]) by smtp.gmail.com with ESMTPSA id m9-20020aa7c2c9000000b00552666f4745sm12089039edp.22.2023.12.30.01.54.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 Dec 2023 01:54:17 -0800 (PST) Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.300.61.1.2\)) Subject: Re: [PATCH 1/2] mm/tlb: fix fullmm semantics From: Nadav Amit In-Reply-To: <20231228084642.1765-2-jszhang@kernel.org> Date: Sat, 30 Dec 2023 11:54:02 +0200 Cc: Will Deacon , "Aneesh Kumar K . V" , Andrew Morton , Nick Piggin , Peter Zijlstra , Catalin Marinas , Paul Walmsley , Palmer Dabbelt , Albert Ou , Arnd Bergmann , linux-arch@vger.kernel.org, linux-mm , linux-arm-kernel@lists.infradead.org, Linux Kernel Mailing List , linux-riscv@lists.infradead.org, Nadav Amit , Andrea Arcangeli , Andy Lutomirski , Dave Hansen , Thomas Gleixner , Yu Zhao , the arch/x86 maintainers Message-Id: <204B6410-2EFA-462B-9DF7-64CC5F1D3AD2@broadcom.com> References: <20231228084642.1765-1-jszhang@kernel.org> <20231228084642.1765-2-jszhang@kernel.org> To: Jisheng Zhang X-Mailer: Apple Mail (2.3774.300.61.1.2) Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 48C4818001A X-Stat-Signature: 7rohwhnt9uaj7r17t91skwpyxfd33f59 X-Rspam-User: X-HE-Tag: 1703930059-940801 X-HE-Meta: U2FsdGVkX19BrbOMNgDr8PGjQs9fBudSB9iw39DVydd7Zan2Onc3u1QO/yk/JpE3PUF6okFBGzDavVn7al1VcVUjqxbNR8PkrTHfocwKsbya25t6RKfPVmy9QHAYDodBpQMfggjI6ltJ0IjPy3cAT/w1nlkBHGIhqueiYX6m958HOwQa2DKouUEiPo2Xz6v956o0jw4DTtS+JrBBku6jx6ZDYvxZsIPCzEIDI+EMehSHrDrVU3d9S6i4iCXRmlTg3Rm9qCGb1X03nUoyzgGiQso3W9HwKM4K5lPfB+4pj+OvfawbvppVbzibQmkn0pkvkORnhd9CSM3XRJrQMRqmdbLLflVM1uk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H72s0WhO5gEUcDdho4l/iQwD8GRrJMTFbCTpdXEUCFUofuT+k7yUYwwYNz9YuqgyyVsyzmw/B2Hii6eBOcx1le38/TexAhktYwRThiIkjC4v8yk1enQZ2CyC0TNb9wHQj4PAhLLBUrdG9rh43KoHn0XUi8M5QILncuqt+Utm/DbQFV9/ypkfk2qwaBqvQvM50Ed8RzwsaNV32M9Xf19prrOQvUtKV+KFAg8CJG8LcwUmB2g0JAvbpPvv22nvw== 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: List-Subscribe: List-Unsubscribe: > On Dec 28, 2023, at 10:46=E2=80=AFAM, Jisheng Zhang = wrote: >=20 > From: Nadav Amit >=20 > fullmm in mmu_gather is supposed to indicate that the mm is torn-down > (e.g., on process exit) and can therefore allow certain optimizations. > However, tlb_finish_mmu() sets fullmm, when in fact it want to say that > the TLB should be fully flushed. >=20 > Change tlb_finish_mmu() to set need_flush_all and check this flag in > tlb_flush_mmu_tlbonly() when deciding whether a flush is needed. >=20 > At the same time, bring the arm64 fullmm on process exit optimization bac= k. >=20 > Signed-off-by: Nadav Amit > Signed-off-by: Jisheng Zhang > Cc: Andrea Arcangeli > Cc: Andrew Morton > Cc: Andy Lutomirski > Cc: Dave Hansen > Cc: Peter Zijlstra > Cc: Thomas Gleixner > Cc: Will Deacon > Cc: Yu Zhao > Cc: Nick Piggin > Cc: x86@kernel.org > --- > arch/arm64/include/asm/tlb.h | 5 ++++- > include/asm-generic/tlb.h | 2 +- > mm/mmu_gather.c | 2 +- > 3 files changed, 6 insertions(+), 3 deletions(-) >=20 > diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h > index 846c563689a8..6164c5f3b78f 100644 > --- a/arch/arm64/include/asm/tlb.h > +++ b/arch/arm64/include/asm/tlb.h > @@ -62,7 +62,10 @@ static inline void tlb_flush(struct mmu_gather *tlb) > * invalidating the walk-cache, since the ASID allocator won't > * reallocate our ASID without invalidating the entire TLB. > */ > - if (tlb->fullmm) { > + if (tlb->fullmm) > + return; > + > + if (tlb->need_flush_all) { > if (!last_level) > flush_tlb_mm(tlb->mm); > return; >=20 Thanks for pulling my patch out of the abyss, but the chunk above did not come from my old patch. My knowledge of arm64 is a bit limited, but the code does not seem to match the comment, so if it is correct (which I strongly doubt), the comment should be updated. [1] https://lore.kernel.org/all/20210131001132.3368247-2-namit@vmware.com/ --=20 This electronic communication and the information and any files transmitted= =20 with it, or attached to it, are confidential and are intended solely for=20 the use of the individual or entity to whom it is addressed and may contain= =20 information that is confidential, legally privileged, protected by privacy= =20 laws, or otherwise restricted from disclosure to anyone else. If you are=20 not the intended recipient or the person responsible for delivering the=20 e-mail to the intended recipient, you are hereby notified that any use,=20 copying, distributing, dissemination, forwarding, printing, or copying of= =20 this e-mail is strictly prohibited. If you received this e-mail in error,= =20 please return the e-mail to the sender, delete it from your computer, and= =20 destroy any printed copy of it.