linux-um archives
 help / color / mirror / Atom feed
From: Blaisorblade <blaisorblade@yahoo.it>
To: user-mode-linux-devel@lists.sourceforge.net
Cc: stian@nixia.no
Subject: Re: [uml-devel] uml_console_write
Date: Mon, 10 Jan 2005 15:54:59 +0100	[thread overview]
Message-ID: <200501101554.59810.blaisorblade@yahoo.it> (raw)
In-Reply-To: <49797.80.203.9.2.1104597206.squirrel@80.203.9.2>

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

      reply	other threads:[~2005-01-10 14:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-01 16:33 [uml-devel] uml_console_write stian
2005-01-10 14:54 ` Blaisorblade [this message]

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=200501101554.59810.blaisorblade@yahoo.it \
    --to=blaisorblade@yahoo.it \
    --cc=stian@nixia.no \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /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