> > Can you move the call to kvm_cpu_xsave_init() after > > x86_cpu_enable_xsave_components()? Is it used anywhere before the CPU is > > running? > > Yes, this is an "ugly" palce. I did not fully defer the initialization > of the xstate array earlier also because I observed that both HVF and > TCG have similar xsave initialization interfaces within their accelerator's > cpu_instance_init() function. > > I think it might be better to do the same thing for HVF & TCG as well > (i.e., defer xstate initialization). Otherwise, if we only modify QEMU > KVM logic, it looks a bit fragmented... What do you think?
Ah, kvm_arch_get_supported_cpuid() currently caches the obtained CPUID. Delaying xstate initialization would require refreshing the previously cached old CPUID... This makes the cost of delaying xstate initialization higher, and I think this way becames not appropriate. Either keep the current different ways, or back to use host_cpuid for everything :( . Which do you think is better? Regards, Zhao
