Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1357956
| From | Jan Kara <jack@suse.cz> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC][PATCH v4 1/2] printk: Make printk() completely async |
| Date | 2016-03-15 11:10 +0100 |
| Message-ID | <rcU5l-Bl-13@gated-at.bofh.it> (permalink) |
| References | <rcBvI-4Pn-17@gated-at.bofh.it> <rcBvJ-4Pn-27@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
> + if (!sync_print) {
> + if (printk_thread && !in_panic) {
> + /*
> + * This will wakeup the printing kthread and offload
> + * printing to a schedulable context.
> + */
> + __this_cpu_or(printk_pending,
> + PRINTK_PENDING_KTHREAD_OUTPUT);
> + irq_work_queue(this_cpu_ptr(&wake_up_klogd_work));
> + } else if (in_sched) {
> + /*
> + * @in_sched messages may come too early, when we don't
> + * yet have @printk_thread. We can't print deferred
> + * messages directly, because this may deadlock, route
> + * them via IRQ context.
> + */
> + __this_cpu_or(printk_pending,
> + PRINTK_PENDING_IRQ_OUTPUT);
> + irq_work_queue(this_cpu_ptr(&wake_up_klogd_work));
> + } else {
> + sync_print = true;
> + }
> + }
I'm a bit undecided whether we want to go through irq work even for the
common case of !in_sched messages or whether we want to directly call
wake_up() in that case. Maybe I'd do it like:
if (!sync_print) {
if (in_sched) {
__this_cpu_or(printk_pending,
PRINTK_PENDING_IRQ_OUTPUT);
irq_work_queue(this_cpu_ptr(&wake_up_klogd_work));
} else if (printk_thread && !in_panic) {
wake_up(&printing_wait);
} else {
sync_print = true;
}
}
and the wake_up_klogd_work_func() would look like:
static void wake_up_klogd_work_func(struct irq_work *irq_work)
{
int pending = __this_cpu_xchg(printk_pending, 0);
if (pending & PRINTK_PENDING_OUTPUT) {
if (printk_thread) {
wake_up(&printing_wait);
} else {
/*
* If trylock fails, someone else is doing the printing
*/
if (console_trylock())
console_unlock();
}
}
...
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC][PATCH v4 0/2] printk: Make printk() completely async Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-03-14 15:20 +0100
[RFC][PATCH v4 1/2] printk: Make printk() completely async Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-03-14 15:20 +0100
Re: [RFC][PATCH v4 1/2] printk: Make printk() completely async Jan Kara <jack@suse.cz> - 2016-03-15 11:10 +0100
Re: [RFC][PATCH v4 1/2] printk: Make printk() completely async Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-03-15 15:20 +0100
Re: [RFC][PATCH v4 1/2] printk: Make printk() completely async Byungchul Park <byungchul.park@lge.com> - 2016-03-16 06:50 +0100
Re: [RFC][PATCH v4 1/2] printk: Make printk() completely async Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-03-16 08:00 +0100
Re: [RFC][PATCH v4 1/2] printk: Make printk() completely async Byungchul Park <byungchul.park@lge.com> - 2016-03-16 08:40 +0100
Re: [RFC][PATCH v4 1/2] printk: Make printk() completely async Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-03-16 09:00 +0100
Re: [RFC][PATCH v4 1/2] printk: Make printk() completely async Byungchul Park <byungchul.park@lge.com> - 2016-03-16 11:40 +0100
Re: [RFC][PATCH v4 1/2] printk: Make printk() completely async Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-03-17 01:40 +0100
Re: [RFC][PATCH v4 1/2] printk: Make printk() completely async Byungchul Park <byungchul.park@lge.com> - 2016-03-16 08:10 +0100
Re: [RFC][PATCH v4 1/2] printk: Make printk() completely async Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-03-16 08:10 +0100
Re: [RFC][PATCH v4 1/2] printk: Make printk() completely async Petr Mladek <pmladek@suse.com> - 2016-03-15 17:00 +0100
Re: [RFC][PATCH v4 1/2] printk: Make printk() completely async Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-03-16 03:10 +0100
Re: [RFC][PATCH v4 1/2] printk: Make printk() completely async Byungchul Park <byungchul.park@lge.com> - 2016-03-16 03:20 +0100
Re: [RFC][PATCH v4 1/2] printk: Make printk() completely async Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-03-16 03:40 +0100
[RFC][PATCH v4 2/2] printk: Skip messages on oops Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-03-14 15:20 +0100
Re: [RFC][PATCH v4 2/2] printk: Skip messages on oops Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-03-17 12:00 +0100
csiph-web