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:   Sat, 21 Jan 2017 09:02:28 +0100
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Radim Krcmar <rkrcmar@...hat.com>,
        Marcelo Tosatti <mtosatti@...hat.com>
Cc:     kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
        Richard Cochran <richardcochran@...il.com>,
        Miroslav Lichvar <mlichvar@...hat.com>
Subject: Re: [patch 5/5] PTP: add kvm PTP driver



On 20/01/2017 19:08, Radim Krcmar wrote:
> 2017-01-20 13:00-0200, Marcelo Tosatti:
>> On Fri, Jan 20, 2017 at 03:12:56PM +0100, Radim Krcmar wrote:
>>> 2017-01-20 10:20-0200, Marcelo Tosatti:
>>>> +	do {
>>>> +		/*
>>>> +		 * We are measuring the delay between
>>>> +		 * kvm_hypercall and rdtsc using TSC,
>>>> +		 * and converting that delta to
>>>> +		 * tsc_to_system_mul and tsc_shift
>>>> +		 * So any changes to tsc_to_system_mul
>>>> +		 * and tsc_shift in this region
>>>> +		 * invalidate the measurement.
>>>> +		 */
>>>> +		version = pvclock_read_begin(src);
>>>> +
>>>> +		ret = kvm_hypercall2(KVM_HC_CLOCK_PAIRING,
>>>> +				     clock_off_gpa,
>>>> +				     KVM_CLOCK_PAIRING_WALLCLOCK);
>>>> +		if (ret != 0) {
>>>> +			pr_err("clock offset hypercall ret %lu\n", ret);
>>>> +			spin_unlock(&kvm_ptp_lock);
>>>> +			preempt_enable_notrace();
>>>> +			return -EOPNOTSUPP;
>>>> +		}
>>>> +
>>>> +		tspec.tv_sec = clock_off.sec;
>>>> +		tspec.tv_nsec = clock_off.nsec;
>>>> +		ret = __pvclock_read_cycles(src, clock_off.tsc);
>>>> +		flags = src->flags;
>>>> +	} while (pvclock_read_retry(src, version));
>>>> +
>>>> +	preempt_enable_notrace();
>>>> +
>>>> +	system_counter->cycles = ret;
>>>> +	system_counter->cs = get_kvmclock_cs();
>>>
>>> Can't we use clocksource_tsc and just pass the tsc without kvmclock in
>>> the middle?
>>
>> No, it has to be the kvmclock value.
> 
> What happens if the guest switches from kvmclock to tsc?

get_device_system_crosststamp handles it, that's why there is a
clocksource field in system_counter.

Paolo

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ