Commit 6735150
KVM: Use syscore_ops instead of reboot_notifier to hook restart/shutdown
Use syscore_ops.shutdown to disable hardware virtualization during a
reboot instead of using the dedicated reboot_notifier so that KVM disables
virtualization _after_ system_state has been updated. This will allow
fixing a race in KVM's handling of a forced reboot where KVM can end up
enabling hardware virtualization between kernel_restart_prepare() and
machine_restart().
Rename KVM's hook to match the syscore op to avoid any possible confusion
from wiring up a "reboot" helper to a "shutdown" hook (neither "shutdown
nor "reboot" is completely accurate as the hook handles both).
Opportunistically rewrite kvm_shutdown()'s comment to make it less VMX
specific, and to explain why kvm_rebooting exists.
Cc: Marc Zyngier <maz@kernel.org>
Cc: Oliver Upton <oliver.upton@linux.dev>
Cc: James Morse <james.morse@arm.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Zenghui Yu <yuzenghui@huawei.com>
Cc: kvmarm@lists.linux.dev
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
Cc: Anup Patel <anup@brainfault.org>
Cc: Atish Patra <atishp@atishpatra.org>
Cc: kvm-riscv@lists.infradead.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Acked-by: Marc Zyngier <maz@kernel.org>
Message-Id: <20230512233127.804012-2-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>1 parent 39428f6 commit 6735150
1 file changed
+11
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5213 | 5213 | | |
5214 | 5214 | | |
5215 | 5215 | | |
5216 | | - | |
5217 | | - | |
| 5216 | + | |
5218 | 5217 | | |
5219 | 5218 | | |
5220 | | - | |
5221 | | - | |
5222 | | - | |
5223 | | - | |
| 5219 | + | |
| 5220 | + | |
| 5221 | + | |
| 5222 | + | |
| 5223 | + | |
| 5224 | + | |
| 5225 | + | |
| 5226 | + | |
| 5227 | + | |
5224 | 5228 | | |
5225 | 5229 | | |
5226 | 5230 | | |
5227 | 5231 | | |
5228 | | - | |
5229 | 5232 | | |
5230 | 5233 | | |
5231 | | - | |
5232 | | - | |
5233 | | - | |
5234 | | - | |
5235 | | - | |
5236 | 5234 | | |
5237 | 5235 | | |
5238 | 5236 | | |
| |||
5263 | 5261 | | |
5264 | 5262 | | |
5265 | 5263 | | |
| 5264 | + | |
5266 | 5265 | | |
5267 | 5266 | | |
5268 | 5267 | | |
| |||
5967 | 5966 | | |
5968 | 5967 | | |
5969 | 5968 | | |
5970 | | - | |
5971 | 5969 | | |
5972 | 5970 | | |
5973 | 5971 | | |
| |||
6039 | 6037 | | |
6040 | 6038 | | |
6041 | 6039 | | |
6042 | | - | |
6043 | 6040 | | |
6044 | 6041 | | |
6045 | 6042 | | |
| |||
6065 | 6062 | | |
6066 | 6063 | | |
6067 | 6064 | | |
6068 | | - | |
6069 | 6065 | | |
6070 | 6066 | | |
6071 | 6067 | | |
| |||
0 commit comments