public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michal Schmidt <xschmi00@stud.feec.vutbr.cz>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org, dwalker@mvista.com,
	Joe King <atom_bomb@rocketmail.com>,
	ganzinger@mvista.com, Lee Revell <rlrevell@joe-job.com>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [patch] Real-Time Preemption, -RT-2.6.12-rc4-V0.7.47-06
Date: Wed, 25 May 2005 22:38:38 +0200	[thread overview]
Message-ID: <4294E24E.8000003@stud.feec.vutbr.cz> (raw)
In-Reply-To: <20050523082637.GA15696@elte.hu>

[-- Attachment #1: Type: text/plain, Size: 337 bytes --]

Hi Ingo,

I'm now running -RT-2.6.12-rc4-V0.7.47-08 on amd64.
I use cpufreq, but with the RT kernel it triggers "Kernel BUG at 
"kernel/latency.c":1295" (the check for preempt_count underflow).

I'm attaching a patch which changes a semaphore in cpufreq into a 
completion. With this patch, my system runs OK even with cpufreqd.

Michal

[-- Attachment #2: cpufreq-RT.diff --]
[-- Type: text/x-patch, Size: 4205 bytes --]

diff -Nurp -X linux-2.6.12-rc4-RT-mich/Documentation/dontdiff linux-2.6.12-rc4-RT/drivers/cpufreq/cpufreq.c linux-2.6.12-rc4-RT-mich/drivers/cpufreq/cpufreq.c
--- linux-2.6.12-rc4-RT/drivers/cpufreq/cpufreq.c	2005-05-25 22:23:24.000000000 +0200
+++ linux-2.6.12-rc4-RT-mich/drivers/cpufreq/cpufreq.c	2005-05-25 21:56:43.000000000 +0200
@@ -605,7 +605,7 @@ static int cpufreq_add_dev (struct sys_d
 	policy->cpu = cpu;
 	policy->cpus = cpumask_of_cpu(cpu);
 
-	init_MUTEX_LOCKED(&policy->lock);
+	init_completion(&policy->done);
 	init_completion(&policy->kobj_unregister);
 	INIT_WORK(&policy->update, handle_update, (void *)(long)cpu);
 
@@ -646,7 +646,7 @@ static int cpufreq_add_dev (struct sys_d
 	spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
 	policy->governor = NULL; /* to assure that the starting sequence is
 				  * run in cpufreq_set_policy */
-	up(&policy->lock);
+	complete(&policy->done);
 	
 	/* set default policy */
 	
@@ -765,11 +765,11 @@ static int cpufreq_remove_dev (struct sy
 	spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
 #endif
 
-	down(&data->lock);
+	wait_for_completion(&data->done);
 	if (cpufreq_driver->target)
 		__cpufreq_governor(data, CPUFREQ_GOV_STOP);
 	cpufreq_driver->target = NULL;
-	up(&data->lock);
+	complete(&data->done);
 
 	kobject_unregister(&data->kobj);
 
@@ -842,7 +842,7 @@ unsigned int cpufreq_get(unsigned int cp
 	if (!cpufreq_driver->get)
 		goto out;
 
-	down(&policy->lock);
+	wait_for_completion(&policy->done);
 
 	ret = cpufreq_driver->get(cpu);
 
@@ -855,7 +855,7 @@ unsigned int cpufreq_get(unsigned int cp
 		}
 	}
 
-	up(&policy->lock);
+	complete(&policy->done);
 
  out:
 	cpufreq_cpu_put(policy);
@@ -1136,11 +1136,11 @@ int cpufreq_driver_target(struct cpufreq
 	if (!policy)
 		return -EINVAL;
 
-	down(&policy->lock);
+	wait_for_completion(&policy->done);
 
 	ret = __cpufreq_driver_target(policy, target_freq, relation);
 
-	up(&policy->lock);
+	complete(&policy->done);
 
 	cpufreq_cpu_put(policy);
 
@@ -1177,9 +1177,9 @@ int cpufreq_governor(unsigned int cpu, u
 	if (!policy)
 		return -EINVAL;
 
-	down(&policy->lock);
+	wait_for_completion(&policy->done);
 	ret = __cpufreq_governor(policy, event);
-	up(&policy->lock);
+	complete(&policy->done);
 
 	cpufreq_cpu_put(policy);
 
@@ -1246,9 +1246,9 @@ int cpufreq_get_policy(struct cpufreq_po
 	if (!cpu_policy)
 		return -EINVAL;
 
-	down(&cpu_policy->lock);
+	wait_for_completion(&cpu_policy->done);
 	memcpy(policy, cpu_policy, sizeof(struct cpufreq_policy));
-	up(&cpu_policy->lock);
+	complete(&cpu_policy->done);
 
 	cpufreq_cpu_put(cpu_policy);
 
@@ -1360,7 +1360,7 @@ int cpufreq_set_policy(struct cpufreq_po
 		return -EINVAL;
 
 	/* lock this CPU */
-	down(&data->lock);
+	wait_for_completion(&data->done);
 
 	ret = __cpufreq_set_policy(data, policy);
 	data->user_policy.min = data->min;
@@ -1368,7 +1368,7 @@ int cpufreq_set_policy(struct cpufreq_po
 	data->user_policy.policy = data->policy;
 	data->user_policy.governor = data->governor;
 
-	up(&data->lock);
+	complete(&data->done);
 	cpufreq_cpu_put(data);
 
 	return ret;
@@ -1392,7 +1392,7 @@ int cpufreq_update_policy(unsigned int c
 	if (!data)
 		return -ENODEV;
 
-	down(&data->lock);
+	wait_for_completion(&data->done);
 
 	dprintk("updating policy for CPU %u\n", cpu);
 	memcpy(&policy, 
@@ -1405,7 +1405,7 @@ int cpufreq_update_policy(unsigned int c
 
 	ret = __cpufreq_set_policy(data, &policy);
 
-	up(&data->lock);
+	complete(&data->done);
 
 	cpufreq_cpu_put(data);
 	return ret;
diff -Nurp -X linux-2.6.12-rc4-RT-mich/Documentation/dontdiff linux-2.6.12-rc4-RT/include/linux/cpufreq.h linux-2.6.12-rc4-RT-mich/include/linux/cpufreq.h
--- linux-2.6.12-rc4-RT/include/linux/cpufreq.h	2005-05-25 22:23:26.000000000 +0200
+++ linux-2.6.12-rc4-RT-mich/include/linux/cpufreq.h	2005-05-25 21:49:25.000000000 +0200
@@ -81,7 +81,7 @@ struct cpufreq_policy {
         unsigned int		policy; /* see above */
 	struct cpufreq_governor	*governor; /* see below */
 
- 	struct semaphore	lock;   /* CPU ->setpolicy or ->target may
+ 	struct completion	done;   /* CPU ->setpolicy or ->target may
 					   only be called once a time */
 
 	struct work_struct	update; /* if update_policy() needs to be

  parent reply	other threads:[~2005-05-25 20:40 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-23  8:26 [patch] Real-Time Preemption, -RT-2.6.12-rc4-V0.7.47-06 Ingo Molnar
2005-05-23  9:34 ` Serge Noiraud
2005-05-23 11:23   ` Ingo Molnar
2005-05-23 14:30     ` K.R. Foley
2005-05-24 16:38 ` K.R. Foley
2005-05-25 11:34   ` Ingo Molnar
2005-05-25 11:35     ` Ingo Molnar
2005-05-25 13:28       ` K.R. Foley
2005-05-25 14:03         ` Ingo Molnar
2005-05-25 14:18           ` K.R. Foley
2005-05-25 15:20           ` K.R. Foley
2005-05-26  7:45           ` Ingo Molnar
2005-05-26 10:53             ` K.R. Foley
2005-05-26 15:23             ` K.R. Foley
2005-05-25 20:38 ` Michal Schmidt [this message]
2005-05-27 20:46   ` Michal Schmidt
2005-05-28  5:53     ` Ingo Molnar
2005-05-30  9:51       ` Michal Schmidt
2005-05-30 14:38         ` Ingo Molnar
2005-05-30 14:50           ` Ingo Molnar
2005-05-30 16:47             ` Michal Schmidt
2005-05-30 18:09               ` Ingo Molnar
2005-06-01 17:28       ` Esben Nielsen
2005-06-01  9:19   ` Ingo Molnar
2005-06-01  9:32     ` Michal Schmidt
2005-06-01  9:39       ` Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2005-05-23 15:05 Oleg Nesterov
2005-05-23 15:12 ` Daniel Walker
2005-05-23 15:53   ` Oleg Nesterov
2005-05-23 16:48   ` Oleg Nesterov
2005-06-01  9:21     ` Ingo Molnar
2005-06-01 13:04       ` Daniel Walker
2005-06-01 13:11         ` Ingo Molnar
2005-06-01 13:21           ` Daniel Walker
2005-06-01 14:43         ` Oleg Nesterov
2005-06-01 14:43           ` Daniel Walker
2005-06-01 15:02             ` Oleg Nesterov
2005-06-01 15:05               ` Daniel Walker
2005-06-01 15:47                 ` Oleg Nesterov
2005-06-01 15:43                   ` Daniel Walker
2005-05-24  1:47 Perez-Gonzalez, Inaky

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=4294E24E.8000003@stud.feec.vutbr.cz \
    --to=xschmi00@stud.feec.vutbr.cz \
    --cc=atom_bomb@rocketmail.com \
    --cc=dwalker@mvista.com \
    --cc=ganzinger@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rlrevell@joe-job.com \
    --cc=rostedt@goodmis.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