Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 603991 Details for
Bug 840949
livelock in leapsecond insertion [rhel-6.2.z]
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
RHEL PATCH 1/3
0001-RHEL6.2.z-PATCH-BZ-847365-1-3-ntp-Add-ntp_lock-to-re.patch (text/plain), 5.11 KB, created by
Prarit Bhargava
on 2012-08-13 12:55:03 UTC
(
hide
)
Description:
RHEL PATCH 1/3
Filename:
MIME Type:
Creator:
Prarit Bhargava
Created:
2012-08-13 12:55:03 UTC
Size:
5.11 KB
patch
obsolete
>From 302342d0f16535391daad3aa4f8e5a090bb3e056 Mon Sep 17 00:00:00 2001 >From: Prarit Bhargava <prarit@redhat.com> >Date: Mon, 16 Jul 2012 14:32:42 -0400 >Subject: [PATCH 1/3] [RHEL6.2.z PATCH BZ 847365 1/3] ntp: Add ntp_lock to > replace xtime_locking > >Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=840949 >Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=847365 > >commit bd3312681f69207a40431981c1bce1afdc9b7975 >Author: John Stultz <john.stultz@linaro.org> >Date: Mon Nov 14 13:48:36 2011 -0800 > >ntp: Add ntp_lock to replace xtime_locking > >Use a ntp_lock spin lock to replace xtime_lock locking in ntp.c > > CC: Thomas Gleixner <tglx@linutronix.de> > CC: Eric Dumazet <eric.dumazet@gmail.com> > CC: Richard Cochran <richardcochran@gmail.com> > Signed-off-by: John Stultz <john.stultz@linaro.org> > >The upstream code had previously moved the xtime struct into the >timekeeper struct and protected the xtime update with the timekeeper lock. >However, that is too large of a patch for z-stream so the solution is to >restore the xtime_lock locking in the timekeeping_leap_insert() function >and mimic upstream. Obviously, this chunk is RHEL only. >--- > kernel/time/ntp.c | 43 +++++++++++++++++++++++++++++++------------ > kernel/time/timekeeping.c | 4 +++- > 2 files changed, 34 insertions(+), 13 deletions(-) > >diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c >index 4800f93..85c4100 100644 >--- a/kernel/time/ntp.c >+++ b/kernel/time/ntp.c >@@ -19,6 +19,9 @@ > * NTP timekeeping variables: > */ > >+DEFINE_SPINLOCK(ntp_lock); >+ >+ > /* USER_HZ period (usecs): */ > unsigned long tick_usec = TICK_USEC; > >@@ -163,11 +166,13 @@ static void ntp_update_offset(long offset) > > /** > * ntp_clear - Clears the NTP state variables >- * >- * Must be called while holding a write on the xtime_lock > */ > void ntp_clear(void) > { >+ unsigned long flags; >+ >+ spin_lock_irqsave(&ntp_lock, flags); >+ > time_adjust = 0; /* stop active adjtime() */ > time_status |= STA_UNSYNC; > time_maxerror = NTP_PHASE_LIMIT; >@@ -177,6 +182,8 @@ void ntp_clear(void) > > tick_length = tick_length_base; > time_offset = 0; >+ spin_unlock_irqrestore(&ntp_lock, flags); >+ > } > > /* >@@ -187,14 +194,15 @@ void ntp_clear(void) > static enum hrtimer_restart ntp_leap_second(struct hrtimer *timer) > { > enum hrtimer_restart res = HRTIMER_NORESTART; >+ unsigned long flags; >+ int leap = 0; > >- write_seqlock(&xtime_lock); >- >+ spin_lock_irqsave(&ntp_lock, flags); > switch (time_state) { > case TIME_OK: > break; > case TIME_INS: >- timekeeping_leap_insert(-1); >+ leap = -1; > time_state = TIME_OOP; > printk(KERN_NOTICE > "Clock: inserting leap second 23:59:60 UTC\n"); >@@ -202,7 +210,7 @@ static enum hrtimer_restart ntp_leap_second(struct hrtimer *timer) > res = HRTIMER_RESTART; > break; > case TIME_DEL: >- timekeeping_leap_insert(1); >+ leap = 1; > time_tai--; > time_state = TIME_WAIT; > printk(KERN_NOTICE >@@ -217,8 +225,14 @@ static enum hrtimer_restart ntp_leap_second(struct hrtimer *timer) > time_state = TIME_OK; > break; > } >+ spin_unlock_irqrestore(&ntp_lock, flags); > >- write_sequnlock(&xtime_lock); >+ /* >+ * We have to call this outside of the ntp_lock to keep >+ * the proper locking hierarchy >+ */ >+ if (leap) >+ timekeeping_leap_insert(leap); > > return res; > } >@@ -234,6 +248,9 @@ static enum hrtimer_restart ntp_leap_second(struct hrtimer *timer) > void second_overflow(void) > { > s64 delta; >+ unsigned long flags; >+ >+ spin_lock_irqsave(&ntp_lock, flags); > > /* Bump the maxerror field */ > time_maxerror += MAXFREQ / NSEC_PER_USEC; >@@ -253,23 +270,25 @@ void second_overflow(void) > tick_length += delta; > > if (!time_adjust) >- return; >+ goto out; > > if (time_adjust > MAX_TICKADJ) { > time_adjust -= MAX_TICKADJ; > tick_length += MAX_TICKADJ_SCALED; >- return; >+ goto out; > } > > if (time_adjust < -MAX_TICKADJ) { > time_adjust += MAX_TICKADJ; > tick_length -= MAX_TICKADJ_SCALED; >- return; >+ goto out; > } > > tick_length += (s64)(time_adjust * NSEC_PER_USEC / NTP_INTERVAL_FREQ) > << NTP_SCALE_SHIFT; > time_adjust = 0; >+out: >+ spin_unlock_irqrestore(&ntp_lock, flags); > } > > #ifdef CONFIG_GENERIC_CMOS_UPDATE >@@ -476,7 +495,7 @@ int do_adjtimex(struct timex *txc) > > getnstimeofday(&ts); > >- write_seqlock_irq(&xtime_lock); >+ spin_lock_irq(&ntp_lock); > > if (txc->modes & ADJ_ADJTIME) { > long save_adjust = time_adjust; >@@ -524,7 +543,7 @@ int do_adjtimex(struct timex *txc) > txc->errcnt = 0; > txc->stbcnt = 0; > >- write_sequnlock_irq(&xtime_lock); >+ spin_unlock_irq(&ntp_lock); > > txc->time.tv_sec = ts.tv_sec; > txc->time.tv_usec = ts.tv_nsec; >diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c >index d18dc69..bae541b 100644 >--- a/kernel/time/timekeeping.c >+++ b/kernel/time/timekeeping.c >@@ -172,12 +172,14 @@ void update_xtime_cache(u64 nsec) > timespec_add_ns(&xtime_cache, nsec); > } > >-/* must hold xtime_lock */ >+/* RHEL6: only called in softirq context from hrtimer expiration */ > void timekeeping_leap_insert(int leapsecond) > { >+ write_seqlock(&xtime_lock); > xtime.tv_sec += leapsecond; > wall_to_monotonic.tv_sec -= leapsecond; > update_vsyscall(&xtime, timekeeper.clock, timekeeper.mult); >+ write_sequnlock(&xtime_lock); > } > > #ifdef CONFIG_GENERIC_TIME >-- >1.7.9.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 840949
: 603991 |
603992
|
603993