lkml.org 
[lkml]   [2006]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH] RTC: Add mmap method to rtc character driver
    From
    Date
    On Wed, 2006-07-26 at 17:16 +0200, Andi Kleen wrote:
    > Neil Horman <nhorman@tuxdriver.com> writes:
    >
    > > At OLS last week, During Dave Jones Userspace Sucks presentation, Jim
    > > Geddys and some of the Xorg guys noted that they would be able to stop using gettimeofday
    > > so frequently, if they had some other way to get a millisecond resolution timer
    > > in userspace,

    I agree with Andi here.

    >
    > No, no, it's wrong. They should use gettimeofday and the kernel's job
    > is to make it fast enough that they can.

    Exactly. On modern machines, doing a procedure call to get the time (as
    opposed to a system trap) is, I suspect, very tolerable. And who knows,
    maybe a smart compiler inlines the procedure so it optimizes to just a
    few instructions.

    If behind the scenes there is a mapped page that is used to convey this
    information efficiently, that's fine.

    But I don't think it should be the application programmer's
    responsibility to know of hackish solutions of mmapping particular
    devices on particular OS hardware or software platforms. That's a
    symptom of the disease, rather than a clean solution.

    >
    > Or rather they likely shouldn't use gettimeofday, but clock_gettime()
    > with CLOCK_MONOTONIC instead to be independent of someone setting the
    > clock back.

    Turns out we already have code to handle the turn back case, but
    monotonically increasing time is generally appreciated ;-).

    >
    > Memory mapped counters are generally not flexible enough and there
    > are lots of reasons why the kernel might need to do special things
    > for time keeping. Don't expose them.

    Yup. I agree entirely.

    >
    > -Andi
    --
    Jim Gettys
    One Laptop Per Child


    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2006-07-26 19:27    [W:3.588 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site