All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: "Frédéric Weisbecker" <fweisbec@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Glauber de Oliveira Costa" <gcosta@redhat.com>,
	"Chris Wright" <chrisw@sous-sol.org>,
	"Jeremy Fitzhardinge" <jeremy@goop.org>,
	"Rusty Russell" <rusty@rustcorp.com.au>,
	"Pekka Enberg" <penberg@cs.helsinki.fi>
Subject: Re: [PATCH 0/2] [GIT PULL] tracing: various bug fixes
Date: Thu, 23 Apr 2009 11:08:22 -0400 (EDT)	[thread overview]
Message-ID: <alpine.DEB.2.00.0904231101030.24293@gandalf.stny.rr.com> (raw)
In-Reply-To: <alpine.DEB.2.00.0904231019001.24293@gandalf.stny.rr.com>


On Thu, 23 Apr 2009, Steven Rostedt wrote:
> 
> static inline void __native_flush_tlb_global(void)
> {
>         unsigned long flags;
>         unsigned long cr4;
> 
>         /*
>          * Read-modify-write to CR4 - protect it from preemption and
>          * from interrupts. (Use the raw variant because this code can
>          * be called from deep inside debugging code.)
>          */
>         raw_local_irq_save(flags);
> 
>         cr4 = read_cr4();
>         /* clear PGE */
>         write_cr4(cr4 & ~X86_CR4_PGE);
>         /* write old PGE again and flush TLBs */
>         write_cr4(cr4);
> 
>         raw_local_irq_restore(flags);
> }
> 
> 
> Each of those read_cr4 and write_cr4 can be traced. But I still do not see 
> how this can cause corruption in the current task struct.
> 
> The TLB just caches the pages we are using, not the contents inside. I 
> still do not see how this can corrupt a bit. Unless a register leaked :-/

Ah, this is a lockdep thing.

The raw_local_irq_save/restore in __native_flush_tlb_global does not 
update hardirqs_enabled.

When we call into ftrace, when we cross page bounderies, we disable 
interrupts using the normal local_irq_save/restore calls.

But when we restore, it detects that interrupts are not going to be 
enabled, and keeps hardirqs_enabled off.

The printk solved the issue because it called local_irq_restore, which set 
the variable back.

I guess there's two solutions here. One, we can change the 
raw_local_irq_enable/disable variants in __native_flush_tlb_global to the 
non-raw type (it should protect against recursion).

or we can try to make the ring buffer use the raw_local_irq variants too. 
I tried this once before, and it did cause issues.

Note, there's a "check_flags" in lockdep, but it is only called on 
locking, it is not called when we only disable/enable interrupts.

-- Steve


  reply	other threads:[~2009-04-23 15:08 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-20 22:22 [PATCH 0/2] [GIT PULL] tracing: various bug fixes Steven Rostedt
2009-04-20 22:22 ` [PATCH 1/2] tracing: use recursive counter over irq level Steven Rostedt
2009-04-20 22:22 ` [PATCH 2/2] tracing: use nowakeup version of commit for function event trace tests Steven Rostedt
2009-04-20 22:41   ` Frederic Weisbecker
2009-04-20 22:57     ` Steven Rostedt
2009-04-21  8:23 ` [PATCH 0/2] [GIT PULL] tracing: various bug fixes Ingo Molnar
2009-04-21  9:46   ` Ingo Molnar
2009-04-21 13:08     ` Steven Rostedt
2009-04-21 13:55     ` [PATCH][GIT PULL] ring-buffer: only warn on wrap if buffer is bigger than two pages Steven Rostedt
2009-04-21 14:35       ` Ingo Molnar
2009-04-21 14:54         ` Steven Rostedt
2009-04-21 16:22         ` Steven Rostedt
2009-04-21 14:03     ` [tip:tracing/core] " tip-bot for Steven Rostedt
2009-04-22  6:48     ` [PATCH 0/2] [GIT PULL] tracing: various bug fixes Steven Rostedt
2009-04-22 11:47       ` Frederic Weisbecker
2009-04-22 13:49         ` Steven Rostedt
2009-04-22 17:10           ` Frederic Weisbecker
2009-04-22 17:17             ` Jeremy Fitzhardinge
2009-04-22 17:22               ` Steven Rostedt
2009-04-22 21:32                 ` Steven Rostedt
2009-04-23  8:28                   ` Ingo Molnar
2009-04-23  3:35       ` Steven Rostedt
2009-04-23  8:20         ` Ingo Molnar
2009-04-23 13:53           ` Steven Rostedt
2009-04-23 14:39             ` Steven Rostedt
2009-04-23 15:08               ` Steven Rostedt [this message]
2009-04-23 15:11                 ` Ingo Molnar
2009-04-23 16:49                 ` Jeremy Fitzhardinge
2009-04-23 17:21                   ` Chris Wright
2009-04-23 18:02                     ` Chris Wright
2009-04-23 18:33                       ` Steven Rostedt
2009-04-23 18:43                         ` Chris Wright
2009-04-24  8:36                           ` Ingo Molnar
2009-04-24 15:12                             ` Chris Wright
2009-04-29  6:16                     ` [tip:tracing/core] x86: use native register access for native tlb flushing tip-bot for Chris Wright
2009-04-23 17:52                   ` [PATCH 0/2] [GIT PULL] tracing: various bug fixes Steven Rostedt
2009-04-24  8:34             ` Ingo Molnar

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=alpine.DEB.2.00.0904231101030.24293@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=chrisw@sous-sol.org \
    --cc=fweisbec@gmail.com \
    --cc=gcosta@redhat.com \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=penberg@cs.helsinki.fi \
    --cc=rusty@rustcorp.com.au \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.