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  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:   Mon, 23 Jan 2017 21:06:20 -0200
From:   Marcelo Tosatti <mtosatti@...hat.com>
To:     Richard Cochran <richardcochran@...il.com>
Cc:     kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
        Paolo Bonzini <pbonzini@...hat.com>,
        Radim Krcmar <rkrcmar@...hat.com>,
        Miroslav Lichvar <mlichvar@...hat.com>
Subject: Re: [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross
 timestamps infrastructure

On Mon, Jan 23, 2017 at 07:44:15PM +0100, Richard Cochran wrote:
> On Mon, Jan 23, 2017 at 11:19:17AM -0200, Marcelo Tosatti wrote:
> > This is needed to generate the PTP_SYS_OFFSET data: a table with read
> > from realtime clock, read from device clock, read from realtime clock,
> > ... :
> > 
> > time ->
> > device clock	|	|sample2|	|sample4|	|sample6| ...
> > -------------------------------------------------------------
> > realtime clock  |sample1|       |sample3|	|sample5|
> 
> Here "realtime clock" is CLOCK_REALTIME on the guest, and "device
> clock" is CLOCK_REALTIME on the host?

Yes.

>  
> > Where sampleN is the read of the respective clock.
> > 
> > From the following PTP_SYS_OFFSET_PRECISE data:
> > 
> > device clock	|sample1P,deviceclock|       |sample2P,deviceclock|
> > -------------------------------------------------------------
> > realtime clock  |sample1P,realtimeclock|     |sample2P,realtimeclock|
> 
> Are |sample1P,deviceclock| and |sample1P,realtimeclock| taken at the
> same instant in time?

Yes they are.

> If not, then calling that PTP_SYS_OFFSET_PRECISE is misleading.

It is.

> Still don't get what you are doing here...

What KVM provides is reading two clocks (host clock and guest clock)
at the exact same time (because both are based on TSC, so you do RDTSC 
once and use that result to calculate two clocks: host and guest realtime
clocks).

So what this interface provides is the following: If a PTP driver
provides ->getcrosstimestamps callback (meaning the driver can read
the value of two clocks at the same instant), and does not provide 
->gettime64 callback, then you approximate the first "diagram" 
using the second "diagram" (ie: the arithmetic mean of the samples).

Can you please describe what problem exists with this scheme?

Would you prefer to get rid of the "emulation" of ->gettime64 
by implementing ->gettime64 directly? Can do that as well.

Thanks.

Powered by blists - more mailing lists