[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1153934710.8660.56.camel@localhost.localdomain>
Date: Wed, 26 Jul 2006 13:25:09 -0400
From: Jim Gettys <jg@...top.org>
To: Andi Kleen <ak@...e.de>
Cc: Neil Horman <nhorman@...driver.com>, a.zummo@...ertech.it,
jg@...edesktop.org, linux-kernel@...r.kernel.org,
Keith Packard <keithp@...thp.com>
Subject: Re: [PATCH] RTC: Add mmap method to rtc character driver
On Wed, 2006-07-26 at 17:16 +0200, Andi Kleen wrote:
> Neil Horman <nhorman@...driver.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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists