[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2024091002-caution-tinderbox-a847@gregkh>
Date: Tue, 10 Sep 2024 09:32:10 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: WangYuli <wangyuli@...ontech.com>
Cc: stable@...r.kernel.org, sashal@...nel.org, parri.andrea@...il.com,
mathieu.desnoyers@...icios.com, palmer@...osinc.com,
linux-kernel@...r.kernel.org, paul.walmsley@...ive.com,
palmer@...belt.com, aou@...s.berkeley.edu, nathan@...nel.org,
ndesaulniers@...gle.com, trix@...hat.com,
linux-riscv@...ts.infradead.org, llvm@...ts.linux.dev,
paulmck@...nel.org, mingo@...hat.com, peterz@...radead.org,
juri.lelli@...hat.com, vincent.guittot@...aro.org,
dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
mgorman@...e.de, bristot@...hat.com, vschneid@...hat.com,
brauner@...nel.org, arnd@...db.de
Subject: Re: [PATCH 6.6] membarrier: riscv: Add full memory barrier in
switch_mm()
On Mon, Sep 09, 2024 at 10:57:01AM +0800, WangYuli wrote:
> From: Andrea Parri <parri.andrea@...il.com>
>
> [ Upstream commit d6cfd1770f20392d7009ae1fdb04733794514fa9 ]
>
> The membarrier system call requires a full memory barrier after storing
> to rq->curr, before going back to user-space. The barrier is only
> needed when switching between processes: the barrier is implied by
> mmdrop() when switching from kernel to userspace, and it's not needed
> when switching from userspace to kernel.
>
> Rely on the feature/mechanism ARCH_HAS_MEMBARRIER_CALLBACKS and on the
> primitive membarrier_arch_switch_mm(), already adopted by the PowerPC
> architecture, to insert the required barrier.
>
> Fixes: fab957c11efe2f ("RISC-V: Atomic and Locking Code")
> Signed-off-by: Andrea Parri <parri.andrea@...il.com>
> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
> Link: https://lore.kernel.org/r/20240131144936.29190-2-parri.andrea@gmail.com
> Signed-off-by: Palmer Dabbelt <palmer@...osinc.com>
> Signed-off-by: WangYuli <wangyuli@...ontech.com>
> ---
> MAINTAINERS | 2 +-
> arch/riscv/Kconfig | 1 +
> arch/riscv/include/asm/membarrier.h | 31 +++++++++++++++++++++++++++++
> arch/riscv/mm/context.c | 2 ++
> kernel/sched/core.c | 5 +++--
> 5 files changed, 38 insertions(+), 3 deletions(-)
> create mode 100644 arch/riscv/include/asm/membarrier.h
Now queued up, thanks.
greg k-h
Powered by blists - more mailing lists