Re: [PATCH] kvm: Fix kvmclock initialization on !CONFIG_KVM_GUEST

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 17, 2012 at 09:10:42AM +0900, OGAWA Hirofumi wrote:
> Marcelo Tosatti <mtosatti@xxxxxxxxxx> writes:
> 
> > On Wed, Aug 15, 2012 at 11:05:57PM +0900, OGAWA Hirofumi wrote:
> >> 
> >> If !CONFIG_KVM_GUEST, kvm_smp_prepare_boot_cpu() is not defined. So,
> >> kvm_register_clock("primary cpu clock") in kvm_smp_prepare_boot_cpu()
> >> is not called.
> >> 
> >> The detail of problem is hv_clock percpu usage. hv_clock is percpu
> >> variable, but kvmclock_init() is called _before_ initializing percpu
> >> area, and doesn't update address after initialized percpu area.
> >> 
> >> So, host kvm modify the memory area _before_ initializing percpu. This
> >> became the cause of strange memory corruption on guest OS.
> >> 
> >> 
> >> This fixes it by adding kvm_smp_prepare_boot_cpu().  [we might be
> >> better to kill the usage before percpu initialization.]
> >> 
> >> Signed-off-by: OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>
> >
> > The distinction between CONFIG_KVM_CLOCK and CONFIG_KVM_GUEST is 
> > not so clear anymore, as this bug demonstrates.
> >
> > There is no point in having a separate config option, therefore i
> > propose to merge the two (see other reply) instead.
> 
> Yes, it was an another option to fix this. As note, the wrong percpu
> usage (use it before initialization) is still true even if merged
> KVM_CLOCK.

Its fine, i believe, because there is a percpu area for the "boot
processor" (see __per_cpu_offset at arch/x86/kernel/setup_percpu.c) 
before proper initialization.

Can you please confirm the proposed config merge fixes the problem 
for you?

> Thanks.
> -- 
> OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux