lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131008133705.GR227855@redhat.com>
Date:	Tue, 8 Oct 2013 09:37:05 -0400
From:	Don Zickus <dzickus@...hat.com>
To:	Marcelo Tosatti <mtosatti@...hat.com>
Cc:	kvm@...r.kernel.org, pbonzini@...hat.com, gleb@...hat.com,
	linux-kernel@...r.kernel.org
Subject: Re: [patch 2/3] pvclock: detect watchdog reset at pvclock read

On Mon, Oct 07, 2013 at 10:05:17PM -0300, Marcelo Tosatti wrote:
> Implement reset of kernel watchdogs at pvclock read time. This avoids
> adding special code to every watchdog.
> 
> This is possible for watchdogs which measure time based on sched_clock() or 
> ktime_get() variants.
> 
> Suggested by Don Zickus.
> 
> Signed-off-by: Marcelo Tosatti <mtosatti@...hat.com>

Awesome.  Thanks for figuring this out Marcelo.  Does that mean we can
revert commit 5d1c0f4a now? :-)

This meets my expectations.  I'll leave it to the virt folks to figure out
if this covers all the corner cases or not.

Cheers,
Don

> 
> Index: kvm/arch/x86/kernel/kvmclock.c
> ===================================================================
> --- kvm.orig/arch/x86/kernel/kvmclock.c
> +++ kvm/arch/x86/kernel/kvmclock.c
> @@ -139,6 +139,7 @@ bool kvm_check_and_clear_guest_paused(vo
>  	src = &hv_clock[cpu].pvti;
>  	if ((src->flags & PVCLOCK_GUEST_STOPPED) != 0) {
>  		src->flags &= ~PVCLOCK_GUEST_STOPPED;
> +		pvclock_touch_watchdogs();
>  		ret = true;
>  	}
>  
> Index: kvm/arch/x86/kernel/pvclock.c
> ===================================================================
> --- kvm.orig/arch/x86/kernel/pvclock.c
> +++ kvm/arch/x86/kernel/pvclock.c
> @@ -21,6 +21,7 @@
>  #include <linux/sched.h>
>  #include <linux/gfp.h>
>  #include <linux/bootmem.h>
> +#include <linux/hung_task.h>
>  #include <asm/fixmap.h>
>  #include <asm/pvclock.h>
>  
> @@ -43,6 +44,14 @@ unsigned long pvclock_tsc_khz(struct pvc
>  	return pv_tsc_khz;
>  }
>  
> +void pvclock_touch_watchdogs(void)
> +{
> +	touch_softlockup_watchdog_sync();
> +	clocksource_touch_watchdog();
> +	rcu_cpu_stall_reset();
> +	reset_hung_task_detector();
> +}
> +
>  static atomic64_t last_value = ATOMIC64_INIT(0);
>  
>  void pvclock_resume(void)
> @@ -74,6 +83,11 @@ cycle_t pvclock_clocksource_read(struct
>  		version = __pvclock_read_cycles(src, &ret, &flags);
>  	} while ((src->version & 1) || version != src->version);
>  
> +	if (unlikely((flags & PVCLOCK_GUEST_STOPPED) != 0)) {
> +		src->flags &= ~PVCLOCK_GUEST_STOPPED;
> +		pvclock_touch_watchdogs();
> +	}
> +
>  	if ((valid_flags & PVCLOCK_TSC_STABLE_BIT) &&
>  		(flags & PVCLOCK_TSC_STABLE_BIT))
>  		return ret;
> Index: kvm/arch/x86/include/asm/pvclock.h
> ===================================================================
> --- kvm.orig/arch/x86/include/asm/pvclock.h
> +++ kvm/arch/x86/include/asm/pvclock.h
> @@ -14,6 +14,8 @@ void pvclock_read_wallclock(struct pvclo
>  			    struct timespec *ts);
>  void pvclock_resume(void);
>  
> +void pvclock_touch_watchdogs(void);
> +
>  /*
>   * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction,
>   * yielding a 64-bit result.
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ