From: john stultz <johnstul@us.ibm.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Richard Cochran <richardcochran@gmail.com>,
netdev@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
linux-api@vger.kernel.org, Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH 1/2] posix clocks: introduce a syscall for clock tuning.
Date: Thu, 09 Sep 2010 15:53:13 -0700 [thread overview]
Message-ID: <1284072793.2762.259.camel@localhost.localdomain> (raw)
In-Reply-To: <alpine.LFD.2.00.1009092244390.2477@localhost6.localdomain6>
On Thu, 2010-09-09 at 23:16 +0200, Thomas Gleixner wrote:
> Hmm. Talked to John Stultz about this and got enlightened that there
> might be more than one of these beasts. That changes the story
> slightly.
>
> So yes, I've been wrong as usual and we'll need some way of assigning
> those ids dynamically, but I'm still opposed to providing an
> unconfined "give me one of those id's" interface for public
> consumption.
>
> I'd rather see a controlled environment for device classes like PTP
> clocks. That would have a couple of advantages:
>
> - clear association of the device to a well defined functionality
>
> - avoidance of duplicated code
>
> - consistent sysfs interfaces for functionality which is device class
> specific
>
> - simpler identification for interested applications
>
> - preventing the random spread of clock id consumers
>
> So the clock device class code would provide the interface for these
> class specific hardware drivers and consult the posix timer core code
> to give out an id.
>
> And that would apply to any other class of clock devices which do not
> fall into the general clocksource category (e.g. RTCs, audio clocks
> ..)
>
> Thoughts ?
So at first I was concerned, because I thought you were suggesting we
distinguish between the classes of clocks in our userspace interface.
But after some clarification on IRC, you made it clear that you want
some generic infrastructure that supports what the PTP driver needs that
would then be re-usable by other clocks we want to similarly expose to
userland via a clockid.
So basically you want something akin to the struct clocksource for the
driver to register that would minimize code duplication.
My initial reaction, is that we already have the k_clock structure (from
include/linux/posix-timers.h):
struct k_clock {
int res; /* in nanoseconds */
int (*clock_getres) (const clockid_t which_clock, struct timespec *tp);
int (*clock_set) (const clockid_t which_clock, struct timespec * tp);
int (*clock_get) (const clockid_t which_clock, struct timespec * tp);
int (*timer_create) (struct k_itimer *timer);
int (*nsleep) (const clockid_t which_clock, int flags,
struct timespec *, struct timespec __user *);
long (*nsleep_restart) (struct restart_block *restart_block);
int (*timer_set) (struct k_itimer * timr, int flags,
struct itimerspec * new_setting,
struct itimerspec * old_setting);
int (*timer_del) (struct k_itimer * timr);
void (*timer_get) (struct k_itimer * timr,
struct itimerspec * cur_setting);
};
This is still very close to the level of the posix clocks/timers api, so
maybe you're wanting something a little lower level, possibly as low as
the clocksource/clockevent structures?
The only problem there is from the examples, it seems some PTP hardware
can be fairly self-contained. So its a actual ns clock that can be freq
adjusted in hardware, not a constant freq counter that is then converted
to nanoseconds and freq managed in software. So the interface probably
can't be quite as low-level as the clocksource/clockevent structures.
In fact, from the example drivers posted already, it looks like the
k_clock structure maps fairly close to what the hardware uses.
Other clock types that we may want to expose, such as the RTC also can
map fairly close to k_clock. The audio clocks may need some research, as
I suspect they're just a clocksource style counter, so some additional
software cycle->ns layering similar to the timekeeping core (but likely
much simpler) may be needed.
So the question to Richard is, what does the above k_clock not provide
that the PTP driver needs? If you've already made some stabs at it,
seeing an example of the generic header and a trivial example driver
that includes the k_clock structure, so we can see what it removed from
your earlier chardev implementation would be helpful.
thanks
-john
next prev parent reply other threads:[~2010-09-09 22:53 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-03 9:27 [PATCH 0/2] [RFC] posix clock tuning Richard Cochran
2010-09-03 9:29 ` [PATCH 1/2] posix clocks: introduce a syscall for " Richard Cochran
[not found] ` <7f4815cdfcf5bc49df4bdd09d59a4f56ca2598f5.1283504065.git.richard.cochran-3mrvs1K0uXizZXS1Dc/lvw@public.gmane.org>
2010-09-03 9:58 ` Richard Cochran
2010-09-04 14:06 ` Richard Cochran
2010-09-09 10:49 ` Thomas Gleixner
[not found] ` <alpine.LFD.2.00.1009091159260.2477-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>
2010-09-09 13:34 ` Richard Cochran
[not found] ` <20100909133449.GB2823-7KxsofuKt4IfAd9E5cN8NEzG7cXyKsk/@public.gmane.org>
2010-09-09 20:10 ` Thomas Gleixner
[not found] ` <alpine.LFD.2.00.1009092102150.2477-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>
2010-09-09 21:16 ` Thomas Gleixner
2010-09-09 22:53 ` john stultz [this message]
[not found] ` <1284072793.2762.259.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-09-10 9:23 ` Richard Cochran
2010-09-09 21:01 ` john stultz
[not found] ` <1284066084.2762.172.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-09-09 21:31 ` Thomas Gleixner
[not found] ` <cover.1283504065.git.richard.cochran-3mrvs1K0uXizZXS1Dc/lvw@public.gmane.org>
2010-09-03 9:30 ` [PATCH 2/2] posix clocks: introduce a sysfs presence Richard Cochran
[not found] ` <84124d2479b8967cac2b35f852fc0fcae6ad9444.1283504065.git.richard.cochran-3mrvs1K0uXizZXS1Dc/lvw@public.gmane.org>
2010-09-09 22:19 ` john stultz
2010-09-09 23:00 ` Alan Cox
[not found] ` <20100910000008.1483fdd7-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org>
2010-09-10 9:31 ` Richard Cochran
[not found] ` <20100910093135.GB10179-7KxsofuKt4IfAd9E5cN8NEzG7cXyKsk/@public.gmane.org>
2010-09-11 0:20 ` Greg KH
2010-09-09 9:58 ` [PATCH 0/2] [RFC] posix clock tuning Thomas Gleixner
[not found] ` <alpine.LFD.2.00.1009091152300.2477-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>
2010-09-09 12:21 ` Richard Cochran
[not found] ` <20100909122156.GA2823-7KxsofuKt4IfAd9E5cN8NEzG7cXyKsk/@public.gmane.org>
2010-09-09 12:50 ` Thomas Gleixner
[not found] ` <alpine.LFD.2.00.1009091443250.2477-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>
2010-09-09 15:02 ` Alan Cox
2010-09-04 17:23 ` Christoph Lameter
[not found] ` <alpine.DEB.2.00.1009041221240.888-sBS69tsa9Uj/9pzu0YdTqQ@public.gmane.org>
2010-09-04 17:48 ` Christian Riesch
[not found] ` <4C828652.4060804-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-09-05 1:37 ` Christoph Lameter
[not found] ` <alpine.DEB.2.00.1009042036540.9425-sBS69tsa9Uj/9pzu0YdTqQ@public.gmane.org>
2010-09-05 5:56 ` Richard Cochran
2010-09-05 1:47 ` Christoph Lameter
[not found] ` <alpine.DEB.2.00.1009042042130.9425-sBS69tsa9Uj/9pzu0YdTqQ@public.gmane.org>
2010-09-05 6:22 ` Richard Cochran
2010-09-05 7:20 ` Richard Cochran
2010-09-05 23:13 ` Christoph Lameter
[not found] ` <alpine.DEB.2.00.1009051759100.3480-sBS69tsa9Uj/9pzu0YdTqQ@public.gmane.org>
2010-09-06 7:09 ` Richard Cochran
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1284072793.2762.259.camel@localhost.localdomain \
--to=johnstul@us.ibm.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=richardcochran@gmail.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).