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]
Date:	Fri, 30 Sep 2011 10:35:53 -0700
From:	Randy Dunlap <rdunlap@...otime.net>
To:	Jan Kiszka <jan.kiszka@...mens.com>
CC:	Avi Kivity <avi@...hat.com>, Marcelo Tosatti <mtosatti@...hat.com>,
	Stephen Rothwell <sfr@...b.auug.org.au>,
	linux-next@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
	"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
	"Liu >> \"Liu, Jinsong\"" <jinsong.liu@...el.com>,
	"Tian, Kevin" <kevin.tian@...el.com>
Subject: Re: [PATCH] KVM: x86: Use do_div for tsc deadline calculation

On 09/30/11 04:50, Jan Kiszka wrote:
> Required on i386 hosts.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@...mens.com>

Reported-by: Randy Dunlap <rdunlap@...otime.net>
Acked-by: Randy Dunlap <rdunlap@...otime.net>

Thanks.

> ---
>  arch/x86/kvm/lapic.c |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index f9385ec..92390dc 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -740,9 +740,10 @@ static void start_apic_timer(struct kvm_lapic *apic)
>  
>  		now = apic->lapic_timer.timer.base->get_time();
>  		guest_tsc = kvm_x86_ops->read_l1_tsc(vcpu);
> -		if (likely(tscdeadline > guest_tsc))
> -			ns = (tscdeadline - guest_tsc)
> -				* 1000000L / this_tsc_khz;
> +		if (likely(tscdeadline > guest_tsc)) {
> +			ns = (tscdeadline - guest_tsc) * 1000000ULL;
> +			do_div(ns, this_tsc_khz);
> +		}
>  		hrtimer_start(&apic->lapic_timer.timer,
>  			ktime_add_ns(now, ns), HRTIMER_MODE_ABS);
>  


-- 
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
--
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