Re: struct timehands: th_generation field

2015-07-24 Thread deco33000

OK.

I read the document and understood it I guess.
Very interesting, and well engineered.

On x86/i386/amd64, could not all this be replaced by a simple call to apic 
timer ?
We would get the timestamp, we can even store it, make calculation on top of it.

My jugement may miss something important though. That is why I ask :)


-- 
Jog
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org

Re: struct timehands: th_generation field

2015-07-24 Thread Adrian Chadd
accessing hardware isn't free. Locking also isn't free. That's why
there's this mechanism.



-adrian


On 24 July 2015 at 08:58,  deco33...@yandex.com wrote:

 OK.

 I read the document and understood it I guess.
 Very interesting, and well engineered.

 On x86/i386/amd64, could not all this be replaced by a simple call to apic 
 timer ?
 We would get the timestamp, we can even store it, make calculation on top of 
 it.

 My jugement may miss something important though. That is why I ask :)


 --
 Jog
 ___
 freebsd-stable@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-stable
 To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org


Re: struct timehands: th_generation field

2015-07-24 Thread deco33000 Jog

___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org


Re: struct timehands: th_generation field

2015-07-23 Thread Brandon Allbery
On Thu, Jul 23, 2015 at 9:43 AM, deco33...@yandex.com wrote:

 I am struggling on one field of a struct :
 http://fxr.watson.org/fxr/source/kern/kern_tc.c?v=FREEBSD10#L63
 I would like to understand what th_generation means please.


Seems to me you get a clue from: (
http://fxr.watson.org/fxr/source/kern/kern_tc.c?v=FREEBSD10#L192)

*/*** * Functions for reading the time.  We have to loop until we are
sure that** * the timehands that we operated on was not updated under
our feet.  See** * the comment in sys/time.h for a description of
these 12 functions.** */*

 #ifdef FFCLOCK
 voidfbclock_binuptime 
 http://fxr.watson.org/fxr/ident?v=FREEBSD10;i=fbclock_binuptime(struct 
 bintime http://fxr.watson.org/fxr/ident?v=FREEBSD10;i=bintime *bt 
 http://fxr.watson.org/fxr/ident?v=FREEBSD10;i=bt)
 {
 struct timehands 
 http://fxr.watson.org/fxr/ident?v=FREEBSD10;i=timehands *th;
 unsigned int gen http://fxr.watson.org/fxr/ident?v=FREEBSD10;i=gen;

 do {
 th = timehands 
 http://fxr.watson.org/fxr/ident?v=FREEBSD10;i=timehands;
 gen http://fxr.watson.org/fxr/ident?v=FREEBSD10;i=gen = 
 th-th_generation;
 *bt http://fxr.watson.org/fxr/ident?v=FREEBSD10;i=bt = 
 th-th_offset;
 bintime_addx 
 http://fxr.watson.org/fxr/ident?v=FREEBSD10;i=bintime_addx(bt 
 http://fxr.watson.org/fxr/ident?v=FREEBSD10;i=bt, th-th_scale * tc_delta 
 http://fxr.watson.org/fxr/ident?v=FREEBSD10;i=tc_delta(th));
 } while (gen http://fxr.watson.org/fxr/ident?v=FREEBSD10;i=gen == 0 
 || gen http://fxr.watson.org/fxr/ident?v=FREEBSD10;i=gen != 
 th-th_generation);
 }

 --
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org


struct timehands: th_generation field

2015-07-23 Thread deco33000
Hi,

Currently I read more about timers and clock.

I am struggling on one field of a struct : 
http://fxr.watson.org/fxr/source/kern/kern_tc.c?v=FREEBSD10#L63

I would like to understand what th_generation means please.

Thanks a lot

-- 
Jog
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org

Re: struct timehands: th_generation field

2015-07-23 Thread Brandon Allbery
On Thu, Jul 23, 2015 at 10:38 AM, deco33...@yandex.com wrote:

 Is the maximum value for th_generation equal to 10 ?
 http://fxr.watson.org/fxr/source/kern/kern_tc.c?v=FREEBSD10#L77


I don't think those relate to generations. Generations change on every
clock tick; the multiple timehands structs relate to forcibly setting the
time, as opposed to the clock moving forward normally. It does appear serve
a similar purpose, since forcibly setting the time is even more violent
(to anything currently reading the clock) than advancing the clock on a
clock tick, since that's when other adjustments including possibly
switching the clock source will be applied.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org


Re: struct timehands: th_generation field

2015-07-23 Thread deco33000

___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org


Re: struct timehands: th_generation field

2015-07-23 Thread Ian Lepore
On Thu, 2015-07-23 at 10:59 -0400, Brandon Allbery wrote:
 On Thu, Jul 23, 2015 at 10:38 AM, deco33...@yandex.com wrote:
 
  Is the maximum value for th_generation equal to 10 ?
  http://fxr.watson.org/fxr/source/kern/kern_tc.c?v=FREEBSD10#L77
 
 
 I don't think those relate to generations. Generations change on every
 clock tick; the multiple timehands structs relate to forcibly setting the
 time, as opposed to the clock moving forward normally. It does appear serve
 a similar purpose, since forcibly setting the time is even more violent
 (to anything currently reading the clock) than advancing the clock on a
 clock tick, since that's when other adjustments including possibly
 switching the clock source will be applied.
 

Ummm, no.  The multiple timehands and related generation count are all
about time moving forward normally, and doing so without needing mutxes
or other locking primitives to obtain the current time.  I think you
guys need to read this...

  http://phk.freebsd.dk/pubs/timecounter.pdf

Especially the section named Locking, lack of...

-- Ian


___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org