linux-um archives
 help / color / mirror / Atom feed
* [uml-devel] uml_console_write
@ 2005-01-01 16:33 stian
  2005-01-10 14:54 ` Blaisorblade
  0 siblings, 1 reply; 2+ messages in thread
From: stian @ 2005-01-01 16:33 UTC (permalink / raw)
  To: user-mode-linux-devel

if you enable all semaphore locking debuing and such alike, you get a
warning at uml_console_write calliong __might_sleep with irqs_disabled()

The callpath are on another machine, byt here the names are

__might_sleep
uml_console_write
__call_console_drivers
call_console_drivers
release_console_drives
vprintk
printk
ext2_warning
ext2_fill_super
get_sb_bdev
__kmalloc
ext2_get_sb
ext2_fill_super
do_kern_mount
do_new_mount
do_mount
copy_from_user_tt
excact_copy_from_user
copy_mount_options
sys_mount
execute_syscall_tt
syscall_handler_tt
unblock_signals
sig_handler_common
set_user_mode
sig_handler
__restore



Stian


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [uml-devel] uml_console_write
  2005-01-01 16:33 [uml-devel] uml_console_write stian
@ 2005-01-10 14:54 ` Blaisorblade
  0 siblings, 0 replies; 2+ messages in thread
From: Blaisorblade @ 2005-01-10 14:54 UTC (permalink / raw)
  To: user-mode-linux-devel; +Cc: stian

On Saturday 01 January 2005 17:33, stian@nixia.no wrote:
> if you enable all semaphore locking debuing and such alike, you get a
> warning at uml_console_write calliong __might_sleep with irqs_disabled()

Yes, thanks a lot for reporting it... I've added it to my TODO-list.

 in fact uml_console_write acquires a semaphore with 

        if(con_init_done)
                down(&line->sem);

And if down() sleeps, that thread will sleep with interrupt disabled, i.e. 
crash.

I don't know if it's correct that the interrupts are disabled in the below 
callpath: it would be strange that the code in the call stack before printk 
does it, and I searched for interrupts disabling in the printk() code... it 
happens, but not in the path leading to call_console_drivers.

However, the comments (i.e. the specification) says that release_console_sem() 
can be called from any context, like printk(). So, uml_console_write must be 
fixed.

The solution is to turn line->sem into a spinlock (and rename it as ->lock).

Now, this is due from long time... see line_write() and 
line_write_interrupt(): they should synchronize with line->sem, but since the 
second function is an interrupt, it can't acquire a semaphore. So it does not 
do any locking! So it must be done anyway.

> The callpath are on another machine, byt here the names are

> __might_sleep
> uml_console_write
> __call_console_drivers
> call_console_drivers
> release_console_drives
> vprintk
> printk
> ext2_warning
> ext2_fill_super
> get_sb_bdev
> __kmalloc
> ext2_get_sb
> ext2_fill_super
> do_kern_mount
> do_new_mount
> do_mount
> copy_from_user_tt
> excact_copy_from_user
> copy_mount_options
> sys_mount
> execute_syscall_tt
> syscall_handler_tt
> unblock_signals
> sig_handler_common
> set_user_mode
> sig_handler
> __restore


-- 
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-01-10 14:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-01 16:33 [uml-devel] uml_console_write stian
2005-01-10 14:54 ` Blaisorblade

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox