]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: patch_text: Fixup last cpu should be master
authorGuo Ren <guoren@linux.alibaba.com>
Thu, 7 Apr 2022 07:33:20 +0000 (15:33 +0800)
committerWill Deacon <will@kernel.org>
Fri, 8 Apr 2022 10:43:46 +0000 (11:43 +0100)
commit7164611e997de1e142586a6e9ea17acb06baedf8
tree8822babc29f92bb2327da5bb31cf2286901fa73f
parentaeb04798ebd56cf313762919bfd4cfe5b3c7a9b7
arm64: patch_text: Fixup last cpu should be master

These patch_text implementations are using stop_machine_cpuslocked
infrastructure with atomic cpu_count. The original idea: When the
master CPU patch_text, the others should wait for it. But current
implementation is using the first CPU as master, which couldn't
guarantee the remaining CPUs are waiting. This patch changes the
last CPU as the master to solve the potential risk.

Fixes: e547c45eafa1 ("arm64: introduce interfaces to hotpatch kernel and module code")
Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Signed-off-by: Guo Ren <guoren@kernel.org>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220407073323.743224-2-guoren@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/kernel/patching.c