From: John Stultz <john.stultz@linaro.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: John Stultz <john.stultz@linaro.org>,
Sasha Levin <sasha.levin@oracle.com>,
Thomas Gleixner <tglx@linutronix.de>,
Prarit Bhargava <prarit@redhat.com>,
Richard Cochran <richardcochran@gmail.com>,
Ingo Molnar <mingo@kernel.org>
Subject: [PATCH 4/9] tick/timekeeping: Call update_wall_time outside the jiffies lock
Date: Thu, 2 Jan 2014 14:23:22 -0800 [thread overview]
Message-ID: <1388701407-5029-4-git-send-email-john.stultz@linaro.org> (raw)
In-Reply-To: <1388701407-5029-1-git-send-email-john.stultz@linaro.org>
Since the xtime lock was split into the timekeeping lock and
the jiffies lock, we no longer need to call update_wall_time()
while holding the jiffies lock.
Thus, this patch splits update_wall_time() out from do_timer().
This allows us to get away from calling clock_was_set_delayed()
in update_wall_time() and instead use the standard clock_was_set()
call that previously would deadlock, as it causes the jiffies lock
to be acquired.
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
kernel/time/tick-common.c | 1 +
kernel/time/tick-internal.h | 1 +
kernel/time/tick-sched.c | 1 +
kernel/time/timekeeping.c | 19 ++++---------------
4 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
index 64522ec..91c5f27 100644
--- a/kernel/time/tick-common.c
+++ b/kernel/time/tick-common.c
@@ -70,6 +70,7 @@ static void tick_periodic(int cpu)
do_timer(1);
write_sequnlock(&jiffies_lock);
+ update_wall_time();
}
update_process_times(user_mode(get_irq_regs()));
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h
index e2bced5..8329669 100644
--- a/kernel/time/tick-internal.h
+++ b/kernel/time/tick-internal.h
@@ -155,3 +155,4 @@ static inline int tick_device_is_functional(struct clock_event_device *dev)
#endif
extern void do_timer(unsigned long ticks);
+extern void update_wall_time(void);
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 2afd43f..c58b03d 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -86,6 +86,7 @@ static void tick_do_update_jiffies64(ktime_t now)
tick_next_period = ktime_add(last_jiffies_update, tick_period);
}
write_sequnlock(&jiffies_lock);
+ update_wall_time();
}
/*
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index d62682b..44b7e6b 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1360,7 +1360,7 @@ static inline void old_vsyscall_fixup(struct timekeeper *tk)
* update_wall_time - Uses the current clocksource to increment the wall time
*
*/
-static void update_wall_time(void)
+void update_wall_time(void)
{
struct clocksource *clock;
struct timekeeper *real_tk = &timekeeper;
@@ -1441,19 +1441,8 @@ static void update_wall_time(void)
write_seqcount_end(&timekeeper_seq);
out:
raw_spin_unlock_irqrestore(&timekeeper_lock, flags);
- if (clock_was_set) {
- /*
- * XXX - I'd rather we just call clock_was_set(), but
- * since we're currently holding the jiffies lock, calling
- * clock_was_set would trigger an ipi which would then grab
- * the jiffies lock and we'd deadlock. :(
- * The right solution should probably be droping
- * the jiffies lock before calling update_wall_time
- * but that requires some rework of the tick sched
- * code.
- */
- clock_was_set_delayed();
- }
+ if (clock_set)
+ clock_was_set();
}
/**
@@ -1598,7 +1587,6 @@ struct timespec get_monotonic_coarse(void)
void do_timer(unsigned long ticks)
{
jiffies_64 += ticks;
- update_wall_time();
calc_global_load(ticks);
}
@@ -1756,4 +1744,5 @@ void xtime_update(unsigned long ticks)
write_seqlock(&jiffies_lock);
do_timer(ticks);
write_sequnlock(&jiffies_lock);
+ update_wall_time();
}
--
1.8.3.2
next prev parent reply other threads:[~2014-01-02 22:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-02 22:22 [GIT PULL] Timekeeping changes for 3.14 John Stultz
2014-01-02 22:23 ` [PATCH 1/9] timekeeping: Fix lost updates to tai adjustment John Stultz
2014-01-02 22:23 ` [PATCH 2/9] timekeeping: Fix potential lost pv notification of time change John Stultz
2014-01-02 22:23 ` [PATCH 3/9] timekeeping: Avoid possible deadlock from clock_was_set_delayed John Stultz
2014-01-02 22:23 ` John Stultz [this message]
2014-01-02 22:23 ` [PATCH 5/9] timekeeping: Fix CLOCK_TAI timer/nanosleep delays John Stultz
2014-01-02 22:23 ` [PATCH 6/9] timekeeping: Fix missing timekeeping_update in suspend path John Stultz
2014-01-02 22:23 ` [PATCH 7/9] timekeeper: fix comment typo for tk_setup_internals() John Stultz
2014-01-02 22:23 ` [PATCH 8/9] rtc-cmos: Add an alarm disable quirk John Stultz
2014-01-02 22:23 ` [PATCH 9/9] timekeeping: Remove comment that's mostly out of date John Stultz
2014-01-12 13:15 ` [GIT PULL] Timekeeping changes for 3.14 Ingo Molnar
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=1388701407-5029-4-git-send-email-john.stultz@linaro.org \
--to=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=prarit@redhat.com \
--cc=richardcochran@gmail.com \
--cc=sasha.levin@oracle.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
Powered by JetHome