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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D89DC433E6 for ; Wed, 3 Feb 2021 09:45:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7963464F76 for ; Wed, 3 Feb 2021 09:45:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7963464F76 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CC7FF6B0006; Wed, 3 Feb 2021 04:45:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C52036B006C; Wed, 3 Feb 2021 04:45:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B19CD6B006E; Wed, 3 Feb 2021 04:45:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0176.hostedemail.com [216.40.44.176]) by kanga.kvack.org (Postfix) with ESMTP id 98B556B0006 for ; Wed, 3 Feb 2021 04:45:07 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 5CCEE10FB3 for ; Wed, 3 Feb 2021 09:45:07 +0000 (UTC) X-FDA: 77776473054.09.floor26_3c02436275d2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin09.hostedemail.com (Postfix) with ESMTP id 38EFD180AD817 for ; Wed, 3 Feb 2021 09:45:07 +0000 (UTC) X-HE-Tag: floor26_3c02436275d2 X-Filterd-Recvd-Size: 3509 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Wed, 3 Feb 2021 09:45:06 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 6420764E11; Wed, 3 Feb 2021 09:45:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612345505; bh=lhbZyN+uLB12V6jsdAtPmy/DGC3Xe63XTP2uoMfd/dA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OWskC4OC5mrzI55l8SJ3lM0b5PB+xg25xmyFGjGqM9TRHjFdKz+oMinRfSVK7Tlgp JT+AHTiBdF+hrpJq9cwiCr+qo0ehvWHVyeTfaFdRs6c+RWT1gI+KHGyIX9HlMQJJe5 hTPd5vFK3Q62m6X4S5068+6S34E9DB7qbdOF7xgS70TddVeWW1APADT5s/hamG0jr9 eHdF/eMx2jITz+PxZVlXZSr9bDxPQiCtOjr4bEpugM32sL1xGxtsB/Unjdq0xykv30 LqlUwx+IO6qiAtv7S4O1ThteeZ0dv7CsMH8/akLm5EofGY726P5LWP+99ro0j0Lymf 7zU7msHH/HFQw== Date: Wed, 3 Feb 2021 09:44:59 +0000 From: Will Deacon To: Nadav Amit Cc: Peter Zijlstra , Andrea Arcangeli , Andrew Morton , Andy Lutomirski , Dave Hansen , Thomas Gleixner , Yu Zhao , Nick Piggin , X86 ML , Linux-MM , LKML Subject: Re: [RFC 01/20] mm/tlb: fix fullmm semantics Message-ID: <20210203094459.GA18493@willie-the-truck> References: <20210131001132.3368247-1-namit@vmware.com> <20210131001132.3368247-2-namit@vmware.com> <52673507-2C30-4AC6-8EBC-B5A313827FB0@gmail.com> <5E9B0429-7E72-4E86-B91B-4718C4134B0F@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <5E9B0429-7E72-4E86-B91B-4718C4134B0F@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Content-Transfer-Encoding: quoted-printable 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: On Tue, Feb 02, 2021 at 01:35:38PM -0800, Nadav Amit wrote: > > On Feb 2, 2021, at 3:00 AM, Peter Zijlstra wro= te: > >=20 > > On Tue, Feb 02, 2021 at 01:32:36AM -0800, Nadav Amit wrote: > >>> On Feb 1, 2021, at 3:36 AM, Peter Zijlstra w= rote: > >>>=20 > >>>=20 > >>> https://lkml.kernel.org/r/20210127235347.1402-1-will@kernel.org > >>=20 > >> I have seen this series, and applied my patches on it. > >>=20 > >> Despite Will=E2=80=99s patches, there were still inconsistencies bet= ween fullmm > >> and need_flush_all. > >>=20 > >> Am I missing something? > >=20 > > I wasn't aware you were on top. I'll look again. >=20 > Looking on arm64=E2=80=99s tlb_flush() makes me think that there is cur= rently a bug > that this patch fixes. Arm64=E2=80=99s tlb_flush() does: >=20 > /* > * If we're tearing down the address space then we only care abo= ut > * invalidating the walk-cache, since the ASID allocator won't > * reallocate our ASID without invalidating the entire TLB. > */ > if (tlb->fullmm) { > if (!last_level) > flush_tlb_mm(tlb->mm); > return; > }=20 >=20 > But currently tlb_mmu_finish() can mistakenly set fullmm incorrectly (i= f > mm_tlb_flush_nested() is true), which might skip the TLB flush. But in that case isn't 'freed_tables' set to 1, so 'last_level' will be false and we'll do the flush in the code above? Will