Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1563833

Re: [patch 5/5] PTP: add kvm PTP driver

From Radim Krcmar <rkrcmar@redhat.com>
Newsgroups linux.kernel
Subject Re: [patch 5/5] PTP: add kvm PTP driver
Date 2017-01-20 19:10 +0100
Message-ID <t1LNn-29E-7@gated-at.bofh.it> (permalink)
References <t1Gul-7bo-3@gated-at.bofh.it> <t1Gum-7bo-17@gated-at.bofh.it> <t1IcO-8iP-23@gated-at.bofh.it> <t1IZc-oG-33@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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?

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[patch 5/5] PTP: add kvm PTP driver Marcelo Tosatti <mtosatti@redhat.com> - 2017-01-20 13:30 +0100
  Re: [patch 5/5] PTP: add kvm PTP driver Paolo Bonzini <pbonzini@redhat.com> - 2017-01-20 14:10 +0100
    Re: [patch 5/5] PTP: add kvm PTP driver Marcelo Tosatti <mtosatti@redhat.com> - 2017-01-20 14:20 +0100
  Re: [patch 5/5] PTP: add kvm PTP driver Radim Krcmar <rkrcmar@redhat.com> - 2017-01-20 15:20 +0100
    Re: [patch 5/5] PTP: add kvm PTP driver Radim Krcmar <rkrcmar@redhat.com> - 2017-01-20 15:30 +0100
    Re: [patch 5/5] PTP: add kvm PTP driver Marcelo Tosatti <mtosatti@redhat.com> - 2017-01-20 16:10 +0100
      Re: [patch 5/5] PTP: add kvm PTP driver Paolo Bonzini <pbonzini@redhat.com> - 2017-01-20 18:20 +0100
      Re: [patch 5/5] PTP: add kvm PTP driver Radim Krcmar <rkrcmar@redhat.com> - 2017-01-20 19:10 +0100
        Re: [patch 5/5] PTP: add kvm PTP driver Marcelo Tosatti <mtosatti@redhat.com> - 2017-01-20 20:40 +0100
        Re: [patch 5/5] PTP: add kvm PTP driver Paolo Bonzini <pbonzini@redhat.com> - 2017-01-21 09:10 +0100

csiph-web