[PATCH] mm: Pair atomic_read_release() with _acquire()
Ard Biesheuvel
ardb at kernel.org
Mon Oct 21 02:16:25 PDT 2024
Hi Linus,
On Mon, 21 Oct 2024 at 10:53, Linus Walleij <linus.walleij at linaro.org> wrote:
>
> The code for syncing vmalloc memory PGD pointers is using
> atomic_read() in pair with atomic_read_release() but the
> proper pairing is atomic_read_acquire() paired with
> atomic_read_release().
>
atomic_read_release() does not exist.
Maybe explain here that the read_acquire() prevents
sync_vmalloc_pgds() from observing stale init_mm contents?
> Fixes: d31e23aff011 ("ARM: mm: make vmalloc_seq handling SMP safe")
> Suggested-by: Mark Rutland <mark.rutland at arm.com>
> Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
> ---
> This patch was done on top of Melon Liu's patch:
> https://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=9427/1
> ---
> arch/arm/mm/ioremap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
> index f952b0b0f8a5..257ed86f3474 100644
> --- a/arch/arm/mm/ioremap.c
> +++ b/arch/arm/mm/ioremap.c
> @@ -138,7 +138,7 @@ void __check_vmalloc_seq(struct mm_struct *mm)
> int seq;
>
> do {
> - seq = atomic_read(&init_mm.context.vmalloc_seq);
> + seq = atomic_read_acquire(&init_mm.context.vmalloc_seq);
> sync_vmalloc_pgds(mm);
> /*
> * Use a store-release so that other CPUs that observe the
>
> ---
> base-commit: d530f55d9fde0aae4ac90e072b288da13f6aae81
> change-id: 20241021-atomic-read-acquire-52a667991cfc
>
> Best regards,
> --
> Linus Walleij <linus.walleij at linaro.org>
>
More information about the linux-arm-kernel
mailing list