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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A7BD7CCFA03 for ; Mon, 3 Nov 2025 18:07:11 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4d0fgL05xqz2xnx; Tue, 4 Nov 2025 05:07:10 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1762193229; cv=none; b=XWZdWQF0QzLNV9viSPo4axKADchts0QfTR5RFTZaExPFeWlfscJR7cAF6OLbblew2Lq93y0TUgP/yTT4+S4kIvNtRM6MFsqM1MQG95lZgpx7oUFaVkVUmja7tW7hSKmYyET5BlKZFr8frO6iUKAXz326ir06Iav1ZBWD8MGvXDCklLzs0dUDBOXWt6OkwDD85CqhryOcfj+fKcFw7eESw+GVFDVbwCFjH24WreryxHDeG4TWtONIv2of/zSp4uIY5ncy+U2OKDWkrQ8zVIc5oHS58d8VNUt6dLccGC7GsVbwEVuGIiIEJliGs6VYbCRWDEMrdG5Z7H/jSrWA8hJG7w== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1762193229; c=relaxed/relaxed; bh=eU7WK/1PqFlvzgHgAfgHxGbQJbuUHY5MaiGqpoJ3158=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=LkA8cRQT60/5paO8KgGylc6lvBcF15vMUZ7ZncOg0X+35XgY1rxEnq+gJarMUKyE9XU6U9U4qnS7onPfRIIyZ2rsDICA9McEpaoPkRyN72nm8Ar5Bg1pXQQUPgTm4c82Cj4+cMLEIH9yaWKO/sgQuECQ2IetO5NH85UZ57r0N2BzUVGxAnLVBkVky0rV7ZEc/5/crNy44n8vAYukl357hefAL+cr+FMAYTH5789TYuaLv5oIipQ2rmbMSunNGZ/NqAH9Mo0E6aKMEb0NHhb0VpvEZuUPu/8pQxz2sRBlpDpeVzo32IRsucSzIl2uuRNHjGvzfqrOcsvCmxcU31mDyQ== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass (client-ip=217.140.110.172; helo=foss.arm.com; envelope-from=kevin.brodsky@arm.com; receiver=lists.ozlabs.org) smtp.mailfrom=arm.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=arm.com (client-ip=217.140.110.172; helo=foss.arm.com; envelope-from=kevin.brodsky@arm.com; receiver=lists.ozlabs.org) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lists.ozlabs.org (Postfix) with ESMTP id 4d0fgK05wNz2xS9 for ; Tue, 4 Nov 2025 05:07:07 +1100 (AEDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 183932A6B; Mon, 3 Nov 2025 10:06:27 -0800 (PST) Received: from [10.1.30.16] (unknown [10.1.30.16]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 67BAA3F694; Mon, 3 Nov 2025 10:06:27 -0800 (PST) Message-ID: Date: Mon, 3 Nov 2025 18:06:24 +0000 X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 02/12] x86/xen: simplify flush_lazy_mmu() To: David Hildenbrand , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Alexander Gordeev , Andreas Larsson , Andrew Morton , Boris Ostrovsky , Borislav Petkov , Catalin Marinas , Christophe Leroy , Dave Hansen , "David S. Miller" , David Woodhouse , "H. Peter Anvin" , Ingo Molnar , Jann Horn , Juergen Gross , "Liam R. Howlett" , Lorenzo Stoakes , Madhavan Srinivasan , Michael Ellerman , Michal Hocko , Mike Rapoport , Nicholas Piggin , Peter Zijlstra , Ryan Roberts , Suren Baghdasaryan , Thomas Gleixner , Vlastimil Babka , Will Deacon , Yeoreum Yun , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org, xen-devel@lists.xenproject.org, x86@kernel.org References: <20251029100909.3381140-1-kevin.brodsky@arm.com> <20251029100909.3381140-3-kevin.brodsky@arm.com> <5a3ccb7e-9d36-4ac8-9634-c8dec3d6a47c@redhat.com> Content-Language: en-GB From: Kevin Brodsky In-Reply-To: <5a3ccb7e-9d36-4ac8-9634-c8dec3d6a47c@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 01/11/2025 12:14, David Hildenbrand wrote: > On 29.10.25 11:08, Kevin Brodsky wrote: >> arch_flush_lazy_mmu_mode() is called when outstanding batched >> pgtable operations must be completed immediately. There should >> however be no need to leave and re-enter lazy MMU completely. The >> only part of that sequence that we really need is xen_mc_flush(); >> call it directly. >> >> Signed-off-by: Kevin Brodsky >> --- >>   arch/x86/xen/mmu_pv.c | 6 ++---- >>   1 file changed, 2 insertions(+), 4 deletions(-) >> >> diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c >> index 2a4a8deaf612..7a35c3393df4 100644 >> --- a/arch/x86/xen/mmu_pv.c >> +++ b/arch/x86/xen/mmu_pv.c >> @@ -2139,10 +2139,8 @@ static void xen_flush_lazy_mmu(void) >>   { >>       preempt_disable(); >>   -    if (xen_get_lazy_mode() == XEN_LAZY_MMU) { >> -        arch_leave_lazy_mmu_mode(); >> -        arch_enter_lazy_mmu_mode(); >> -    } >> +    if (xen_get_lazy_mode() == XEN_LAZY_MMU) >> +        xen_mc_flush(); >>         preempt_enable(); >>   } > > Looks like that was moved to XEN code in > > commit a4a7644c15096f57f92252dd6e1046bf269c87d8 > Author: Juergen Gross > Date:   Wed Sep 13 13:38:27 2023 +0200 > >     x86/xen: move paravirt lazy code > > > And essentially the previous implementation lived in > arch/x86/kernel/paravirt.c:paravirt_flush_lazy_mmu(void) in an > implementation-agnostic way: > > void paravirt_flush_lazy_mmu(void) > { >        preempt_disable(); > >        if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU) { >                arch_leave_lazy_mmu_mode(); >                arch_enter_lazy_mmu_mode(); >        } > >        preempt_enable(); > } Indeed, I saw that too. Calling the generic leave/enter functions made some sense at that point, but now that the implementation is Xen-specific we can directly call xen_mc_flush(). > > So indeed, I assume just doing the flush here is sufficient. > > Reviewed-by: David Hildenbrand   Thanks for the review! - Kevin