From: Mathieu Desnoyers <mathieu.desnoyers-scC8bbJcJLCw5LPnMra/2Q@public.gmane.org>
Cc: Linux Kernel Mailing List
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Kernel Testers List
<kernel-testers-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Andrew Morton
<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
gregkh-l3A5Bk7waGM@public.gmane.org,
stable-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
cpufreq-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org>,
rjw-KKrjLPT3xs0@public.gmane.org,
Ben Slusky <sluskyb-k/7z6JowIC0cuXOPmUuyGA@public.gmane.org>,
Dave Jones <davej-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: [PATCH] cpufreq fix timer teardown in ondemand governor
Date: Sun, 17 May 2009 10:30:45 -0400 [thread overview]
Message-ID: <20090517143045.GC27882@Krystal> (raw)
In-Reply-To: <pQ9WADCjgyE.A.PTG.HA0DKB@chimera>
* Rafael J. Wysocki (rjw-KKrjLPT3xs0@public.gmane.org) wrote:
> This message has been generated automatically as a part of a report
> of regressions introduced between 2.6.28 and 2.6.29.
>
> The following bug entry is on the current list of known regressions
> introduced between 2.6.28 and 2.6.29. Please verify if it still should
> be listed and let me know (either way).
>
>
> Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=13186
> Subject : cpufreq timer teardown problem
> Submitter : Mathieu Desnoyers <mathieu.desnoyers-scC8bbJcJLCw5LPnMra/2Q@public.gmane.org>
> Date : 2009-04-23 14:00 (24 days old)
> References : http://marc.info/?l=linux-kernel&m=124049523515036&w=4
> Handled-By : Mathieu Desnoyers <mathieu.desnoyers-scC8bbJcJLCw5LPnMra/2Q@public.gmane.org>
> Patch : http://patchwork.kernel.org/patch/19754/
> http://patchwork.kernel.org/patch/19753/
>
(updated changelog)
cpufreq fix timer teardown in ondemand governor
The problem is that dbs_timer_exit() uses cancel_delayed_work() when it should
use cancel_delayed_work_sync(). cancel_delayed_work() does not wait for the
workqueue handler to exit.
The ondemand governor does not seem to be affected because the
"if (!dbs_info->enable)" check at the beginning of the workqueue handler returns
immediately without rescheduling the work. The conservative governor in
2.6.30-rc has the same check as the ondemand governor, which makes things
usually run smoothly. However, if the governor is quickly stopped and then
started, this could lead to the following race :
dbs_enable could be reenabled and multiple do_dbs_timer handlers would run.
This is why a synchronized teardown is required.
The following patch applies to, at least, 2.6.28.x, 2.6.29.1, 2.6.30-rc2.
Depends on patch
cpufreq: remove rwsem lock from CPUFREQ_GOV_STOP call
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers-scC8bbJcJLCw5LPnMra/2Q@public.gmane.org>
CC: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
CC: gregkh-l3A5Bk7waGM@public.gmane.org
CC: stable-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
CC: cpufreq-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
CC: Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org>
CC: rjw-KKrjLPT3xs0@public.gmane.org
CC: Ben Slusky <sluskyb-k/7z6JowIC0cuXOPmUuyGA@public.gmane.org>
CC: Dave Jones <davej-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
drivers/cpufreq/cpufreq_ondemand.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Index: linux-2.6-lttng/drivers/cpufreq/cpufreq_ondemand.c
===================================================================
--- linux-2.6-lttng.orig/drivers/cpufreq/cpufreq_ondemand.c 2009-04-23 23:25:00.000000000 -0400
+++ linux-2.6-lttng/drivers/cpufreq/cpufreq_ondemand.c 2009-04-23 23:25:39.000000000 -0400
@@ -98,6 +98,9 @@ static unsigned int dbs_enable; /* numbe
* (like __cpufreq_driver_target()) is being called with dbs_mutex taken, then
* cpu_hotplug lock should be taken before that. Note that cpu_hotplug lock
* is recursive for the same process. -Venki
+ * DEADLOCK ALERT! (2) : do_dbs_timer() must not take the dbs_mutex, because it
+ * would deadlock with cancel_delayed_work_sync(), which is needed for proper
+ * raceless workqueue teardown.
*/
static DEFINE_MUTEX(dbs_mutex);
@@ -562,7 +565,7 @@ static inline void dbs_timer_init(struct
static inline void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info)
{
dbs_info->enable = 0;
- cancel_delayed_work(&dbs_info->work);
+ cancel_delayed_work_sync(&dbs_info->work);
}
static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
next prev parent reply other threads:[~2009-05-17 14:30 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-16 19:58 2.6.30-rc6: Reported regressions 2.6.28 -> 2.6.29 Rafael J. Wysocki
2009-05-16 19:59 ` [Bug #12490] ath5k related kernel panic in 2.6.29-rc1 Rafael J. Wysocki
2009-05-16 20:04 ` [Bug #12499] Problem with using bluetooth adaper connected to usb port Rafael J. Wysocki
2009-05-17 7:58 ` Maciej Rutecki
[not found] ` <8db1092f0905170058n338a3cbcr2a7524b11a22d21-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-05-17 10:21 ` Rafael J. Wysocki
2009-05-16 20:05 ` [Bug #12681] s2ram: fails to wake up on Acer Extensa 4220 (SMP disabled) Rafael J. Wysocki
2009-05-16 20:05 ` [Bug #12861] Xorg fails to start "Failed to allocate space for kernel memory manager" Rafael J. Wysocki
2009-05-16 20:05 ` [Bug #12705] X200: Brightness broken since 2.6.29-rc4-58-g4c098bc Rafael J. Wysocki
2009-05-16 20:05 ` [Bug #12765] i915 VT switch with AIGLX causes X lock up Rafael J. Wysocki
2009-05-18 7:13 ` Sitsofe Wheeler
[not found] ` <20090518071315.GA26870-Ae9UE+oIsuU@public.gmane.org>
2009-05-18 17:10 ` Rafael J. Wysocki
2009-05-16 20:05 ` [Bug #12971] "tg3 transmit timed out" when transmitting at high bitrate Rafael J. Wysocki
2009-05-16 20:05 ` [Bug #12899] Crash in i915.ko: i915_driver_irq_handler Rafael J. Wysocki
2009-05-16 20:05 ` [Bug #12947] r128: system hangs when X is started with DRI enabled Rafael J. Wysocki
2009-05-17 16:08 ` Jos van der Ende
2009-05-16 20:05 ` [Bug #12909] boot/kernel init duration regression from 2.6.28 Rafael J. Wysocki
2009-05-16 20:05 ` [Bug #13024] nozomi: pppd fails on kernel 2.6.29 Rafael J. Wysocki
2009-05-16 20:05 ` [Bug #12980] lockup in X.org Rafael J. Wysocki
2009-05-17 15:39 ` Marcus Better
[not found] ` <4A102FBF.9070208-sJr3legBufCzQB+pC5nmwQ@public.gmane.org>
2009-05-17 17:27 ` Rafael J. Wysocki
2009-05-16 20:05 ` [Bug #13001] PCI-DMA: Out of IOMMU space Rafael J. Wysocki
2009-05-16 20:06 ` [Bug #13072] forcedeth seems to switch off eth on shutdown Rafael J. Wysocki
[not found] ` <1242563611.15249.2.camel@laptop.workgroup>
[not found] ` <1242563611.15249.2.camel-y+/Lg7DY4zRruh19HrdLAw@public.gmane.org>
2009-05-17 12:56 ` Rafael J. Wysocki
2009-05-16 20:06 ` [Bug #13025] After upgrading to kernel 2.6.29, pulseaudio stopped with some strange error Rafael J. Wysocki
2009-05-16 20:06 ` [Bug #13074] gspca_stv06xx doesn't work with Logitech QuickCam Express (046d:0840) Rafael J. Wysocki
2009-05-16 20:06 ` [Bug #13100] can't anymore even do a s2ram-s2disk-s2ram cycle on acer aspire 5720G Rafael J. Wysocki
2009-05-16 20:06 ` [Bug #13172] Spontaneous reboots since 2.6.29-rc* Rafael J. Wysocki
2009-05-17 7:53 ` Maciej Rutecki
[not found] ` <8db1092f0905170053k5ccd8903k7b6d203dd349daeb-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-05-17 10:23 ` Rafael J. Wysocki
2009-05-16 20:06 ` [Bug #13144] resume from suspend fails using video card i915 Rafael J. Wysocki
2009-05-16 20:06 ` [Bug #13178] Booting very slow Rafael J. Wysocki
2009-05-18 8:15 ` Martin Knoblauch
[not found] ` <424718.52835.qm-f6uctMgKLEavuULXzWHTWIglqE1Y4D90QQ4Iyu8u01E@public.gmane.org>
2009-05-18 17:13 ` Rafael J. Wysocki
2009-05-19 0:26 ` Kay Sievers
[not found] ` <ac3eb2510905181726q3b996b8ei9c6a74fe1d3bb17d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-05-19 7:22 ` Martin Knoblauch
[not found] ` <783496.86803.qm-1+WuAixcP4WvuULXzWHTWIglqE1Y4D90QQ4Iyu8u01E@public.gmane.org>
2009-05-19 8:58 ` Kay Sievers
[not found] ` <ac3eb2510905190158o6682f7aat62ff66ac9aaa2a74-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-05-20 10:14 ` Martin Knoblauch
2009-05-16 20:06 ` [Bug #13175] sata_nv incompatible with async scsi scan Rafael J. Wysocki
2009-05-16 20:06 ` [Bug #13225] [2.6.29 regression] Software suspend no longer works Rafael J. Wysocki
2009-05-16 20:06 ` [Bug #13186] cpufreq timer teardown problem Rafael J. Wysocki
2009-05-17 14:23 ` [PATCH] cpufreq: remove rwsem lock from CPUFREQ_GOV_STOP call Mathieu Desnoyers
2009-05-17 14:29 ` [PATCH] cpufreq fix timer teardown in conservative governor Mathieu Desnoyers
2009-05-17 14:30 ` Mathieu Desnoyers [this message]
2009-05-16 20:06 ` [Bug #13183] forcedeth: no link during initialization Rafael J. Wysocki
2009-05-16 20:06 ` [Bug #13232] ext3/4 with synchronous writes gets wedged by Postfix Rafael J. Wysocki
2009-05-18 13:25 ` Theodore Tso
[not found] ` <20090518132517.GL32019-3s7WtUTddSA@public.gmane.org>
2009-05-19 17:17 ` David Watson
[not found] ` <20090519171713.GA3354-yvBcC19sZ6P0OyVTGvYuXB2eb7JE58TQ@public.gmane.org>
2009-05-19 17:53 ` Theodore Tso
2009-05-19 18:27 ` John Stoffel
[not found] ` <18962.64002.324970.49512-HgN6juyGXH5AfugRpC6u6w@public.gmane.org>
2009-05-19 20:41 ` Theodore Tso
[not found] ` <20090519204152.GE9053-3s7WtUTddSA@public.gmane.org>
2009-05-20 16:53 ` John Stoffel
2009-05-16 20:06 ` [Bug #13269] WARNING: at kernel/hrtimer.c:625 hres_timers_resume+0x3c/0x48() when resuming Rafael J. Wysocki
2009-05-16 20:06 ` [Bug #13271] ath9k stop working since 2.6.29 Rafael J. Wysocki
2009-05-17 7:56 ` 2.6.30-rc6: Reported regressions 2.6.28 -> 2.6.29 Maciej Rutecki
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=20090517143045.GC27882@Krystal \
--to=mathieu.desnoyers-scc8bbjcjlcw5lpnmra/2q@public.gmane.org \
--cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=cpufreq-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=davej-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=gregkh-l3A5Bk7waGM@public.gmane.org \
--cc=kernel-testers-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mingo-X9Un+BFzKDI@public.gmane.org \
--cc=rjw-KKrjLPT3xs0@public.gmane.org \
--cc=sluskyb-k/7z6JowIC0cuXOPmUuyGA@public.gmane.org \
--cc=stable-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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).