console_sem locking annotations?

From: Geert Uytterhoeven
Date: Fri Oct 31 2008 - 10:58:27 EST


Hi,

I'm trying to add sparse locking annotations for console_sem.
However, I don't know how to handle try_acquire_console_sem().

Without handling it, I get e.g.:

| drivers/video/ps3fb.c:533:24: warning: context problem in 'ps3fb_release': 'release_console_sem' expected different context
| drivers/video/ps3fb.c:533:24: context 'console_sem': wanted >= 1, got 0

I tried handling it using __cond_lock() --- as is used for e.g. spin_trylock()
--- but it didn't work. Besides, with spin_trylock(), I also get:

| drivers/char/vt.c:2524:2: warning: context problem in 'vt_console_print': '_spin_unlock' expected different context
| drivers/char/vt.c:2524:2: context 'lock': wanted >= 1, got 0

so it looks like it won't work anyway?

Anyone with a clue? Thanks!

---
include/linux/console.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -115,9 +115,9 @@ extern int update_console_cmdline(char *
extern void register_console(struct console *);
extern int unregister_console(struct console *);
extern struct console *console_drivers;
-extern void acquire_console_sem(void);
-extern int try_acquire_console_sem(void);
-extern void release_console_sem(void);
+extern void acquire_console_sem(void) __acquires(console_sem);
+extern int try_acquire_console_sem(void); // ??? FIXME
+extern void release_console_sem(void) __releases(console_sem);
extern void console_conditional_schedule(void);
extern void console_unblank(void);
extern struct tty_driver *console_device(int *);

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Techsoft Centre Europe
The Corporate Village  Da Vincilaan 7-D1  B-1935 Zaventem  Belgium

Phone: +32 (0)2 700 8453
Fax: +32 (0)2 700 8622
E-mail: Geert.Uytterhoeven@xxxxxxxxxxx
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 Â RPR Brussels
Fortis  BIC GEBABEBB  IBAN BE41293037680010