public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: john stultz <johnstul@us.ibm.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Richard Cochran <richardcochran@gmail.com>,
	linux-kernel@vger.kernel.org, linux-api@vger.kernel.org,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Christoph Lameter <cl@linux.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH RFC 2/8] clock device: convert clock_gettime
Date: Tue, 09 Nov 2010 13:37:02 -0800	[thread overview]
Message-ID: <1289338622.9434.46.camel@localhost.localdomain> (raw)
In-Reply-To: <201011080756.50930.arnd@arndb.de>

On Mon, 2010-11-08 at 07:56 +0100, Arnd Bergmann wrote:
> On Thursday 04 November 2010, Richard Cochran wrote:
> > diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
> > index 3e23844..70f40e6 100644
> > --- a/include/linux/posix-timers.h
> > +++ b/include/linux/posix-timers.h
> > @@ -17,10 +17,22 @@ struct cpu_timer_list {
> >  	int firing;
> >  };
> >  
> > +/* Bit fields within a clockid:
> > + *
> > + * The most significant 29 bits hold either a pid or a file descriptor.
> > + *
> > + * Bit 2 indicates whether a cpu clock refers to a thread or a process.
> > + *
> > + * Bits 1 and 0 give the type: PROF=0, VIRT=1, SCHED=2, or FD=3.
> > + *
> > + * A clockid is invalid if bits 2, 1, and 0 all set (see also CLOCK_INVALID
> > + * in include/linux/time.h)
> > + */
> > +
> >  #define 	(clock)		((pid_t) ~((clock) >> 3))
> >  #define CPUCLOCK_PERTHREAD(clock) \
> >  	(((clock) & (clockid_t) CPUCLOCK_PERTHREAD_MASK) != 0)
> > -#define CPUCLOCK_PID_MASK	7
> > +
> >  #define CPUCLOCK_PERTHREAD_MASK	4
> >  #define CPUCLOCK_WHICH(clock)	((clock) & (clockid_t) CPUCLOCK_CLOCK_MASK)
> >  #define CPUCLOCK_CLOCK_MASK	3
> > @@ -28,12 +40,17 @@ struct cpu_timer_list {
> >  #define CPUCLOCK_VIRT		1
> >  #define CPUCLOCK_SCHED		2
> >  #define CPUCLOCK_MAX		3
> > +#define CLOCKFD			CPUCLOCK_MAX
> > +#define CLOCKFD_MASK		(CPUCLOCK_PERTHREAD_MASK|CPUCLOCK_CLOCK_MASK)
> 
> It looks like you are turning a kernel internal interface into a user ABI,
> which I think is highly questionable. Using the bits like this internally is
> ok, but making it part of the syscall ABI means that we can never change this
> in the future.
> 
> Maybe I was misunderstanding your patch though.


As Richard already mentioned, the cpuclocks has already exported this as
ABI and its used in pthread_getcpuclockid().

I wonder thought if it would be worth having a syscall to convert from
fd to clock_id so it could be more flexible in the future. But it may
not be worth it, as we're probably already limited by the cpuclock
implementation.

thanks
-john




  parent reply	other threads:[~2010-11-09 21:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-04 19:26 [PATCH RFC 0/8] Dynamic clock devices Richard Cochran
2010-11-04 19:28 ` [PATCH RFC 1/8] Introduce dynamic " Richard Cochran
2010-11-08  6:38   ` Arnd Bergmann
2010-12-04 14:55     ` Richard Cochran
2010-12-06 14:14       ` Arnd Bergmann
2010-11-04 19:28 ` [PATCH RFC 2/8] clock device: convert clock_gettime Richard Cochran
2010-11-08  6:56   ` Arnd Bergmann
2010-11-09 10:26     ` Richard Cochran
2010-11-09 12:47       ` Arnd Bergmann
2010-11-09 21:37     ` john stultz [this message]
2010-11-10 10:16       ` Arnd Bergmann
2010-11-08 23:37   ` john stultz
2010-11-09  8:23     ` Richard Cochran
2010-11-09 21:10       ` john stultz
2010-11-15  9:41         ` Richard Cochran
2010-11-04 19:28 ` [PATCH RFC 3/8] clock device: convert clock_getres Richard Cochran
2010-11-04 19:29 ` [PATCH RFC 4/8] clock device: convert clock_settime Richard Cochran
2010-11-04 19:29 ` [PATCH RFC 5/8] clock device: convert timer_create Richard Cochran
2010-11-04 19:30 ` [PATCH RFC 6/8] clock device: convert timer_delete Richard Cochran
2010-11-04 19:30 ` [PATCH RFC 7/8] clock device: convert timer_gettime Richard Cochran
2010-11-04 19:30 ` [PATCH RFC 8/8] clock device: convert timer_settime Richard Cochran
2010-11-08 23:01 ` [PATCH RFC 0/8] Dynamic clock devices john stultz
2010-11-15  9:34   ` Richard Cochran
2010-11-15 10:01 ` Paul Mundt
2010-11-18 16:33   ` 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=1289338622.9434.46.camel@localhost.localdomain \
    --to=johnstul@us.ibm.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arnd@arndb.de \
    --cc=cl@linux.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@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