From: Feng Tang <feng.tang@intel.com>
To: Tim Gardner <tim.gardner@canonical.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Jonathan Nieder <jrnieder@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>, Greg KH <gregkh@suse.de>,
<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>,
<akpm@linux-foundation.org>, Alan Cox <alan@lxorguk.ukuu.org.uk>,
Phil Miller <mille121@illinois.edu>, <philipl@overt.org>,
<mjt@tls.msk.ru>, <gurligebis@gmail.com>,
Linux Kernel Mail List <linux-kernel@vger.kernel.org>
Subject: Re: [27/27] clockevents: Set noop handler in clockevents_exchange_device()
Date: Thu, 5 Jan 2012 18:27:29 +0800 [thread overview]
Message-ID: <20120105182729.5abf7f14@feng-i7> (raw)
In-Reply-To: <CA++bM2uqcWFM6=WdmrusmugQw2nH_KDyySKH+1qyr8GK0Cq14A@mail.gmail.com>
Hi Tim and all,
> From: Tim Gardner <tim.gardner@canonical.com>
> Date: 2011/12/30
> Subject: Re: [27/27] clockevents: Set noop handler in
> clockevents_exchange_device()
> To: Linus Torvalds <torvalds@linux-foundation.org>
> 抄送: Jonathan Nieder <jrnieder@gmail.com>, Thomas Gleixner
> <tglx@linutronix.de>, Greg KH <gregkh@suse.de>,
> linux-kernel@vger.kernel.org, stable@vger.kernel.org,
> akpm@linux-foundation.org, Alan Cox <alan@lxorguk.ukuu.org.uk>, Phil
> Miller <mille121@illinois.edu>
>
>
> On 12/29/2011 06:05 PM, Linus Torvalds wrote:
> >
> > On Thu, Dec 29, 2011 at 4:09 AM, Jonathan Nieder<jrnieder@gmail.com> wrote:
> >>
> >>
> >> This is basically the reverse of 7c1e768974 (clockevents: prevent
> >> clockevent event_handler ending up handler_noop, 2008-09-03). The
> >> rationale for the latter still applies.
> >
> >
> > Hmm. You seem to be right. Instead of applying this to stable, it
> > looks like we should revert it from mainline.
> >
> >> People have been reporting
> >> the analagous patch to this one causing hangs on resume in 3.1.y and
> >> 3.2 release candidates:
> >>
> >> - http://thread.gmane.org/gmane.linux.kernel/1233033
> >> - http://thread.gmane.org/gmane.linux.kernel/1233389
> >> - http://thread.gmane.org/gmane.linux.kernel/1233159
> >> - http://thread.gmane.org/gmane.linux.kernel/1227868/focus=1230877
> >>
> >> So please consider reverting it for now.
> >
> >
> > Thomas? It does seem to be broken and there do seem to be regression
> > reports about it.
> >
> > Should I revert it, or do you have alternative fixes?
> >
> > Linus
> > --
>
>
> We (Ubuntu) are seeing this issue as well in both 3.0.13 and 3.2-rc6:
>
> https://lkml.org/lkml/2011/12/24/33
>
> Reverting that single patch alleviates the resume regression.
I had a Dell Studio XPS machine which see the same hang issue. Per my
track, the root cause of the hang should be:
The machine has 8 CPUs and several Hpets, and it use one hpet as its
broadcast tick device, and 5 hpets as per-cpu tick device for CPU 0-4,
3 Lapics as per-cpu tick device for CPU 5-7.
During the resume cycle, for CPU0-4, the per-cpu tick device setup is
a little complex, a lapic will be assigned as the per-cpu tick first,
and then there will be a switch from lapic to hpet, and problem happens
here during the switch:
tick_check_new_device()
->clockevents_exchange_device(): set the noop handler to lapic tick
->tick_setup_device(): pass the lapic's handler(noop handler) to hpet
So after the resume, 5 per-cpu hpet device's handler will be all noop handler
instead of hrtimer_interrupt, which will hang the resuming.
Following is a patch which fix the problem on my side, could you please review
and try?
-------------------------------------------------------------------------
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index d6733e2..aa93eca 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -101,6 +101,10 @@ struct clock_event_device {
int irq;
const struct cpumask *cpumask;
struct list_head list;
+
+#ifdef CONFIG_GENERIC_CLOCKEVENTS
+ struct tick_device *td;
+#endif
} ____cacheline_aligned;
/*
diff --git a/include/linux/tick.h b/include/linux/tick.h
index b232ccc..7000b26 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -17,6 +17,7 @@ enum tick_device_mode {
struct tick_device {
struct clock_event_device *evtdev;
+ void (*last_event_handler)(struct clock_event_device *);
enum tick_device_mode mode;
};
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 13dfaab..53db16f 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -286,6 +286,15 @@ void clockevents_exchange_device(struct clock_event_device *old,
* released list and do a notify add later.
*/
if (old) {
+ /*
+ * If the old device is the per-cpu tick device, then we
+ * need to record its event handler, so that it could be
+ * passed to the new tick device in tick_setup_device()
+ */
+ if (old->td) {
+ old->td->last_event_handler = old->event_handler;
+ old->td = NULL;
+ }
old->event_handler = clockevents_handle_noop;
clockevents_set_mode(old, CLOCK_EVT_MODE_UNUSED);
list_del(&old->list);
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
index 119528d..5ec54e9 100644
--- a/kernel/time/tick-common.c
+++ b/kernel/time/tick-common.c
@@ -173,12 +173,12 @@ static void tick_setup_device(struct tick_device *td,
*/
td->mode = TICKDEV_MODE_PERIODIC;
} else {
- handler = td->evtdev->event_handler;
+ handler = td->last_event_handler;
next_event = td->evtdev->next_event;
- td->evtdev->event_handler = clockevents_handle_noop;
}
td->evtdev = newdev;
+ newdev->td = td;
/*
* When the device is not per cpu, pin the interrupt to the
>
> rtg
> --
> Tim Gardner tim.gardner@canonical.com
>
> --
> 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/
next prev parent reply other threads:[~2012-01-05 10:27 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-07 16:56 [00/27] 2.6.32.50-longterm review Greg KH
2011-12-07 16:54 ` [01/27] i2c-algo-bit: Generate correct i2c address sequence for 10-bit target Greg KH
2011-12-07 16:54 ` [02/27] eCryptfs: Extend array bounds for all filename chars Greg KH
2011-12-07 16:54 ` [03/27] PCI hotplug: shpchp: dont blindly claim non-AMD 0x7450 device IDs Greg KH
2011-12-07 16:54 ` [04/27] ARM: 7161/1: errata: no automatic store buffer drain Greg KH
2011-12-07 16:54 ` [05/27] ALSA: lx6464es - fix device communication via command bus Greg KH
2011-12-07 17:13 ` Tim Blechmann
2011-12-07 16:54 ` [06/27] SUNRPC: Ensure we return EAGAIN in xs_nospace if congestion is cleared Greg KH
2011-12-07 16:54 ` [07/27] timekeeping: add arch_offset hook to ktime_get functions Greg KH
2011-12-07 16:54 ` [08/27] p54spi: Add missing spin_lock_init Greg KH
2011-12-07 16:54 ` [09/27] p54spi: Fix workqueue deadlock Greg KH
2011-12-07 16:54 ` [10/27] nl80211: fix MAC address validation Greg KH
2011-12-07 16:54 ` [11/27] gro: reset vlan_tci on reuse Greg KH
2011-12-07 16:54 ` [12/27] staging: usbip: bugfix for deadlock Greg KH
2011-12-07 16:54 ` [13/27] staging: comedi: fix oops for USB DAQ devices Greg KH
2011-12-07 16:54 ` [14/27] Staging: comedi: fix signal handling in read and write Greg KH
2011-12-07 16:54 ` [15/27] USB: whci-hcd: fix endian conversion in qset_clear() Greg KH
2011-12-07 16:54 ` [16/27] usb: ftdi_sio: add PID for Propox ISPcable III Greg KH
2011-12-07 16:54 ` [17/27] usb: option: add SIMCom SIM5218 Greg KH
2011-12-07 16:54 ` [18/27] USB: usb-storage: unusual_devs entry for Kingston DT 101 G2 Greg KH
2011-12-07 16:54 ` [19/27] SCSI: scsi_lib: fix potential NULL dereference Greg KH
2011-12-07 16:54 ` [20/27] SCSI: Silencing killing requests for dead queue Greg KH
2011-12-07 16:54 ` [21/27] cifs: fix cifs stable patch cifs-fix-oplock-break-handling-try-2.patch Greg KH
2011-12-07 16:54 ` [22/27] sched, x86: Avoid unnecessary overflow in sched_clock Greg KH
2011-12-07 16:54 ` [23/27] x86/mpparse: Account for bus types other than ISA and PCI Greg KH
2011-12-07 16:54 ` [24/27] oprofile, x86: Fix crash when unloading module (nmi timer mode) Greg KH
2011-12-07 16:54 ` [25/27] genirq: Fix race condition when stopping the irq thread Greg KH
2011-12-07 16:54 ` [26/27] tick-broadcast: Stop active broadcast device when replacing it Greg KH
2011-12-07 16:55 ` [27/27] clockevents: Set noop handler in clockevents_exchange_device() Greg KH
2011-12-29 12:09 ` Jonathan Nieder
2011-12-30 1:05 ` Linus Torvalds
2011-12-30 15:07 ` Tim Gardner
[not found] ` <CA++bM2uqcWFM6=WdmrusmugQw2nH_KDyySKH+1qyr8GK0Cq14A@mail.gmail.com>
2012-01-05 10:27 ` Feng Tang [this message]
2012-01-10 14:23 ` Thomas Gleixner
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=20120105182729.5abf7f14@feng-i7 \
--to=feng.tang@intel.com \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=gregkh@suse.de \
--cc=gurligebis@gmail.com \
--cc=jrnieder@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mille121@illinois.edu \
--cc=mjt@tls.msk.ru \
--cc=philipl@overt.org \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=tim.gardner@canonical.com \
--cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).