Re: [PATCH 2/5 V5] Add functions to check if the host has stopped the vm

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

 



On 12/05/2011 10:19 PM, Eric B Munson wrote:
> When a host stops or suspends a VM it will set a flag to show this.  The
> watchdog will use these functions to determine if a softlockup is real, or the
> result of a suspended VM.
>  
> +bool kvm_check_and_clear_guest_paused(int cpu)
> +{
> +	bool ret = false;
> +	struct pvclock_vcpu_time_info *src;
> +
> +	/*
> +	 * per_cpu() is safe here because this function is only called from
> +	 * timer functions where preemption is already disabled.
> +	 */
> +	WARN_ON(!in_atomic());
> +	src = &per_cpu(hv_clock, cpu);

__get_cpu_var(); drop the cpu argument

> +	if ((src->flags & PVCLOCK_GUEST_STOPPED) != 0) {
> +		src->flags = src->flags & (~PVCLOCK_GUEST_STOPPED);

Isn't this racy?  Between reading and writing src->flags, we can exit to
the hypervisor and add/remove new flags.  The write then overrides those
new flags.

> +		ret = true;
> +	}
> +
> +	return ret;
> +}
> +EXPORT_SYMBOL_GPL(kvm_check_and_clear_guest_paused);
> +
>  static struct clocksource kvm_clock = {
>  	.name = "kvm-clock",
>  	.read = kvm_clock_get_cycles,


-- 
error compiling committee.c: too many arguments to function

--
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