From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 301B427BF93; Mon, 24 Nov 2025 14:36:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763995003; cv=none; b=d4IY9xe3t7aOrQMO7Gks447tR1ayAA3Hh4U+YnnmqaLpUEQjibFMfPMZLGrN54ZbuFaYlgzDuatYP+1tdrfQzf3fw6FlfD9FfB9Mrt7Exxw+xRzRB/Cic7ztZU6axMJcf7aMN+mc4JIvGNC343LyfKa9MhOy41MM8MJK++a8JLE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763995003; c=relaxed/simple; bh=/avnOwJGnCE/I+ECkDiV4qvIHPnVbrWaWjEEGhk7X68=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=FV9jEWxFTWlKTU53ycnWq2w9+H0ZknnEOV39wMEgJOr0OCSjlmve0Ii+rLJRA8wRkgD/+ldUGlXPYP1UwlxlBfCOjRrZT/HbG8xIcjuYQxkxsiSAyPpIMJ8lbxoHVtPQLO3tQrRmT1zMK6hjolP6Y52/xWuBYY0aBzbdL1j1bGs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 80775497; Mon, 24 Nov 2025 06:36:32 -0800 (PST) Received: from [10.57.88.238] (unknown [10.57.88.238]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 94CBA3F6A8; Mon, 24 Nov 2025 06:36:34 -0800 (PST) Message-ID: Date: Mon, 24 Nov 2025 14:36:32 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 06/12] mm: introduce generic lazy_mmu helpers Content-Language: en-GB To: Kevin Brodsky , 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 Hildenbrand , "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 , 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-7-kevin.brodsky@arm.com> <71418b31-aedb-4600-9558-842515dd6c44@arm.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 24/11/2025 12:47, Kevin Brodsky wrote: > On 10/11/2025 11:45, Kevin Brodsky wrote: >>>> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c >>>> index b8d37eb037fc..d9c8e94f140f 100644 >>>> --- a/arch/arm64/mm/mmu.c >>>> +++ b/arch/arm64/mm/mmu.c >>>> @@ -731,7 +731,7 @@ int split_kernel_leaf_mapping(unsigned long start, unsigned long end) >>>> return -EINVAL; >>>> >>>> mutex_lock(&pgtable_split_lock); >>>> - arch_enter_lazy_mmu_mode(); >>>> + lazy_mmu_mode_enable(); >>>> >>>> /* >>>> * The split_kernel_leaf_mapping_locked() may sleep, it is not a >>> This is a bit unfortunate, IMHO. The rest of this comment explains that although >>> you're not supposed to sleep inside lazy mmu mode, it's fine for arm64's >>> implementation. But we are no longer calling arm64's implementation; we are >>> calling a generic function, which does who knows what. >>> >>> I think it all still works, but we are no longer containing our assumptions in >>> arm64 code. We are relying on implementation details of generic code. >> I see your point. The change itself is still correct (and required >> considering patch 8), but maybe the documentation of the generic >> interface should be clarified to guarantee that the generic layer can >> itself cope with sleeping - without any guarantee regarding the >> behaviour of arch_*_lazy_mmu_mode. > > Re-reading the existing comment in , I think it already > makes clear that sleeping is not forbidden by design: > >>  * In the general case, no lock is guaranteed to be held between entry >> and exit >>  * of the lazy mode. So the implementation must assume preemption may >> be enabled >>  * and cpu migration is possible; it must take steps to be robust >> against this. > > The arch implementation may disable preemption, but arm64 code can rely > on the arm64 implementation allowing sleeping. Yeah ok, I buy that! > > - Kevin >