All of lore.kernel.org
 help / color / mirror / Atom feed
From: Carsten Emde <C.Emde@osadl.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	RT-users <linux-rt-users@vger.kernel.org>
Subject: Re: [PATCH 1/1] Clocksource: Add sched_clock to Atmel TCB clocksource
Date: Tue, 02 Jun 2015 23:06:04 +0200	[thread overview]
Message-ID: <556E1ABC.8090907@osadl.org> (raw)
In-Reply-To: <alpine.DEB.2.11.1506022230590.20347@nanos>

Hi Thomas,

>>   static void __iomem *tcaddr;
>> +static cycle_t (*do_sched_clock_get_cycles)(struct clocksource *cs);
>
> what's that for? Indirection for indirection sake?
The code apparently provides two different functions to read the current 
clock - depending on whether the clock is setup in single-channel mode 
or not.

The default function is predefined in the struct clocksource clksrc:
   .read = tc_get_cycles
This structure element may later on be overwritten, if the counter is 
configured in single-channel mode:
   clksrc.read = tc_get_cycles32;

This is why my code sets do_sched_clock_get_cycles to clksrc.read before 
sched_clock is registered to make sure the appropriate read function 
will be used.

>> +u64 sched_clock_get_cycles(void)
> Static?
Yes, sure, should be static. Will fix it.

> What's wrong with implementing this like:
>
> static u64 sched_clock_get_cycles(void)
> {
> 	return tc_get_cycles(NULL);
> }
> Hmm?
See above.

>> +	local_irq_save(flags);
> What's the purpose of this?
The sched_clock_register() function contains
   WARN_ON(!irqs_disabled());
which I did not want to trigger.

Thanks,
	-Carsten.

  reply	other threads:[~2015-06-02 21:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-02 13:42 [PATCH 1/1] Clocksource: Add sched_clock to Atmel TCB clocksource Carsten Emde
2015-06-02 20:38 ` Thomas Gleixner
2015-06-02 21:06   ` Carsten Emde [this message]
2015-06-02 21:15     ` Thomas Gleixner
2015-06-02 21:30       ` Carsten Emde

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=556E1ABC.8090907@osadl.org \
    --to=c.emde@osadl.org \
    --cc=bigeasy@linutronix.de \
    --cc=linux-rt-users@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.