linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Bristot de Oliveira <bristot@redhat.com>
To: Andy Lutomirski <luto@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@alien8.de>,
	Peter Zijlstra <peterz@infradead.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Joel Fernandes (Google)" <joel@joelfernandes.org>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Tommaso Cucinotta <tommaso.cucinotta@santannapisa.it>,
	Romulo Silva de Oliveira <romulo.deoliveira@ufsc.br>,
	Clark Williams <williams@redhat.com>, X86 ML <x86@kernel.org>
Subject: Re: [RFC PATCH 0/7] Early task context tracking
Date: Mon, 8 Apr 2019 14:47:33 +0200	[thread overview]
Message-ID: <9ba6e0eb-cc4c-49db-40dc-1df4b93b81ef@redhat.com> (raw)
In-Reply-To: <CALCETrXUx7ExeqERxwu7nfps9vhZhQbfNEFG5fD_Kp7RexCEcA@mail.gmail.com>

On 4/4/19 2:01 AM, Andy Lutomirski wrote:
>> To resolve this problem, the set/unset of the IRQ/NMI context needs to
>> be done before the execution of the first C execution, and after its
>> return. By doing so, and using this method to identify the context in the
>> trace recursion protection, no more events are lost.
> I would much rather do the opposite: completely remove context
> tracking from the asm and, instead, stick it into the C code.  We'd
> need to make sure that the C code is totally immune from tracing,
> kprobes, etc, but it would be a nice cleanup.  And then you could fix
> this bug in C!
> 
> 

Humm... what we could do to have things in C is to set the variable right at the
begin of the C handler, e.g., do_IRQ(), and right before the return.

But by doing this we would have a problem with two things:

1) irq handler itself (e.g., do_IRQ())
2) functions/tracepoints that might run before and after the handler execution
(e.g., preemptirq tracer), but still in the IRQ context.

We can work around the first case by checking if (the function is in the
__irq_entry .text section) in the recursion control.

The second case would still be a problem. For instance, the preemptirq:
tracepoints in the preemptirq tracer would be "dropped" in the case of a
miss-identification of a recursion.

Thinking aloud: should we try to move the preemptirq tracers to the C part?

I will try to come up with a patch with this approach to see if it "works."

Thoughts?

-- Daniel

  parent reply	other threads:[~2019-04-08 12:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-02 20:03 [RFC PATCH 0/7] Early task context tracking Daniel Bristot de Oliveira
2019-04-02 20:03 ` [RFC PATCH 1/7] x86/entry: Add support for early " Daniel Bristot de Oliveira
2019-04-02 20:03 ` [RFC PATCH 2/7] trace: Move the trace recursion context enum to trace.h and reuse it Daniel Bristot de Oliveira
2019-04-02 20:03 ` [RFC PATCH 3/7] trace: Optimize trace_get_context_bit() Daniel Bristot de Oliveira
2019-04-02 20:03 ` [RFC PATCH 4/7] trace/ring_buffer: Use trace_get_context_bit() Daniel Bristot de Oliveira
2019-04-02 20:03 ` [RFC PATCH 5/7] trace: Use early task context tracking if available Daniel Bristot de Oliveira
2019-04-02 20:03 ` [RFC PATCH 6/7] events: Create an trace_get_context_bit() Daniel Bristot de Oliveira
2019-04-02 20:03 ` [RFC PATCH 7/7] events: Use early task context tracking if available Daniel Bristot de Oliveira
2019-04-04  0:01 ` [RFC PATCH 0/7] Early task context tracking Andy Lutomirski
2019-04-04  9:42   ` Peter Zijlstra
2019-04-08 12:47   ` Daniel Bristot de Oliveira [this message]
2019-04-08 16:08     ` Andy Lutomirski
2019-04-04 17:40 ` Joel Fernandes
2019-04-08 12:54   ` Daniel Bristot de Oliveira

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=9ba6e0eb-cc4c-49db-40dc-1df4b93b81ef@redhat.com \
    --to=bristot@redhat.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=joel@joelfernandes.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=romulo.deoliveira@ufsc.br \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=tommaso.cucinotta@santannapisa.it \
    --cc=williams@redhat.com \
    --cc=x86@kernel.org \
    /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).