LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] x86: Add missing idle.h include to process_32.c
@ 2008-09-23 23:37 Rafael J. Wysocki
2008-09-24 7:40 ` Ingo Molnar
0 siblings, 1 reply; 13+ messages in thread
From: Rafael J. Wysocki @ 2008-09-23 23:37 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Andrew Morton, Linus Torvalds, LKML, Thomas Gleixner
Hi,
This fixes a very recent compilation breakage on 32-bit x86.
Please apply.
Thanks,
Rafael
---
From: Rafael J. Wysocki <rjw@sisk.pl>
x86: Add missing idle.h include to process_32.c
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
arch/x86/kernel/process_32.c | 1 +
1 file changed, 1 insertion(+)
Index: linux-2.6/arch/x86/kernel/process_32.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/process_32.c
+++ linux-2.6/arch/x86/kernel/process_32.c
@@ -55,6 +55,7 @@
#include <asm/tlbflush.h>
#include <asm/cpu.h>
#include <asm/kdebug.h>
+#include <asm/idle.h>
asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] x86: Add missing idle.h include to process_32.c
2008-09-23 23:37 [PATCH] x86: Add missing idle.h include to process_32.c Rafael J. Wysocki
@ 2008-09-24 7:40 ` Ingo Molnar
2008-09-24 7:42 ` [git pull] timers fixes Ingo Molnar
0 siblings, 1 reply; 13+ messages in thread
From: Ingo Molnar @ 2008-09-24 7:40 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Andrew Morton, Linus Torvalds, LKML, Thomas Gleixner
* Rafael J. Wysocki <rjw@sisk.pl> wrote:
> Hi,
>
> This fixes a very recent compilation breakage on 32-bit x86.
the fix is queued up in tip/timers/urgent - sorry about that.
Ingo
^ permalink raw reply [flat|nested] 13+ messages in thread
* [git pull] timers fixes
2008-09-24 7:40 ` Ingo Molnar
@ 2008-09-24 7:42 ` Ingo Molnar
2008-09-24 8:49 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 13+ messages in thread
From: Ingo Molnar @ 2008-09-24 7:42 UTC (permalink / raw)
To: Linus Torvalds
Cc: Andrew Morton, Linus Torvalds, LKML, Thomas Gleixner,
Rafael J. Wysocki, H. Peter Anvin
Linus,
Please pull the latest timers-fixes-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git timers-fixes-for-linus
Thanks,
Ingo
------------------>
Marc Dionne (1):
x86: prevent stale state of c1e_mask across CPU offline/online, fix
arch/x86/kernel/process_32.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 4b3cfdf..31f40b2 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -55,6 +55,7 @@
#include <asm/tlbflush.h>
#include <asm/cpu.h>
#include <asm/kdebug.h>
+#include <asm/idle.h>
asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [git pull] timers fixes
2008-09-24 7:42 ` [git pull] timers fixes Ingo Molnar
@ 2008-09-24 8:49 ` Benjamin Herrenschmidt
2008-09-24 8:51 ` Benjamin Herrenschmidt
2008-09-24 8:53 ` Ingo Molnar
0 siblings, 2 replies; 13+ messages in thread
From: Benjamin Herrenschmidt @ 2008-09-24 8:49 UTC (permalink / raw)
To: Ingo Molnar
Cc: Linus Torvalds, Andrew Morton, LKML, Thomas Gleixner,
Rafael J. Wysocki, H. Peter Anvin
On Wed, 2008-09-24 at 09:42 +0200, Ingo Molnar wrote:
> Linus,
>
> Please pull the latest timers-fixes-for-linus git tree from:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git timers-fixes-for-linus
>
> Thanks,
>
> Ingo
>
> ------------------>
> Marc Dionne (1):
> x86: prevent stale state of c1e_mask across CPU offline/online, fix
Is that all the changeset comment ? Am I the only one to find that
totally useless ? Or is that the mail doesn't contain the actual
comment, only the title followed by the patch ?
Cheers,
Ben.
>
> arch/x86/kernel/process_32.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
> index 4b3cfdf..31f40b2 100644
> --- a/arch/x86/kernel/process_32.c
> +++ b/arch/x86/kernel/process_32.c
> @@ -55,6 +55,7 @@
> #include <asm/tlbflush.h>
> #include <asm/cpu.h>
> #include <asm/kdebug.h>
> +#include <asm/idle.h>
>
> asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [git pull] timers fixes
2008-09-24 8:49 ` Benjamin Herrenschmidt
@ 2008-09-24 8:51 ` Benjamin Herrenschmidt
2008-09-24 8:55 ` Ingo Molnar
2008-09-24 8:53 ` Ingo Molnar
1 sibling, 1 reply; 13+ messages in thread
From: Benjamin Herrenschmidt @ 2008-09-24 8:51 UTC (permalink / raw)
To: Ingo Molnar
Cc: Linus Torvalds, Andrew Morton, LKML, Thomas Gleixner,
Rafael J. Wysocki, H. Peter Anvin
On Wed, 2008-09-24 at 18:49 +1000, Benjamin Herrenschmidt wrote:
> On Wed, 2008-09-24 at 09:42 +0200, Ingo Molnar wrote:
> > Linus,
> >
> > Please pull the latest timers-fixes-for-linus git tree from:
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git timers-fixes-for-linus
> >
> > Thanks,
> >
> > Ingo
> >
> > ------------------>
> > Marc Dionne (1):
> > x86: prevent stale state of c1e_mask across CPU offline/online, fix
>
> Is that all the changeset comment ? Am I the only one to find that
> totally useless ? Or is that the mail doesn't contain the actual
> comment, only the title followed by the patch ?
Allright, so in fact, it's more like the log doesn't match
the patch in the email..
Ben.
> Cheers,
> Ben.
>
> >
> > arch/x86/kernel/process_32.c | 1 +
> > 1 files changed, 1 insertions(+), 0 deletions(-)
> >
> > diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
> > index 4b3cfdf..31f40b2 100644
> > --- a/arch/x86/kernel/process_32.c
> > +++ b/arch/x86/kernel/process_32.c
> > @@ -55,6 +55,7 @@
> > #include <asm/tlbflush.h>
> > #include <asm/cpu.h>
> > #include <asm/kdebug.h>
> > +#include <asm/idle.h>
> >
> > asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [git pull] timers fixes
2008-09-24 8:49 ` Benjamin Herrenschmidt
2008-09-24 8:51 ` Benjamin Herrenschmidt
@ 2008-09-24 8:53 ` Ingo Molnar
1 sibling, 0 replies; 13+ messages in thread
From: Ingo Molnar @ 2008-09-24 8:53 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: Linus Torvalds, Andrew Morton, LKML, Thomas Gleixner,
Rafael J. Wysocki, H. Peter Anvin
* Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> On Wed, 2008-09-24 at 09:42 +0200, Ingo Molnar wrote:
> > Linus,
> >
> > Please pull the latest timers-fixes-for-linus git tree from:
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git timers-fixes-for-linus
> >
> > Thanks,
> >
> > Ingo
> >
> > ------------------>
> > Marc Dionne (1):
> > x86: prevent stale state of c1e_mask across CPU offline/online, fix
>
> Is that all the changeset comment ? Am I the only one to find that
> totally useless ? Or is that the mail doesn't contain the actual
> comment, only the title followed by the patch ?
yeah. The build error is something like:
arch/x86/kernel/process_32.c:78: warning: data definition has no type or storage class
arch/x86/kernel/process_32.c:78: warning: type defaults to 'int' in declaration of 'c1e_remove_cpu'
arch/x86/kernel/process_32.c:78: warning: parameter names (without types) in function declaration
Ingo
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [git pull] timers fixes
2008-09-24 8:51 ` Benjamin Herrenschmidt
@ 2008-09-24 8:55 ` Ingo Molnar
0 siblings, 0 replies; 13+ messages in thread
From: Ingo Molnar @ 2008-09-24 8:55 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: Linus Torvalds, Andrew Morton, LKML, Thomas Gleixner,
Rafael J. Wysocki, H. Peter Anvin
* Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> On Wed, 2008-09-24 at 18:49 +1000, Benjamin Herrenschmidt wrote:
> > On Wed, 2008-09-24 at 09:42 +0200, Ingo Molnar wrote:
> > > Linus,
> > >
> > > Please pull the latest timers-fixes-for-linus git tree from:
> > >
> > > git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git timers-fixes-for-linus
> > >
> > > Thanks,
> > >
> > > Ingo
> > >
> > > ------------------>
> > > Marc Dionne (1):
> > > x86: prevent stale state of c1e_mask across CPU offline/online, fix
> >
> > Is that all the changeset comment ? Am I the only one to find that
> > totally useless ? Or is that the mail doesn't contain the actual
> > comment, only the title followed by the patch ?
>
> Allright, so in fact, it's more like the log doesn't match
> the patch in the email..
only because i already picked up a different submission at that time,
and posted in this thread.
i picked up this one from lkml:
Subject: [PATCH] Fix build error introduced by commit 4faac97d44ac27bdbb010a9c3597401a8f89341f
see the full commit log below, it has all the details.
Ingo
------------>
>From 1eda81495a49a4ee91d8863b0a441a624375efea Mon Sep 17 00:00:00 2001
From: Marc Dionne <marc.c.dionne@gmail.com>
Date: Tue, 23 Sep 2008 22:40:02 -0400
Subject: [PATCH] x86: prevent stale state of c1e_mask across CPU offline/online, fix
Fix build error introduced by commit 4faac97d44ac27 ("x86: prevent stale
state of c1e_mask across CPU offline/online").
process_32.c needs to include idle.h to get the prototype for
c1e_remove_cpu()
Signed-off-by: Marc Dionne <marc.c.dionne@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86/kernel/process_32.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 4b3cfdf..31f40b2 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -55,6 +55,7 @@
#include <asm/tlbflush.h>
#include <asm/cpu.h>
#include <asm/kdebug.h>
+#include <asm/idle.h>
asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
^ permalink raw reply [flat|nested] 13+ messages in thread
* [GIT PULL] timers fixes
@ 2021-07-15 10:42 Frederic Weisbecker
0 siblings, 0 replies; 13+ messages in thread
From: Frederic Weisbecker @ 2021-07-15 10:42 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar
Cc: LKML, Frederic Weisbecker, Peter Zijlstra,
Nicolas Saenz Julienne, Anna-Maria Behnsen
Thomas, Ingo,
Please pull the timers/urgent branch that can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git
timers/urgent
HEAD: aebacb7f6ca1926918734faae14d1f0b6fae5cb7
Thanks,
Frederic
---
Frederic Weisbecker (1):
posix-cpu-timers: Fix rearm racing against process tick
Nicolas Saenz Julienne (1):
timers: Fix get_next_timer_interrupt() with no timers pending
kernel/time/posix-cpu-timers.c | 10 +++++-----
kernel/time/timer.c | 8 +++++---
2 files changed, 10 insertions(+), 8 deletions(-)
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [GIT PULL] timers fixes
2020-01-18 18:47 Ingo Molnar
@ 2020-01-18 21:05 ` pr-tracker-bot
0 siblings, 0 replies; 13+ messages in thread
From: pr-tracker-bot @ 2020-01-18 21:05 UTC (permalink / raw)
To: Ingo Molnar
Cc: Linus Torvalds, linux-kernel, Thomas Gleixner, Peter Zijlstra,
Andrew Morton
The pull request you sent on Sat, 18 Jan 2020 19:47:46 +0100:
> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-urgent-for-linus
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/7ff15cd0458c288afa954de843bb1903c723e5b3
Thank you!
--
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker
^ permalink raw reply [flat|nested] 13+ messages in thread
* [GIT PULL] timers fixes
@ 2020-01-18 18:47 Ingo Molnar
2020-01-18 21:05 ` pr-tracker-bot
0 siblings, 1 reply; 13+ messages in thread
From: Ingo Molnar @ 2020-01-18 18:47 UTC (permalink / raw)
To: Linus Torvalds
Cc: linux-kernel, Thomas Gleixner, Peter Zijlstra, Andrew Morton
Linus,
Please pull the latest timers-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-urgent-for-linus
# HEAD: de95a991bb72e009f47e0c4bbc90fc5f594588d5 tick/sched: Annotate lockless access to last_jiffies_update
Three fixes: fix link failure on Alpha, fix a Sparse warning and
annotate/robustify a lockless access in the NOHZ code.
Thanks,
Ingo
------------------>
Arnd Bergmann (1):
time/posix-stubs: Provide compat itimer supoprt for alpha
Eric Dumazet (1):
tick/sched: Annotate lockless access to last_jiffies_update
Vincenzo Frascino (1):
lib/vdso: Make __cvdso_clock_getres() static
kernel/time/posix-stubs.c | 3 +++
kernel/time/tick-sched.c | 14 +++++++++-----
lib/vdso/gettimeofday.c | 1 +
3 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/kernel/time/posix-stubs.c b/kernel/time/posix-stubs.c
index 67df65f887ac..20c65a7d4e3a 100644
--- a/kernel/time/posix-stubs.c
+++ b/kernel/time/posix-stubs.c
@@ -151,6 +151,9 @@ SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags,
#ifdef CONFIG_COMPAT
COMPAT_SYS_NI(timer_create);
+#endif
+
+#if defined(CONFIG_COMPAT) || defined(CONFIG_ALPHA)
COMPAT_SYS_NI(getitimer);
COMPAT_SYS_NI(setitimer);
#endif
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 8b192e67aabc..a792d21cac64 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -58,8 +58,9 @@ static void tick_do_update_jiffies64(ktime_t now)
/*
* Do a quick check without holding jiffies_lock:
+ * The READ_ONCE() pairs with two updates done later in this function.
*/
- delta = ktime_sub(now, last_jiffies_update);
+ delta = ktime_sub(now, READ_ONCE(last_jiffies_update));
if (delta < tick_period)
return;
@@ -70,8 +71,9 @@ static void tick_do_update_jiffies64(ktime_t now)
if (delta >= tick_period) {
delta = ktime_sub(delta, tick_period);
- last_jiffies_update = ktime_add(last_jiffies_update,
- tick_period);
+ /* Pairs with the lockless read in this function. */
+ WRITE_ONCE(last_jiffies_update,
+ ktime_add(last_jiffies_update, tick_period));
/* Slow path for long timeouts */
if (unlikely(delta >= tick_period)) {
@@ -79,8 +81,10 @@ static void tick_do_update_jiffies64(ktime_t now)
ticks = ktime_divns(delta, incr);
- last_jiffies_update = ktime_add_ns(last_jiffies_update,
- incr * ticks);
+ /* Pairs with the lockless read in this function. */
+ WRITE_ONCE(last_jiffies_update,
+ ktime_add_ns(last_jiffies_update,
+ incr * ticks));
}
do_timer(++ticks);
diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c
index 9ecfd3b547ba..42bd8ab955fa 100644
--- a/lib/vdso/gettimeofday.c
+++ b/lib/vdso/gettimeofday.c
@@ -221,6 +221,7 @@ int __cvdso_clock_getres_common(clockid_t clock, struct __kernel_timespec *res)
return 0;
}
+static __maybe_unused
int __cvdso_clock_getres(clockid_t clock, struct __kernel_timespec *res)
{
int ret = __cvdso_clock_getres_common(clock, res);
^ permalink raw reply [flat|nested] 13+ messages in thread
* [GIT PULL] timers fixes
@ 2011-01-15 15:21 Ingo Molnar
0 siblings, 0 replies; 13+ messages in thread
From: Ingo Molnar @ 2011-01-15 15:21 UTC (permalink / raw)
To: Linus Torvalds
Cc: linux-kernel, Thomas Gleixner, Peter Zijlstra, Andrew Morton
Linus,
Please pull the latest timers-fixes-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git timers-fixes-for-linus
Thanks,
Ingo
------------------>
H Hartley Sweeten (1):
timekeeping: Make local variables static
Nicolas Pitre (1):
time: Rename misnamed minsec argument of clocks_calc_mult_shift()
kernel/time/clocksource.c | 8 ++++----
kernel/time/timekeeping.c | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index c18d7ef..8588abc 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -113,7 +113,7 @@ EXPORT_SYMBOL_GPL(timecounter_cyc2time);
* @shift: pointer to shift variable
* @from: frequency to convert from
* @to: frequency to convert to
- * @minsec: guaranteed runtime conversion range in seconds
+ * @maxsec: guaranteed runtime conversion range in seconds
*
* The function evaluates the shift/mult pair for the scaled math
* operations of clocksources and clockevents.
@@ -122,7 +122,7 @@ EXPORT_SYMBOL_GPL(timecounter_cyc2time);
* NSEC_PER_SEC == 1GHz and @from is the counter frequency. For clock
* event @to is the counter frequency and @from is NSEC_PER_SEC.
*
- * The @minsec conversion range argument controls the time frame in
+ * The @maxsec conversion range argument controls the time frame in
* seconds which must be covered by the runtime conversion with the
* calculated mult and shift factors. This guarantees that no 64bit
* overflow happens when the input value of the conversion is
@@ -131,7 +131,7 @@ EXPORT_SYMBOL_GPL(timecounter_cyc2time);
* factors.
*/
void
-clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec)
+clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 maxsec)
{
u64 tmp;
u32 sft, sftacc= 32;
@@ -140,7 +140,7 @@ clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec)
* Calculate the shift factor which is limiting the conversion
* range:
*/
- tmp = ((u64)minsec * from) >> 32;
+ tmp = ((u64)maxsec * from) >> 32;
while (tmp) {
tmp >>=1;
sftacc--;
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 5bb86da..eef7452 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -49,7 +49,7 @@ struct timekeeper {
u32 mult;
};
-struct timekeeper timekeeper;
+static struct timekeeper timekeeper;
/**
* timekeeper_setup_internals - Set up internals to use clocksource clock.
@@ -164,7 +164,7 @@ static struct timespec total_sleep_time;
/*
* The raw monotonic time for the CLOCK_MONOTONIC_RAW posix clock.
*/
-struct timespec raw_time;
+static struct timespec raw_time;
/* flag for if timekeeping is suspended */
int __read_mostly timekeeping_suspended;
^ permalink raw reply [flat|nested] 13+ messages in thread
* [GIT PULL] timers fixes
@ 2009-12-10 19:47 Ingo Molnar
0 siblings, 0 replies; 13+ messages in thread
From: Ingo Molnar @ 2009-12-10 19:47 UTC (permalink / raw)
To: Linus Torvalds
Cc: linux-kernel, Thomas Gleixner, Peter Zijlstra, Andrew Morton
Linus,
Please pull the latest timers-fixes-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git timers-fixes-for-linus
Thanks,
Ingo
------------------>
Heiko Carstens (1):
hrtimer: move timer stats helper functions to hrtimer.c
Thomas Gleixner (2):
hrtimer: Tune hrtimer_interrupt hang logic
itimer: Fix the itimer trace print format
include/linux/hrtimer.h | 56 +++----------------
include/trace/events/timer.h | 8 ++--
kernel/hrtimer.c | 121 ++++++++++++++++++++++++++---------------
kernel/time/timer_list.c | 5 ++-
4 files changed, 94 insertions(+), 96 deletions(-)
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 9bace4b..af634e9 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -162,10 +162,11 @@ struct hrtimer_clock_base {
* @expires_next: absolute time of the next event which was scheduled
* via clock_set_next_event()
* @hres_active: State of high resolution mode
- * @check_clocks: Indictator, when set evaluate time source and clock
- * event devices whether high resolution mode can be
- * activated.
- * @nr_events: Total number of timer interrupt events
+ * @hang_detected: The last hrtimer interrupt detected a hang
+ * @nr_events: Total number of hrtimer interrupt events
+ * @nr_retries: Total number of hrtimer interrupt retries
+ * @nr_hangs: Total number of hrtimer interrupt hangs
+ * @max_hang_time: Maximum time spent in hrtimer_interrupt
*/
struct hrtimer_cpu_base {
spinlock_t lock;
@@ -173,7 +174,11 @@ struct hrtimer_cpu_base {
#ifdef CONFIG_HIGH_RES_TIMERS
ktime_t expires_next;
int hres_active;
+ int hang_detected;
unsigned long nr_events;
+ unsigned long nr_retries;
+ unsigned long nr_hangs;
+ ktime_t max_hang_time;
#endif
};
@@ -435,47 +440,4 @@ extern u64 ktime_divns(const ktime_t kt, s64 div);
/* Show pending timers: */
extern void sysrq_timer_list_show(void);
-/*
- * Timer-statistics info:
- */
-#ifdef CONFIG_TIMER_STATS
-
-extern void timer_stats_update_stats(void *timer, pid_t pid, void *startf,
- void *timerf, char *comm,
- unsigned int timer_flag);
-
-static inline void timer_stats_account_hrtimer(struct hrtimer *timer)
-{
- if (likely(!timer_stats_active))
- return;
- timer_stats_update_stats(timer, timer->start_pid, timer->start_site,
- timer->function, timer->start_comm, 0);
-}
-
-extern void __timer_stats_hrtimer_set_start_info(struct hrtimer *timer,
- void *addr);
-
-static inline void timer_stats_hrtimer_set_start_info(struct hrtimer *timer)
-{
- __timer_stats_hrtimer_set_start_info(timer, __builtin_return_address(0));
-}
-
-static inline void timer_stats_hrtimer_clear_start_info(struct hrtimer *timer)
-{
- timer->start_site = NULL;
-}
-#else
-static inline void timer_stats_account_hrtimer(struct hrtimer *timer)
-{
-}
-
-static inline void timer_stats_hrtimer_set_start_info(struct hrtimer *timer)
-{
-}
-
-static inline void timer_stats_hrtimer_clear_start_info(struct hrtimer *timer)
-{
-}
-#endif
-
#endif
diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h
index e5ce87a..9496b96 100644
--- a/include/trace/events/timer.h
+++ b/include/trace/events/timer.h
@@ -301,8 +301,8 @@ TRACE_EVENT(itimer_state,
__entry->interval_usec = value->it_interval.tv_usec;
),
- TP_printk("which=%d expires=%lu it_value=%lu.%lu it_interval=%lu.%lu",
- __entry->which, __entry->expires,
+ TP_printk("which=%d expires=%llu it_value=%ld.%ld it_interval=%ld.%ld",
+ __entry->which, (unsigned long long)__entry->expires,
__entry->value_sec, __entry->value_usec,
__entry->interval_sec, __entry->interval_usec)
);
@@ -331,8 +331,8 @@ TRACE_EVENT(itimer_expire,
__entry->pid = pid_nr(pid);
),
- TP_printk("which=%d pid=%d now=%lu", __entry->which,
- (int) __entry->pid, __entry->now)
+ TP_printk("which=%d pid=%d now=%llu", __entry->which,
+ (int) __entry->pid, (unsigned long long)__entry->now)
);
#endif /* _TRACE_TIMER_H */
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index ede5277..d2f9239 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -557,7 +557,7 @@ hrtimer_force_reprogram(struct hrtimer_cpu_base *cpu_base, int skip_equal)
static int hrtimer_reprogram(struct hrtimer *timer,
struct hrtimer_clock_base *base)
{
- ktime_t *expires_next = &__get_cpu_var(hrtimer_bases).expires_next;
+ struct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases);
ktime_t expires = ktime_sub(hrtimer_get_expires(timer), base->offset);
int res;
@@ -582,7 +582,16 @@ static int hrtimer_reprogram(struct hrtimer *timer,
if (expires.tv64 < 0)
return -ETIME;
- if (expires.tv64 >= expires_next->tv64)
+ if (expires.tv64 >= cpu_base->expires_next.tv64)
+ return 0;
+
+ /*
+ * If a hang was detected in the last timer interrupt then we
+ * do not schedule a timer which is earlier than the expiry
+ * which we enforced in the hang detection. We want the system
+ * to make progress.
+ */
+ if (cpu_base->hang_detected)
return 0;
/*
@@ -590,7 +599,7 @@ static int hrtimer_reprogram(struct hrtimer *timer,
*/
res = tick_program_event(expires, 0);
if (!IS_ERR_VALUE(res))
- *expires_next = expires;
+ cpu_base->expires_next = expires;
return res;
}
@@ -747,17 +756,33 @@ static inline void hrtimer_init_timer_hres(struct hrtimer *timer) { }
#endif /* CONFIG_HIGH_RES_TIMERS */
-#ifdef CONFIG_TIMER_STATS
-void __timer_stats_hrtimer_set_start_info(struct hrtimer *timer, void *addr)
+static inline void timer_stats_hrtimer_set_start_info(struct hrtimer *timer)
{
+#ifdef CONFIG_TIMER_STATS
if (timer->start_site)
return;
-
- timer->start_site = addr;
+ timer->start_site = __builtin_return_address(0);
memcpy(timer->start_comm, current->comm, TASK_COMM_LEN);
timer->start_pid = current->pid;
+#endif
}
+
+static inline void timer_stats_hrtimer_clear_start_info(struct hrtimer *timer)
+{
+#ifdef CONFIG_TIMER_STATS
+ timer->start_site = NULL;
+#endif
+}
+
+static inline void timer_stats_account_hrtimer(struct hrtimer *timer)
+{
+#ifdef CONFIG_TIMER_STATS
+ if (likely(!timer_stats_active))
+ return;
+ timer_stats_update_stats(timer, timer->start_pid, timer->start_site,
+ timer->function, timer->start_comm, 0);
#endif
+}
/*
* Counterpart to lock_hrtimer_base above:
@@ -1217,30 +1242,6 @@ static void __run_hrtimer(struct hrtimer *timer, ktime_t *now)
#ifdef CONFIG_HIGH_RES_TIMERS
-static int force_clock_reprogram;
-
-/*
- * After 5 iteration's attempts, we consider that hrtimer_interrupt()
- * is hanging, which could happen with something that slows the interrupt
- * such as the tracing. Then we force the clock reprogramming for each future
- * hrtimer interrupts to avoid infinite loops and use the min_delta_ns
- * threshold that we will overwrite.
- * The next tick event will be scheduled to 3 times we currently spend on
- * hrtimer_interrupt(). This gives a good compromise, the cpus will spend
- * 1/4 of their time to process the hrtimer interrupts. This is enough to
- * let it running without serious starvation.
- */
-
-static inline void
-hrtimer_interrupt_hanging(struct clock_event_device *dev,
- ktime_t try_time)
-{
- force_clock_reprogram = 1;
- dev->min_delta_ns = (unsigned long)try_time.tv64 * 3;
- printk(KERN_WARNING "hrtimer: interrupt too slow, "
- "forcing clock min delta to %llu ns\n",
- (unsigned long long) dev->min_delta_ns);
-}
/*
* High resolution timer interrupt
* Called with interrupts disabled
@@ -1249,21 +1250,15 @@ void hrtimer_interrupt(struct clock_event_device *dev)
{
struct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases);
struct hrtimer_clock_base *base;
- ktime_t expires_next, now;
- int nr_retries = 0;
- int i;
+ ktime_t expires_next, now, entry_time, delta;
+ int i, retries = 0;
BUG_ON(!cpu_base->hres_active);
cpu_base->nr_events++;
dev->next_event.tv64 = KTIME_MAX;
- retry:
- /* 5 retries is enough to notice a hang */
- if (!(++nr_retries % 5))
- hrtimer_interrupt_hanging(dev, ktime_sub(ktime_get(), now));
-
- now = ktime_get();
-
+ entry_time = now = ktime_get();
+retry:
expires_next.tv64 = KTIME_MAX;
spin_lock(&cpu_base->lock);
@@ -1325,10 +1320,48 @@ void hrtimer_interrupt(struct clock_event_device *dev)
spin_unlock(&cpu_base->lock);
/* Reprogramming necessary ? */
- if (expires_next.tv64 != KTIME_MAX) {
- if (tick_program_event(expires_next, force_clock_reprogram))
- goto retry;
+ if (expires_next.tv64 == KTIME_MAX ||
+ !tick_program_event(expires_next, 0)) {
+ cpu_base->hang_detected = 0;
+ return;
}
+
+ /*
+ * The next timer was already expired due to:
+ * - tracing
+ * - long lasting callbacks
+ * - being scheduled away when running in a VM
+ *
+ * We need to prevent that we loop forever in the hrtimer
+ * interrupt routine. We give it 3 attempts to avoid
+ * overreacting on some spurious event.
+ */
+ now = ktime_get();
+ cpu_base->nr_retries++;
+ if (++retries < 3)
+ goto retry;
+ /*
+ * Give the system a chance to do something else than looping
+ * here. We stored the entry time, so we know exactly how long
+ * we spent here. We schedule the next event this amount of
+ * time away.
+ */
+ cpu_base->nr_hangs++;
+ cpu_base->hang_detected = 1;
+ delta = ktime_sub(now, entry_time);
+ if (delta.tv64 > cpu_base->max_hang_time.tv64)
+ cpu_base->max_hang_time = delta;
+ /*
+ * Limit it to a sensible value as we enforce a longer
+ * delay. Give the CPU at least 100ms to catch up.
+ */
+ if (delta.tv64 > 100 * NSEC_PER_MSEC)
+ expires_next = ktime_add_ns(now, 100 * NSEC_PER_MSEC);
+ else
+ expires_next = ktime_add(now, delta);
+ tick_program_event(expires_next, 1);
+ printk_once(KERN_WARNING "hrtimer: interrupt took %llu ns\n",
+ ktime_to_ns(delta));
}
/*
diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c
index 665c76e..9d80db4 100644
--- a/kernel/time/timer_list.c
+++ b/kernel/time/timer_list.c
@@ -150,6 +150,9 @@ static void print_cpu(struct seq_file *m, int cpu, u64 now)
P_ns(expires_next);
P(hres_active);
P(nr_events);
+ P(nr_retries);
+ P(nr_hangs);
+ P_ns(max_hang_time);
#endif
#undef P
#undef P_ns
@@ -254,7 +257,7 @@ static int timer_list_show(struct seq_file *m, void *v)
u64 now = ktime_to_ns(ktime_get());
int cpu;
- SEQ_printf(m, "Timer List Version: v0.4\n");
+ SEQ_printf(m, "Timer List Version: v0.5\n");
SEQ_printf(m, "HRTIMER_MAX_CLOCK_BASES: %d\n", HRTIMER_MAX_CLOCK_BASES);
SEQ_printf(m, "now at %Ld nsecs\n", (unsigned long long)now);
^ permalink raw reply [flat|nested] 13+ messages in thread
* [git pull] timers fixes
@ 2008-10-04 14:56 Ingo Molnar
0 siblings, 0 replies; 13+ messages in thread
From: Ingo Molnar @ 2008-10-04 14:56 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, Andrew Morton, Thomas Gleixner
Linus,
Please pull the latest timers-fixes-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git timers-fixes-for-linus
Thanks,
Ingo
------------------>
Thomas Gleixner (1):
clockevents: check broadcast tick device not the clock events device
kernel/time/tick-broadcast.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index bd70345..cb01cd8 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -235,7 +235,8 @@ static void tick_do_broadcast_on_off(void *why)
case CLOCK_EVT_NOTIFY_BROADCAST_FORCE:
if (!cpu_isset(cpu, tick_broadcast_mask)) {
cpu_set(cpu, tick_broadcast_mask);
- if (bc->mode == TICKDEV_MODE_PERIODIC)
+ if (tick_broadcast_device.mode ==
+ TICKDEV_MODE_PERIODIC)
clockevents_shutdown(dev);
}
if (*reason == CLOCK_EVT_NOTIFY_BROADCAST_FORCE)
@@ -245,7 +246,8 @@ static void tick_do_broadcast_on_off(void *why)
if (!tick_broadcast_force &&
cpu_isset(cpu, tick_broadcast_mask)) {
cpu_clear(cpu, tick_broadcast_mask);
- if (bc->mode == TICKDEV_MODE_PERIODIC)
+ if (tick_broadcast_device.mode ==
+ TICKDEV_MODE_PERIODIC)
tick_setup_periodic(dev, 0);
}
break;
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2021-07-15 10:42 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-23 23:37 [PATCH] x86: Add missing idle.h include to process_32.c Rafael J. Wysocki
2008-09-24 7:40 ` Ingo Molnar
2008-09-24 7:42 ` [git pull] timers fixes Ingo Molnar
2008-09-24 8:49 ` Benjamin Herrenschmidt
2008-09-24 8:51 ` Benjamin Herrenschmidt
2008-09-24 8:55 ` Ingo Molnar
2008-09-24 8:53 ` Ingo Molnar
2008-10-04 14:56 Ingo Molnar
2009-12-10 19:47 [GIT PULL] " Ingo Molnar
2011-01-15 15:21 Ingo Molnar
2020-01-18 18:47 Ingo Molnar
2020-01-18 21:05 ` pr-tracker-bot
2021-07-15 10:42 Frederic Weisbecker
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).