From: Thomas Gleixner <tglx@linutronix.de>
To: John Stultz <john.stultz@linaro.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
"Jamie Lokier" <jamie@shareable.org>,
"Alexander Shishkin" <virtuoso@slind.org>,
"Arve Hjønnevåg" <arve@android.com>
Subject: Re: [PATCH 1/2] hrtimers: extend hrtimer base code to handle more then 2 clockids
Date: Tue, 1 Feb 2011 15:10:01 +0100 (CET) [thread overview]
Message-ID: <alpine.LFD.2.00.1102011505540.31804@localhost6.localdomain6> (raw)
In-Reply-To: <1296531837-12879-2-git-send-email-john.stultz@linaro.org>
On Mon, 31 Jan 2011, John Stultz wrote:
> @@ -53,11 +53,10 @@
> /*
> * The timer bases:
> *
> - * Note: If we want to add new timer bases, we have to skip the two
> - * clock ids captured by the cpu-timers. We do this by holding empty
> - * entries rather than doing math adjustment of the clock ids.
> - * This ensures that we capture erroneous accesses to these clock ids
> - * rather than moving them into the range of valid clock id's.
> + * There are more clockids then hrtimer bases. Thus, we index
s/then/than/
> + * into the timer bases by the hrtimer_base_type enum. When trying
> + * to reach a base using a clockid, hrtimer_clockid_to_base()
> + * is used to convert from clockid to the proper hrtimer_base_type.
> */
> DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) =
> {
> @@ -77,6 +76,24 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) =
> }
> };
>
> +static int hrtimer_clock_to_base_table[MAX_CLOCKS];
> +
> +static inline int hrtimer_clockid_to_base(clockid_t clock_id)
> +{
> + int ret = hrtimer_clock_to_base_table[clock_id];
> +
> + if(ret == -1) {
> + WARN_ON(1);
> + /* We just hit an invalid clock base,
> + * but returning -1 isn't safe, so
> + * return the _REALTIME base
> + */
How can this happen ?
> + return HRTIMER_BASE_REALTIME;
> + }
> + return ret;
> +}
Thanks,
tglx
next prev parent reply other threads:[~2011-02-01 14:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-01 3:43 [PATCH 0/2] Add CLOCK_BOOTTIME functionality John Stultz
2011-02-01 3:43 ` [PATCH 1/2] hrtimers: extend hrtimer base code to handle more then 2 clockids John Stultz
2011-02-01 14:10 ` Thomas Gleixner [this message]
2011-02-01 18:37 ` John Stultz
2011-02-01 18:47 ` Thomas Gleixner
2011-02-01 3:43 ` [PATCH 2/2] hrtimers: Add CLOCK_BOOTTIME clockid, hrtimerbase and posix interface John Stultz
2011-02-01 14:16 ` Thomas Gleixner
2011-02-01 18:35 ` John Stultz
-- strict thread matches above, loose matches on Subject: below --
2010-12-16 0:40 [PATCH 0/2] [RFC] Introduce CLOCK_BOOTTIME John Stultz
2010-12-16 0:40 ` [PATCH 1/2] hrtimers: extend hrtimer base code to handle more then 2 clockids John Stultz
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=alpine.LFD.2.00.1102011505540.31804@localhost6.localdomain6 \
--to=tglx@linutronix.de \
--cc=arve@android.com \
--cc=jamie@shareable.org \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=virtuoso@slind.org \
/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
all inboxes | Powered by JetHome®