]> git.karo-electronics.de Git - karo-tx-linux.git/commit
printk: enable interrupts before calling console_trylock_for_printk()
authorJan Kara <jack@suse.cz>
Thu, 22 May 2014 00:43:35 +0000 (10:43 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 22 May 2014 00:43:35 +0000 (10:43 +1000)
commitbafe980f5afc7ccc693fd8c81c8aa5a02fbb5ae0
tree8fe9be460579b098c91c43b689224015d881c9a6
parentee75ecbd8b9ad26cd0094573cd4b612ab20b3e71
printk: enable interrupts before calling console_trylock_for_printk()

We need interrupts disabled when calling console_trylock_for_printk() only
so that cpu id we pass to can_use_console() remains valid (for other
things console_sem provides all the exclusion we need and deadlocks on
console_sem due to interrupts are impossible because we use
down_trylock()).  However if we are rescheduled, we are guaranteed to run
on an online cpu so we can easily just get the cpu id in
can_use_console().

We can lose a bit of performance when we enable interrupts in
vprintk_emit() and then disable them again in console_unlock() but OTOH it
can somewhat reduce interrupt latency caused by console_unlock()
especially since later in the patch series we will want to spin on
console_sem in console_trylock_for_printk().

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/printk/printk.c