- x86_64-move-ondemand-timer-into-own-work-queue.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     x86_64: Move ondemand timer into own work queue

has been removed from the -mm tree.  Its filename is

     x86_64-move-ondemand-timer-into-own-work-queue.patch

This patch was probably dropped from -mm because
it has now been merged into a subsystem tree or
into Linus's tree, or because it was folded into
its parent patch in the -mm tree.


From: Andi Kleen <ak@xxxxxxx>

Taking the cpu hotplug semaphore in a normal events workqueue is unsafe
because other tasks can wait for any workqueues with it hold.  This results in
a deadlock.

Move the DBS timer into its own work queue which is not affected by other work
queue flushes to avoid this.

Cc: <venkatesh.pallipadi@xxxxxxxxx>
Cc: <cpufreq@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Andi Kleen <ak@xxxxxxx>
Acked-by: Dave Jones <davej@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/cpufreq/cpufreq_ondemand.c |   28 +++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)

diff -puN drivers/cpufreq/cpufreq_ondemand.c~x86_64-move-ondemand-timer-into-own-work-queue drivers/cpufreq/cpufreq_ondemand.c
--- devel/drivers/cpufreq/cpufreq_ondemand.c~x86_64-move-ondemand-timer-into-own-work-queue	2006-05-10 21:18:15.000000000 -0700
+++ devel-akpm/drivers/cpufreq/cpufreq_ondemand.c	2006-05-10 21:18:15.000000000 -0700
@@ -74,6 +74,8 @@ static unsigned int dbs_enable;	/* numbe
 static DEFINE_MUTEX (dbs_mutex);
 static DECLARE_WORK	(dbs_work, do_dbs_timer, NULL);
 
+static struct workqueue_struct *dbs_workq;
+
 struct dbs_tuners {
 	unsigned int sampling_rate;
 	unsigned int sampling_down_factor;
@@ -364,23 +366,29 @@ static void do_dbs_timer(void *data)
 	mutex_lock(&dbs_mutex);
 	for_each_online_cpu(i)
 		dbs_check_cpu(i);
-	schedule_delayed_work(&dbs_work,
-			usecs_to_jiffies(dbs_tuners_ins.sampling_rate));
+	queue_delayed_work(dbs_workq, &dbs_work,
+			   usecs_to_jiffies(dbs_tuners_ins.sampling_rate));
 	mutex_unlock(&dbs_mutex);
 }
 
 static inline void dbs_timer_init(void)
 {
 	INIT_WORK(&dbs_work, do_dbs_timer, NULL);
-	schedule_delayed_work(&dbs_work,
-			usecs_to_jiffies(dbs_tuners_ins.sampling_rate));
+	if (!dbs_workq)
+		dbs_workq = create_singlethread_workqueue("ondemand");
+	if (!dbs_workq) {
+		printk(KERN_ERR "ondemand: Cannot initialize kernel thread\n");
+		return;
+	}
+	queue_delayed_work(dbs_workq, &dbs_work,
+			   usecs_to_jiffies(dbs_tuners_ins.sampling_rate));
 	return;
 }
 
 static inline void dbs_timer_exit(void)
 {
-	cancel_delayed_work(&dbs_work);
-	return;
+	if (dbs_workq)
+		cancel_rearming_delayed_workqueue(dbs_workq, &dbs_work);
 }
 
 static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
@@ -489,8 +497,12 @@ static int __init cpufreq_gov_dbs_init(v
 
 static void __exit cpufreq_gov_dbs_exit(void)
 {
-	/* Make sure that the scheduled work is indeed not running */
-	flush_scheduled_work();
+	/* Make sure that the scheduled work is indeed not running.
+	   Assumes the timer has been cancelled first. */
+	if (dbs_workq) {
+		flush_workqueue(dbs_workq);
+		destroy_workqueue(dbs_workq);
+	}
 
 	cpufreq_unregister_governor(&cpufreq_gov_dbs);
 }
_

Patches currently in -mm which might be from ak@xxxxxxx are

origin.patch
x86_64-disable-aperture-pci-region-check-in-amd64.patch
x86_64-check-for-too-many-northbridges-in-iommu.patch
git-acpi.patch
git-agpgart.patch
x86_64-mm-serialize-assign_irq_vector-use-of-static-variables-fix.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux