From: Steven Rostedt <rostedt@goodmis.org>
To: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>,
Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
Petr Mladek <pmladek@suse.com>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
syzkaller <syzkaller@googlegroups.com>,
Fengguang Wu <fengguang.wu@intel.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: printk feature for syzbot?
Date: Fri, 11 May 2018 09:37:16 -0400 [thread overview]
Message-ID: <20180511093716.18329322@gandalf.local.home> (raw)
In-Reply-To: <20180511095004.GA6575@jagdpanzerIV>
On Fri, 11 May 2018 18:50:04 +0900
Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> wrote:
> On (05/11/18 11:17), Dmitry Vyukov wrote:
> >
> > From what I see, it seems that interrupts can be nested:
>
> Hm, I thought that in general IRQ handlers run with local IRQs
> disabled on CPU. So, generally, IRQs don't nest. Was I wrong?
> NMIs can nest, that's true; but I thought that at least IRQs
> don't.
We normally don't run nested interrupts, although as the comment in
preempt.h says:
* The hardirq count could in theory be the same as the number of
* interrupts in the system, but we run all interrupt handlers with
* interrupts disabled, so we cannot have nesting interrupts. Though
* there are a few palaeontologic drivers which reenable interrupts in
* the handler, so we need more than one bit here.
And no, NMI handlers do not nest. Yes, we deal with nested NMIs, but in
those cases, we just set a bit as a latch, and return, and when the
first NMI is complete, it checks that bit and if it is set, it executes
another NMI handler.
>
> > https://syzkaller.appspot.com/bug?id=72eddef9cedcf81486adb9dd3e789f0d77505ba5
> > https://syzkaller.appspot.com/bug?id=66fcf61c65f8aa50bbb862eb2fde27c08909a4ff
> >
> > Will this in_nmi()/in_irq()/in_serving_softirq()/else be enough to
> > untangle output printed by such nested interrupts?
>
> Well, hm. __irq_enter() does preempt_count_add(HARDIRQ_OFFSET) and
> __irq_exit() does preempt_count_sub(HARDIRQ_OFFSET). So, technically,
> you can store
>
> preempt_count() & HARDIRQ_MASK
> preempt_count() & SOFTIRQ_MASK
> preempt_count() & NMI_MASK
>
> in that extended context tracking. The numbers will not tell you
> the IRQ line number, for instance, but at least you'll be able to
> distinguish different hard/soft IRQs, NMIs. Just an idea, I didn't
> check it, may be it won't work at all.
>
> Ideally, the serial log should be like this
>
> i:1 ... foo()
> i:1 ... bar()
> i:2 ... foo() // __irq_enter()
> i:2 ... bar()
> i:2 ... buz() // __irq_exit()
> i:1 ... buz()
>
> but I may be completely wrong.
>
> Petr and Steven probably will have better ideas.
I handle nesting of different contexts in the ftrace ring buffer using
the preempt count. See trace_recursive_lock/unlock() in
kernel/trace/ring_buffer.c.
-- Steve
next prev parent reply other threads:[~2018-05-11 13:37 UTC|newest]
Thread overview: 94+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <201804232233.CIC65675.OJSOMFQOFFHVtL@I-love.SAKURA.ne.jp>
[not found] ` <CACT4Y+boyw_Qy=y-iTnsKZrtTgF0Hk3nHN_xtqUdX4etgiYDQw@mail.gmail.com>
2018-04-24 1:33 ` printk feature for syzbot? Sergey Senozhatsky
2018-04-24 14:40 ` Steven Rostedt
2018-04-26 10:06 ` Petr Mladek
2018-05-10 4:22 ` Sergey Senozhatsky
2018-05-10 11:30 ` Petr Mladek
2018-05-10 12:11 ` Sergey Senozhatsky
2018-05-10 14:22 ` Steven Rostedt
2018-05-10 14:50 ` Tetsuo Handa
2018-05-11 1:45 ` Sergey Senozhatsky
[not found] ` <201805110238.w4B2cIGH079602@www262.sakura.ne.jp>
2018-05-11 6:21 ` Sergey Senozhatsky
2018-05-11 9:17 ` Dmitry Vyukov
2018-05-11 9:50 ` Sergey Senozhatsky
2018-05-11 11:58 ` [PATCH] printk: inject caller information into the body of message Tetsuo Handa
2018-05-17 11:21 ` Sergey Senozhatsky
2018-05-17 11:52 ` Sergey Senozhatsky
2018-05-18 12:15 ` Petr Mladek
2018-05-18 12:25 ` Dmitry Vyukov
2018-05-18 12:54 ` Petr Mladek
2018-05-18 13:08 ` Dmitry Vyukov
2018-05-24 2:21 ` Sergey Senozhatsky
2018-05-23 10:19 ` Tetsuo Handa
2018-05-24 2:14 ` Sergey Senozhatsky
2018-05-26 6:36 ` Dmitry Vyukov
2018-06-20 5:44 ` Dmitry Vyukov
2018-06-20 8:31 ` Sergey Senozhatsky
2018-06-20 8:45 ` Dmitry Vyukov
2018-06-20 9:06 ` Sergey Senozhatsky
2018-06-20 9:18 ` Sergey Senozhatsky
2018-06-20 9:31 ` Dmitry Vyukov
2018-06-20 11:07 ` Sergey Senozhatsky
2018-06-20 11:32 ` Dmitry Vyukov
2018-06-20 13:06 ` Sergey Senozhatsky
2018-06-22 13:06 ` Tetsuo Handa
2018-06-25 1:41 ` Sergey Senozhatsky
2018-06-25 9:36 ` Dmitry Vyukov
2018-06-27 10:29 ` Tetsuo Handa
2018-09-10 11:20 ` Alexander Potapenko
2018-09-12 6:53 ` Sergey Senozhatsky
2018-09-12 16:05 ` Steven Rostedt
2018-09-13 7:12 ` Sergey Senozhatsky
2018-09-13 12:26 ` Petr Mladek
2018-09-13 14:28 ` Sergey Senozhatsky
2018-09-14 1:22 ` Steven Rostedt
2018-09-14 2:15 ` Sergey Senozhatsky
2018-09-14 6:57 ` Sergey Senozhatsky
2018-09-14 10:37 ` Tetsuo Handa
2018-09-14 11:50 ` Sergey Senozhatsky
2018-09-14 12:03 ` Tetsuo Handa
2018-09-14 12:22 ` Sergey Senozhatsky
2018-09-19 11:02 ` Tetsuo Handa
2018-09-24 8:11 ` Tetsuo Handa
2018-09-27 16:10 ` Tetsuo Handa
2018-09-28 9:02 ` Sergey Senozhatsky
2018-09-28 9:09 ` Sergey Senozhatsky
2018-09-28 11:01 ` Tetsuo Handa
2018-09-29 10:51 ` Sergey Senozhatsky
2018-09-29 11:15 ` Tetsuo Handa
2018-10-01 2:37 ` Sergey Senozhatsky
2018-10-01 2:58 ` Sergey Senozhatsky
2018-10-01 11:21 ` Tetsuo Handa
2018-10-02 6:38 ` Sergey Senozhatsky
2018-10-08 10:31 ` Tetsuo Handa
2018-10-08 16:03 ` Petr Mladek
2018-10-08 20:48 ` Tetsuo Handa
2018-10-09 14:52 ` Petr Mladek
2018-10-09 21:19 ` Tetsuo Handa
2018-10-10 10:14 ` Tetsuo Handa
2018-10-11 10:20 ` Tetsuo Handa
2018-10-11 13:47 ` Steven Rostedt
2018-10-08 15:43 ` Petr Mladek
2018-09-28 8:56 ` Sergey Senozhatsky
2018-09-28 11:21 ` Tetsuo Handa
2018-09-29 11:13 ` Sergey Senozhatsky
2018-09-29 11:39 ` Tetsuo Handa
2018-10-01 5:52 ` Sergey Senozhatsky
2018-10-01 8:37 ` Sergey Senozhatsky
2018-10-01 18:06 ` Steven Rostedt
2018-09-14 1:12 ` Steven Rostedt
2018-09-14 1:55 ` Sergey Senozhatsky
2018-06-21 8:29 ` Sergey Senozhatsky
2018-06-20 9:30 ` Dmitry Vyukov
2018-06-20 11:19 ` Sergey Senozhatsky
2018-06-20 11:25 ` Dmitry Vyukov
2018-06-20 11:37 ` Fengguang Wu
2018-06-20 12:31 ` Dmitry Vyukov
2018-06-20 12:41 ` Fengguang Wu
2018-06-20 12:45 ` Dmitry Vyukov
2018-06-20 12:48 ` Fengguang Wu
2018-05-11 13:37 ` Steven Rostedt [this message]
2018-05-15 5:20 ` printk feature for syzbot? Sergey Senozhatsky
2018-05-15 14:39 ` Steven Rostedt
2018-05-11 11:02 ` [PATCH] printk: fix possible reuse of va_list variable Tetsuo Handa
2018-05-11 11:27 ` Sergey Senozhatsky
2018-05-17 11:57 ` Petr Mladek
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=20180511093716.18329322@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=dvyukov@google.com \
--cc=fengguang.wu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=pmladek@suse.com \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=sergey.senozhatsky@gmail.com \
--cc=syzkaller@googlegroups.com \
/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;
as well as URLs for NNTP newsgroup(s).