* [PATCH 1/2] watchdog: Use local_clock for get_timestamp()
@ 2012-12-27 2:49 Namhyung Kim
2012-12-27 2:49 ` [PATCH 2/2] tracing: Use sched_clock_cpu for trace_clock_global Namhyung Kim
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Namhyung Kim @ 2012-12-27 2:49 UTC (permalink / raw)
To: LKML; +Cc: Namhyung Kim, Don Zickus, Ingo Molnar, Thomas Gleixner
From: Namhyung Kim <namhyung.kim@lge.com>
The get_timestamp() function is always called with current cpu, thus
using local_clock() would be more appropriate and it makes the code
shorter and cleaner IMHO.
Cc: Don Zickus <dzickus@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
kernel/watchdog.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 75a2ab3d0b02..082ca6878a3f 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -112,9 +112,9 @@ static int get_softlockup_thresh(void)
* resolution, and we don't need to waste time with a big divide when
* 2^30ns == 1.074s.
*/
-static unsigned long get_timestamp(int this_cpu)
+static unsigned long get_timestamp(void)
{
- return cpu_clock(this_cpu) >> 30LL; /* 2^30 ~= 10^9 */
+ return local_clock() >> 30LL; /* 2^30 ~= 10^9 */
}
static void set_sample_period(void)
@@ -132,9 +132,7 @@ static void set_sample_period(void)
/* Commands for resetting the watchdog */
static void __touch_watchdog(void)
{
- int this_cpu = smp_processor_id();
-
- __this_cpu_write(watchdog_touch_ts, get_timestamp(this_cpu));
+ __this_cpu_write(watchdog_touch_ts, get_timestamp());
}
void touch_softlockup_watchdog(void)
@@ -195,7 +193,7 @@ static int is_hardlockup(void)
static int is_softlockup(unsigned long touch_ts)
{
- unsigned long now = get_timestamp(smp_processor_id());
+ unsigned long now = get_timestamp();
/* Warn about unreasonable delays: */
if (time_after(now, touch_ts + get_softlockup_thresh()))
--
1.7.11.7
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] tracing: Use sched_clock_cpu for trace_clock_global
2012-12-27 2:49 [PATCH 1/2] watchdog: Use local_clock for get_timestamp() Namhyung Kim
@ 2012-12-27 2:49 ` Namhyung Kim
2012-12-27 9:52 ` Namhyung Kim
2013-02-03 19:22 ` [tip:perf/core] " tip-bot for Namhyung Kim
2013-01-02 20:09 ` [PATCH 1/2] watchdog: Use local_clock for get_timestamp() Don Zickus
` (2 subsequent siblings)
3 siblings, 2 replies; 8+ messages in thread
From: Namhyung Kim @ 2012-12-27 2:49 UTC (permalink / raw)
To: LKML; +Cc: Namhyung Kim, Steven Rostedt, Fredereic Weisbecker, Ingo Molnar
From: Namhyung Kim <namhyung.kim@lge.com>
For systems have unstable sched_clock, all cpu_clock() does is enable/
disable local irq during call to sched_clock(). And for stable systems
they are same.
As in trace_clock_global(), we already does it for local irq, calling
sched_clock_cpu() directly would be appropriate.
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Fredereic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
kernel/trace/trace_clock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/trace_clock.c b/kernel/trace/trace_clock.c
index 394783531cbb..795f077978a8 100644
--- a/kernel/trace/trace_clock.c
+++ b/kernel/trace/trace_clock.c
@@ -86,7 +86,7 @@ u64 notrace trace_clock_global(void)
local_irq_save(flags);
this_cpu = raw_smp_processor_id();
- now = cpu_clock(this_cpu);
+ now = sched_clock_cpu(this_cpu);
/*
* If in an NMI context then dont risk lockups and return the
* cpu_clock() time:
--
1.7.11.7
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] tracing: Use sched_clock_cpu for trace_clock_global
2012-12-27 2:49 ` [PATCH 2/2] tracing: Use sched_clock_cpu for trace_clock_global Namhyung Kim
@ 2012-12-27 9:52 ` Namhyung Kim
2013-01-07 13:54 ` Steven Rostedt
2013-02-03 19:22 ` [tip:perf/core] " tip-bot for Namhyung Kim
1 sibling, 1 reply; 8+ messages in thread
From: Namhyung Kim @ 2012-12-27 9:52 UTC (permalink / raw)
To: LKML; +Cc: Namhyung Kim, Steven Rostedt, Fredereic Weisbecker, Ingo Molnar
On Thu, 27 Dec 2012 11:49:45 +0900, Namhyung Kim wrote:
> From: Namhyung Kim <namhyung.kim@lge.com>
>
> For systems have unstable sched_clock, all cpu_clock() does is enable/
> disable local irq during call to sched_clock(). And for stable systems
Oops, I meant s/sched_clock/scheck_clock_cpu/.
Thanks,
Namhyung
> they are same.
>
> As in trace_clock_global(), we already does it for local irq, calling
> sched_clock_cpu() directly would be appropriate.
>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Fredereic Weisbecker <fweisbec@gmail.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> kernel/trace/trace_clock.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/trace/trace_clock.c b/kernel/trace/trace_clock.c
> index 394783531cbb..795f077978a8 100644
> --- a/kernel/trace/trace_clock.c
> +++ b/kernel/trace/trace_clock.c
> @@ -86,7 +86,7 @@ u64 notrace trace_clock_global(void)
> local_irq_save(flags);
>
> this_cpu = raw_smp_processor_id();
> - now = cpu_clock(this_cpu);
> + now = sched_clock_cpu(this_cpu);
> /*
> * If in an NMI context then dont risk lockups and return the
> * cpu_clock() time:
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] watchdog: Use local_clock for get_timestamp()
2012-12-27 2:49 [PATCH 1/2] watchdog: Use local_clock for get_timestamp() Namhyung Kim
2012-12-27 2:49 ` [PATCH 2/2] tracing: Use sched_clock_cpu for trace_clock_global Namhyung Kim
@ 2013-01-02 20:09 ` Don Zickus
2013-01-24 20:20 ` [tip:core/locking] " tip-bot for Namhyung Kim
2013-02-22 12:23 ` tip-bot for Namhyung Kim
3 siblings, 0 replies; 8+ messages in thread
From: Don Zickus @ 2013-01-02 20:09 UTC (permalink / raw)
To: Namhyung Kim; +Cc: LKML, Namhyung Kim, Ingo Molnar, Thomas Gleixner
On Thu, Dec 27, 2012 at 11:49:44AM +0900, Namhyung Kim wrote:
> From: Namhyung Kim <namhyung.kim@lge.com>
>
> The get_timestamp() function is always called with current cpu, thus
> using local_clock() would be more appropriate and it makes the code
> shorter and cleaner IMHO.
Seems reasonable. Can't think of why it wasn't implemented this way to
begin with.
Acked-by: Don Zickus <dzickus@redhat.com>
>
> Cc: Don Zickus <dzickus@redhat.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> kernel/watchdog.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/kernel/watchdog.c b/kernel/watchdog.c
> index 75a2ab3d0b02..082ca6878a3f 100644
> --- a/kernel/watchdog.c
> +++ b/kernel/watchdog.c
> @@ -112,9 +112,9 @@ static int get_softlockup_thresh(void)
> * resolution, and we don't need to waste time with a big divide when
> * 2^30ns == 1.074s.
> */
> -static unsigned long get_timestamp(int this_cpu)
> +static unsigned long get_timestamp(void)
> {
> - return cpu_clock(this_cpu) >> 30LL; /* 2^30 ~= 10^9 */
> + return local_clock() >> 30LL; /* 2^30 ~= 10^9 */
> }
>
> static void set_sample_period(void)
> @@ -132,9 +132,7 @@ static void set_sample_period(void)
> /* Commands for resetting the watchdog */
> static void __touch_watchdog(void)
> {
> - int this_cpu = smp_processor_id();
> -
> - __this_cpu_write(watchdog_touch_ts, get_timestamp(this_cpu));
> + __this_cpu_write(watchdog_touch_ts, get_timestamp());
> }
>
> void touch_softlockup_watchdog(void)
> @@ -195,7 +193,7 @@ static int is_hardlockup(void)
>
> static int is_softlockup(unsigned long touch_ts)
> {
> - unsigned long now = get_timestamp(smp_processor_id());
> + unsigned long now = get_timestamp();
>
> /* Warn about unreasonable delays: */
> if (time_after(now, touch_ts + get_softlockup_thresh()))
> --
> 1.7.11.7
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] tracing: Use sched_clock_cpu for trace_clock_global
2012-12-27 9:52 ` Namhyung Kim
@ 2013-01-07 13:54 ` Steven Rostedt
0 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2013-01-07 13:54 UTC (permalink / raw)
To: Namhyung Kim; +Cc: LKML, Namhyung Kim, Fredereic Weisbecker, Ingo Molnar
On Thu, 2012-12-27 at 18:52 +0900, Namhyung Kim wrote:
> On Thu, 27 Dec 2012 11:49:45 +0900, Namhyung Kim wrote:
> > From: Namhyung Kim <namhyung.kim@lge.com>
> >
> > For systems have unstable sched_clock, all cpu_clock() does is enable/
> > disable local irq during call to sched_clock(). And for stable systems
>
> Oops, I meant s/sched_clock/scheck_clock_cpu/.
>
I'll queue this up for 3.9.
Thanks,
-- Steve
^ permalink raw reply [flat|nested] 8+ messages in thread
* [tip:core/locking] watchdog: Use local_clock for get_timestamp()
2012-12-27 2:49 [PATCH 1/2] watchdog: Use local_clock for get_timestamp() Namhyung Kim
2012-12-27 2:49 ` [PATCH 2/2] tracing: Use sched_clock_cpu for trace_clock_global Namhyung Kim
2013-01-02 20:09 ` [PATCH 1/2] watchdog: Use local_clock for get_timestamp() Don Zickus
@ 2013-01-24 20:20 ` tip-bot for Namhyung Kim
2013-02-22 12:23 ` tip-bot for Namhyung Kim
3 siblings, 0 replies; 8+ messages in thread
From: tip-bot for Namhyung Kim @ 2013-01-24 20:20 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, namhyung.kim, namhyung, rostedt, tglx, dzickus
Commit-ID: 03d8c5dc53d2e883bd3badb6436a33fc64e2f638
Gitweb: http://git.kernel.org/tip/03d8c5dc53d2e883bd3badb6436a33fc64e2f638
Author: Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Thu, 27 Dec 2012 11:49:44 +0900
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 24 Jan 2013 15:13:36 +0100
watchdog: Use local_clock for get_timestamp()
The get_timestamp() function is always called with current cpu,
thus using local_clock() would be more appropriate and it makes
the code shorter and cleaner IMHO.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Don Zickus <dzickus@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1356576585-28782-1-git-send-email-namhyung@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/watchdog.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 75a2ab3..082ca68 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -112,9 +112,9 @@ static int get_softlockup_thresh(void)
* resolution, and we don't need to waste time with a big divide when
* 2^30ns == 1.074s.
*/
-static unsigned long get_timestamp(int this_cpu)
+static unsigned long get_timestamp(void)
{
- return cpu_clock(this_cpu) >> 30LL; /* 2^30 ~= 10^9 */
+ return local_clock() >> 30LL; /* 2^30 ~= 10^9 */
}
static void set_sample_period(void)
@@ -132,9 +132,7 @@ static void set_sample_period(void)
/* Commands for resetting the watchdog */
static void __touch_watchdog(void)
{
- int this_cpu = smp_processor_id();
-
- __this_cpu_write(watchdog_touch_ts, get_timestamp(this_cpu));
+ __this_cpu_write(watchdog_touch_ts, get_timestamp());
}
void touch_softlockup_watchdog(void)
@@ -195,7 +193,7 @@ static int is_hardlockup(void)
static int is_softlockup(unsigned long touch_ts)
{
- unsigned long now = get_timestamp(smp_processor_id());
+ unsigned long now = get_timestamp();
/* Warn about unreasonable delays: */
if (time_after(now, touch_ts + get_softlockup_thresh()))
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [tip:perf/core] tracing: Use sched_clock_cpu for trace_clock_global
2012-12-27 2:49 ` [PATCH 2/2] tracing: Use sched_clock_cpu for trace_clock_global Namhyung Kim
2012-12-27 9:52 ` Namhyung Kim
@ 2013-02-03 19:22 ` tip-bot for Namhyung Kim
1 sibling, 0 replies; 8+ messages in thread
From: tip-bot for Namhyung Kim @ 2013-02-03 19:22 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, rostedt, namhyung.kim, tglx, namhyung
Commit-ID: 5e67b51e3fb22ad43faf9589e9019ad9c6a00413
Gitweb: http://git.kernel.org/tip/5e67b51e3fb22ad43faf9589e9019ad9c6a00413
Author: Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Thu, 27 Dec 2012 11:49:45 +0900
Committer: Steven Rostedt <rostedt@goodmis.org>
CommitDate: Wed, 30 Jan 2013 11:02:05 -0500
tracing: Use sched_clock_cpu for trace_clock_global
For systems with an unstable sched_clock, all cpu_clock() does is enable/
disable local irq during the call to sched_clock_cpu(). And for stable
systems they are same.
trace_clock_global() already disables interrupts, so it can call
sched_clock_cpu() directly.
Link: http://lkml.kernel.org/r/1356576585-28782-2-git-send-email-namhyung@kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace_clock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/trace_clock.c b/kernel/trace/trace_clock.c
index 22b638b..24bf48e 100644
--- a/kernel/trace/trace_clock.c
+++ b/kernel/trace/trace_clock.c
@@ -84,7 +84,7 @@ u64 notrace trace_clock_global(void)
local_irq_save(flags);
this_cpu = raw_smp_processor_id();
- now = cpu_clock(this_cpu);
+ now = sched_clock_cpu(this_cpu);
/*
* If in an NMI context then dont risk lockups and return the
* cpu_clock() time:
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [tip:core/locking] watchdog: Use local_clock for get_timestamp()
2012-12-27 2:49 [PATCH 1/2] watchdog: Use local_clock for get_timestamp() Namhyung Kim
` (2 preceding siblings ...)
2013-01-24 20:20 ` [tip:core/locking] " tip-bot for Namhyung Kim
@ 2013-02-22 12:23 ` tip-bot for Namhyung Kim
3 siblings, 0 replies; 8+ messages in thread
From: tip-bot for Namhyung Kim @ 2013-02-22 12:23 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, namhyung.kim, namhyung, rostedt, tglx, dzickus
Commit-ID: c06b4f1947213cd0902610fafcabac02d49ad728
Gitweb: http://git.kernel.org/tip/c06b4f1947213cd0902610fafcabac02d49ad728
Author: Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Thu, 27 Dec 2012 11:49:44 +0900
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 19 Feb 2013 08:42:40 +0100
watchdog: Use local_clock for get_timestamp()
The get_timestamp() function is always called with current cpu,
thus using local_clock() would be more appropriate and it makes
the code shorter and cleaner IMHO.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Don Zickus <dzickus@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1356576585-28782-1-git-send-email-namhyung@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/watchdog.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 75a2ab3..082ca68 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -112,9 +112,9 @@ static int get_softlockup_thresh(void)
* resolution, and we don't need to waste time with a big divide when
* 2^30ns == 1.074s.
*/
-static unsigned long get_timestamp(int this_cpu)
+static unsigned long get_timestamp(void)
{
- return cpu_clock(this_cpu) >> 30LL; /* 2^30 ~= 10^9 */
+ return local_clock() >> 30LL; /* 2^30 ~= 10^9 */
}
static void set_sample_period(void)
@@ -132,9 +132,7 @@ static void set_sample_period(void)
/* Commands for resetting the watchdog */
static void __touch_watchdog(void)
{
- int this_cpu = smp_processor_id();
-
- __this_cpu_write(watchdog_touch_ts, get_timestamp(this_cpu));
+ __this_cpu_write(watchdog_touch_ts, get_timestamp());
}
void touch_softlockup_watchdog(void)
@@ -195,7 +193,7 @@ static int is_hardlockup(void)
static int is_softlockup(unsigned long touch_ts)
{
- unsigned long now = get_timestamp(smp_processor_id());
+ unsigned long now = get_timestamp();
/* Warn about unreasonable delays: */
if (time_after(now, touch_ts + get_softlockup_thresh()))
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-02-22 12:24 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-27 2:49 [PATCH 1/2] watchdog: Use local_clock for get_timestamp() Namhyung Kim
2012-12-27 2:49 ` [PATCH 2/2] tracing: Use sched_clock_cpu for trace_clock_global Namhyung Kim
2012-12-27 9:52 ` Namhyung Kim
2013-01-07 13:54 ` Steven Rostedt
2013-02-03 19:22 ` [tip:perf/core] " tip-bot for Namhyung Kim
2013-01-02 20:09 ` [PATCH 1/2] watchdog: Use local_clock for get_timestamp() Don Zickus
2013-01-24 20:20 ` [tip:core/locking] " tip-bot for Namhyung Kim
2013-02-22 12:23 ` tip-bot for Namhyung Kim
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).