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: Mon, 30 May 2005 11:51:24 +0200 [thread overview]
Message-ID: <429AE21C.2020309@stud.feec.vutbr.cz> (raw)
In-Reply-To: <20050528055322.GA14867@elte.hu>
[-- Attachment #1: Type: text/plain, Size: 1271 bytes --]
Ingo Molnar wrote:
> RT semaphores have stricter semantics than Linux semaphores. One
> property is that there always needs to be an owner of a semaphore. If a
> semaphore gets initialized as init_MUTEX_LOCKED, it is a fair indication
> that the semaphore is really used as a completion object - with no
> stable owner. (e.g. at insmod time when the init_MUTEX_LOCKED is done,
> the insmod thread will go away after some time, leaving the semaphore
> 'orphaned')
Thanks for the explanation. In that case calling init_MUTEX_LOCKED on an
RT semaphore is obviously wrong.
However, it only produces a warning during the compilation and is
guaranteed to BUG when run. It would be better if it obviously failed to
compile. How about the attached patch?
That makes the compilation fail like this:
drivers/cpufreq/cpufreq.c: In function `cpufreq_add_dev':
drivers/cpufreq/cpufreq.c:608: error:
`there_is_no_init_MUTEX_LOCKED_for_RT_semaphores' undeclared (first use
in this function)
drivers/cpufreq/cpufreq.c:608: error: (Each undeclared identifier is
reported only once
drivers/cpufreq/cpufreq.c:608: error: for each function it appears in.)
make[2]: *** [drivers/cpufreq/cpufreq.o] Error 1
make[1]: *** [drivers/cpufreq] Error 2
make: *** [drivers] Error 2
Michal
[-- Attachment #2: rt_init_MUTEX_LOCKED.diff --]
[-- Type: text/plain, Size: 1673 bytes --]
diff -Nurp -X linux-RT/Documentation/dontdiff linux-RT/include/linux/rt_lock.h linux-RT.mich/include/linux/rt_lock.h
--- linux-RT/include/linux/rt_lock.h 2005-05-30 10:42:47.000000000 +0200
+++ linux-RT.mich/include/linux/rt_lock.h 2005-05-30 11:32:12.000000000 +0200
@@ -201,11 +201,13 @@ extern void FASTCALL(__sema_init(struct
__sema_init(sem, val, #sem, __FILE__, __LINE__)
extern void FASTCALL(__init_MUTEX(struct semaphore *sem, char *name, char *file, int line));
-extern void FASTCALL(__init_MUTEX_LOCKED(struct semaphore *sem, char *name, char *file, int line));
#define rt_init_MUTEX(sem) \
__init_MUTEX(sem, #sem, __FILE__, __LINE__)
+/*
+ * No locked initialization for RT semaphores
+ */
#define rt_init_MUTEX_LOCKED(sem) \
- __init_MUTEX_LOCKED(sem, #sem, __FILE__, __LINE__)
+ there_is_no_init_MUTEX_LOCKED_for_RT_semaphores
extern void FASTCALL(rt_down(struct semaphore *sem));
extern int FASTCALL(rt_down_interruptible(struct semaphore *sem));
extern int FASTCALL(rt_down_trylock(struct semaphore *sem));
@@ -259,6 +261,10 @@ do { \
PICK_FUNC_1ARG(struct compat_semaphore, struct semaphore, \
compat_init_MUTEX, rt_init_MUTEX, sem)
+#define init_MUTEX_LOCKED(sem) \
+ PICK_FUNC_1ARG(struct compat_semaphore, struct semaphore, \
+ compat_init_MUTEX_LOCKED, rt_init_MUTEX_LOCKED, sem)
+
#define down(sem) \
PICK_FUNC_1ARG(struct compat_semaphore, struct semaphore, \
compat_down, rt_down, sem)
@@ -284,11 +290,6 @@ do { \
compat_sema_count, rt_sema_count, sem)
/*
- * No locked initialization for RT semaphores:
- */
-#define init_MUTEX_LOCKED(sem) compat_init_MUTEX_LOCKED(sem)
-
-/*
* rwsems:
*/
next prev parent reply other threads:[~2005-05-30 9:52 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
2005-05-28 5:53 ` Ingo Molnar
2005-05-30 9:51 ` Michal Schmidt [this message]
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=429AE21C.2020309@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