Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1491603
| From | Andrew Morton <akpm@linux-foundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] kcov: properly check if we are in an interrupt |
| Date | 2016-09-27 01:40 +0200 |
| Message-ID | <slNF7-1NX-9@gated-at.bofh.it> (permalink) |
| References | <skA7g-5af-33@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, 23 Sep 2016 16:51:13 +0200 Andrey Konovalov <andreyknvl@google.com> wrote: > in_interrupt() returns a nonzero value when we are either in an > interrupt or have bh disabled via local_bh_disable(). Since we are > interested in only ignoring coverage from actual interrupts, do a > proper check of whether we are really in an interrupt. > > Signed-off-by: Andrey Konovalov <andreyknvl@google.com> > --- > It would look totally better to reuse in_irq(), in_serving_softirq() and > in_nmi() instead of checking flags manually, but that leads to slower > generated code (three separate tests for each of the flags). Would it be > better to add another macro to preempt.h that would check if we're actually > in interrupt and use it? Yes please. Is there anywhere else where such a macro can be used? > --- a/kernel/kcov.c > +++ b/kernel/kcov.c > @@ -54,7 +54,8 @@ void notrace __sanitizer_cov_trace_pc(void) > * We are interested in code coverage as a function of a syscall inputs, > * so we ignore code executed in interrupts. > */ > - if (!t || in_interrupt()) > + if (!t || (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_OFFSET > + | NMI_MASK))) Or include a prominent and very apologetic comment here explaining why it is open-coded. But I do agree that not open-coding it is better.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] kcov: properly check if we are in an interrupt Andrey Konovalov <andreyknvl@google.com> - 2016-09-23 17:00 +0200
Re: [PATCH] kcov: properly check if we are in an interrupt Andrew Morton <akpm@linux-foundation.org> - 2016-09-27 01:40 +0200
Re: [PATCH] kcov: properly check if we are in an interrupt Dmitry Vyukov <dvyukov@google.com> - 2016-09-27 08:30 +0200
Re: [PATCH] kcov: properly check if we are in an interrupt Peter Zijlstra <peterz@infradead.org> - 2016-09-27 09:40 +0200
Re: [PATCH] kcov: properly check if we are in an interrupt Dmitry Vyukov <dvyukov@google.com> - 2016-09-27 10:00 +0200
Re: [PATCH] kcov: properly check if we are in an interrupt Peter Zijlstra <peterz@infradead.org> - 2016-09-27 13:00 +0200
Re: [PATCH] kcov: properly check if we are in an interrupt Dmitry Vyukov <dvyukov@google.com> - 2016-09-27 14:40 +0200
Re: [PATCH] kcov: properly check if we are in an interrupt Vegard Nossum <vegard.nossum@oracle.com> - 2016-09-27 13:30 +0200
Re: [PATCH] kcov: properly check if we are in an interrupt Vegard Nossum <vegard.nossum@oracle.com> - 2016-09-27 13:30 +0200
csiph-web