From: Andi Kleen <andi@firstfloor.org>
To: Mathieu Desnoyers <compudj@krystal.dyndns.org>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
Ingo Molnar <mingo@elte.hu>,
akpm@osdl.org, "H. Peter Anvin" <hpa@zytor.com>,
Steven Rostedt <rostedt@goodmis.org>,
"Frank Ch. Eigler" <fche@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] x86 NMI-safe INT3 and Page Fault (v3)
Date: Fri, 18 Apr 2008 10:27:31 +0200 [thread overview]
Message-ID: <48085B73.3070904@firstfloor.org> (raw)
In-Reply-To: <20080418000551.GA5062@Krystal>
> arch/x86/oprofile/nmi_timer_int.c: profile_timer_exceptions_notify()
> calls
> drivers/oprofile/oprofile_add_sample()
> which calls oprofile_add_ext_sample()
> where
> if (log_sample(cpu_buf, pc, is_kernel, event))
> oprofile_ops.backtrace(regs, backtrace_depth);
A red hering: The notifier setup calls vmalloc_sync_all() and oprofile
allocates its buffers before registering the notifier.
> First, log_sample writes into the vmalloc'd cpu buffer. That's for one
> possible page fault.
> Then, is a kernel backtrace happen, then I am not sure if printk_address
> won't try to read any of the module data, which is vmalloc'd.
Yes, admittedly the backtrace mode was always somewhat flakey. It probably
has more problems too.
The right fix for that is to call vmalloc_sync_all() after module load
when any nmi notifiers are registered.
>
>
>> NMI are maybe 5-6 functions all over the kernel.
>>
>> I just don't think it makes any sense to put markers in there.
>> It is a really small part of the kernel the kernel that is unlikely
>> to be really useful for anybody. You should rather first solve the
>> problem of tracing the other 99.999999% of the kernel properly.
>>
>
> The fact is that NMIs are very useful and powerful when it comes to try
> to understand where code disabling interrupts is stucked, to get
> performance counter reads periodically
First there are no truly periodic (as in time) NMIs. The NMI watchdog
is not really periodic but is delayed arbitrarily all the time when the CPU
is in sleep states.
Then oprofile does this already what you describe. Why do we need
another questionable infrastructure to reimplement what is
already there?
without suffering from IRQ
> latency
Just from all kind of other latency caused by non ticking performance
counters.
. Also, when trying to figure out what is actually happening in
> the kernel timekeeping, having a stable periodic time source can be
> pretty useful.
Haha. You seem to be so deep into nonsense land, it is hard to comprehend.
> That would be one way to do it, except that it would not deal with int3.
> Also, it would have to be taken into account at module load time. To me,
> that looks like an error-prone design. If the problem is at the lower
> end of the architecture, in the interrupt return path, why don't we
> simply fix it there for good ?
There are all kinds of problems with NMIs, this is only one of them.
And NMIs are a really really obscure case
Frankly, if you spend all your time on fringe cases like this instead
of getting it to work on the 99.99999999999999% case it doesn't
surprise me that the markers don't make any progress for years now.
And yes, boot code is one of the first thing embedded system
> developers want to instrument.
Crap. That code runs once. The only interest is correctness and
if it's not correct you just step it through with a JTAG debugger.
> I wonder if they are used so rarely because the underlying kernel is
> buggy with respect with NMIs or because they are useless.
lockless programming is just really hard and not doing it is in most
cases the sanest option.
Anyways I give up. Do what you want.
-Andi
next prev parent reply other threads:[~2008-04-18 8:28 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20080414230344.GA16061@Krystal>
2008-04-14 23:05 ` [RFC PATCH] x86 NMI-safe INT3 and Page Fault (v2) Mathieu Desnoyers
2008-04-16 13:06 ` Ingo Molnar
2008-04-16 13:47 ` [TEST PATCH] Test NMI kprobe modules Mathieu Desnoyers
2008-04-16 14:34 ` Ingo Molnar
2008-04-16 14:54 ` Mathieu Desnoyers
2008-04-16 15:10 ` [RFC PATCH] x86 NMI-safe INT3 and Page Fault (v2) Ingo Molnar
2008-04-16 15:18 ` H. Peter Anvin
2008-04-16 15:37 ` Mathieu Desnoyers
2008-04-16 16:03 ` Jeremy Fitzhardinge
2008-04-18 0:48 ` Mathieu Desnoyers
2008-04-18 9:49 ` Jeremy Fitzhardinge
2008-04-16 16:28 ` [RFC PATCH] x86 NMI-safe INT3 and Page Fault (v3) Mathieu Desnoyers
2008-04-16 17:57 ` Jeremy Fitzhardinge
2008-04-17 16:29 ` Mathieu Desnoyers
2008-04-17 16:45 ` Andi Kleen
2008-04-18 0:05 ` Mathieu Desnoyers
2008-04-18 8:27 ` Andi Kleen [this message]
2008-04-19 21:18 ` Mathieu Desnoyers
2008-04-20 12:58 ` Andi Kleen
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=48085B73.3070904@firstfloor.org \
--to=andi@firstfloor.org \
--cc=akpm@osdl.org \
--cc=compudj@krystal.dyndns.org \
--cc=fche@redhat.com \
--cc=hpa@zytor.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.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