Re: [PATCH v7 002/102] Partially revert "KVM: Pass kvm_init()'s opaque param to additional arch funcs"
From: Isaku Yamahata
Date: Tue Jul 26 2022 - 19:58:06 EST
On Wed, Jul 13, 2022 at 01:55:46PM +1200,
Kai Huang <kai.huang@xxxxxxxxx> wrote:
> On Mon, 2022-06-27 at 14:52 -0700, isaku.yamahata@xxxxxxxxx wrote:
> > From: Chao Gao <chao.gao@xxxxxxxxx>
> >
> > This partially reverts commit b99040853738 ("KVM: Pass kvm_init()'s opaque
> > param to additional arch funcs") remove opaque from
> > kvm_arch_check_processor_compat because no one uses this opaque now.
> > Address conflicts for ARM (due to file movement) and manually handle RISC-V
> > which comes after the commit.
> >
> > And changes about kvm_arch_hardware_setup() in original commit are still
> > needed so they are not reverted.
>
> I tried to dig the history to find out why we are doing this.
>
> IMHO it's better to give a reason why you need to revert the opaque. I guess no
> one uses this opaque now doesn't mean we need to remove it?
>
> Perhaps you should mention this is a preparation to
> hardware_enable_all()/hardware_disable_all() during module loading time.
> Instead of extending hardware_enable_all()/hardware_disable_all() to take the
> opaque and pass to kvm_arch_check_process_compat(), just remove the opaque.
>
> Or perhaps just merge this patch to next one?
Here is the updated commit message.
Partially revert "KVM: Pass kvm_init()'s opaque param to additional arch funcs"
This partially reverts commit b99040853738 ("KVM: Pass kvm_init()'s opaque
param to additional arch funcs") remove opaque from
kvm_arch_check_processor_compat because no one uses this opaque now.
Address conflicts for ARM (due to file movement) and manually handle RISC-V
which comes after the commit. The change about kvm_arch_hardware_setup()
in original commit are still needed so they are not reverted.
The current implementation enables hardware (e.g. enable VMX on all CPUs),
arch-specific initialization for VM creation, and disables hardware (in
x86, disable VMX on all CPUs) for last VM destruction.
TDX requires its initialization on loading KVM module with VMX enabled on
all available CPUs. It needs to enable/disable hardware on module
initialization. To reuse the same logic, one way is to pass around the
unused opaque argument, another way is to remove the unused opaque
argument. This patch is a preparation for the latter by removing the
argument.
--
Isaku Yamahata <isaku.yamahata@xxxxxxxxx>