All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Schmidt <xschmi00@stud.feec.vutbr.cz>
To: Michal Schmidt <xschmi00@stud.feec.vutbr.cz>
Cc: Ingo Molnar <mingo@elte.hu>,
	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: Fri, 27 May 2005 22:46:40 +0200	[thread overview]
Message-ID: <42978730.4040205@stud.feec.vutbr.cz> (raw)
In-Reply-To: <4294E24E.8000003@stud.feec.vutbr.cz>

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

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

Although the patch worked for me, it was probably bogus.
The real reason why cpufreq caused problems was that it does:
   init_MUTEX_LOCKED(&policy->lock);
and later:
   up(&policy->lock);
where policy->lock is declared as:
   struct semaphore        lock;

In PREEMPT_RT, the init_MUTEX_LOCKED is defined in include/linux/rt_lock.h :
   /*
    * No locked initialization for RT semaphores:
    */
   #define init_MUTEX_LOCKED(sem) compat_init_MUTEX_LOCKED(sem)
(BTW, I don't understand why we have init_MUTEX but no init_MUTEX_LOCKED 
for RT semaphores).

Therefore we have an inconsistency - the up() gets translated into 
rt_up() because the lock is of type struct semaphore. However, 
compat_init_MUTEX_LOCKED assumes that it has a struct compat_semaphore.
The compiler actually warns about incompatible pointers but I missed 
that warning at first.
So the fix is to change the lock type into compat_semaphore. I'm 
attaching the patch. It works for me with 2.6.12-rc5-RT-V0.7.47-12.

Regards
Michal

[-- Attachment #2: cpufreq-rt.diff --]
[-- Type: text/plain, Size: 644 bytes --]

diff -Nurp -X linux-RT4/Documentation/dontdiff linux-RT4/include/linux/cpufreq.h linux-RT3/include/linux/cpufreq.h
--- linux-RT4/include/linux/cpufreq.h	2005-05-27 22:00:11.000000000 +0200
+++ linux-RT3/include/linux/cpufreq.h	2005-05-27 21:54:52.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 compat_semaphore	lock;   /* CPU ->setpolicy or ->target may
 					   only be called once a time */
 
 	struct work_struct	update; /* if update_policy() needs to be

  reply	other threads:[~2005-05-27 20:49 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
2005-05-27 20:46   ` Michal Schmidt [this message]
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=42978730.4040205@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.