[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cb706d3f-1fa8-2047-e65c-e1dc1fa6821f@nvidia.com>
Date: Tue, 23 May 2023 19:20:31 -0700
From: John Hubbard <jhubbard@...dia.com>
To: Alistair Popple <apopple@...dia.com>,
Andrew Morton <akpm@...ux-foundation.org>, <will@...nel.org>,
<catalin.marinas@....com>, David Rientjes <rientjes@...gle.com>
CC: <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
<robin.murphy@....com>, <nicolinc@...dia.com>,
<linux-arm-kernel@...ts.infradead.org>, <kvm@...r.kernel.org>,
<jgg@...dia.com>, <zhi.wang.linux@...il.com>,
Sean Christopherson <seanjc@...gle.com>
Subject: Re: [PATCH 1/2] mmu_notifiers: Restore documentation for
.invalidate_range()
On 5/23/23 18:47, Alistair Popple wrote:
> The .invalidate_range() callback is called by
> mmu_notifier_invalidate_range() which is often called while holding
> the ptl spin-lock. Therefore any implementations of this callback must
> not sleep. This was originally documented when the call back was added
> in commit 0f0a327fa12c ("mmu_notifier: add the callback for
> mmu_notifier_invalidate_range()") but appears to have been
Thanks for digging into this. I expect that you're on the right
track, I'm just wondering about something still:
> inadvertently removed by commit 5ff7091f5a2c ("mm, mmu_notifier:
> annotate mmu notifiers with blockable invalidate callbacks").
Was it really inadvertent, though? The initial patch proposed said this:
"Also remove a bogus comment about invalidate_range() always being called
under the ptl spinlock." [1]
I've added David Rientjes to CC.
I almost think we should rename the callback to something with
"non blocking" or similar in the name. It not great to have to
do this much research to figure out the intent. And it still feels
backwards.
[1] https://lore.kernel.org/all/alpine.DEB.2.10.1801091339570.240101@chino.kir.corp.google.com/T/#u
>
> Restore the comment to make it clear that .invalidate_range()
> callbacks may not sleep.
>
> Signed-off-by: Alistair Popple <apopple@...dia.com>
> ---
> include/linux/mmu_notifier.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
> index 64a3e05..447d757 100644
> --- a/include/linux/mmu_notifier.h
> +++ b/include/linux/mmu_notifier.h
> @@ -200,6 +200,9 @@ struct mmu_notifier_ops {
> * external TLB range needs to be flushed. For more in depth
> * discussion on this see Documentation/mm/mmu_notifier.rst
> *
> + * The invalidate_range() function is called under the ptl
> + * spin-lock and not allowed to sleep.
> + *
> * Note that this function might be called with just a sub-range
> * of what was passed to invalidate_range_start()/end(), if
> * called between those functions.
>
> base-commit: 44c026a73be8038f03dbdeef028b642880cf1511
Hooray for --base! :)
thanks,
--
John Hubbard
NVIDIA
Powered by blists - more mailing lists