From: Eric Dumazet <dada1@cosmosbay.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: Robert Richter <robert.richter@amd.com>,
Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] oprofile: re-arm APIC_DM_NMI in ppro_check_ctrs()
Date: Tue, 11 Nov 2008 09:32:12 +0100 [thread overview]
Message-ID: <4919430C.6050502@cosmosbay.com> (raw)
In-Reply-To: <20081110154948.GW29626@one.firstfloor.org>
[-- Attachment #1: Type: text/plain, Size: 1520 bytes --]
Andi Kleen a écrit :
>> oprofile_add_sample(regs, i);
>> + /*
>> + * We need to unmask the apic vector *before*
>> + * writing reset_value to msr counter
>> + */
>> + apic_write(APIC_LVTPC, APIC_DM_NMI);
>> wrmsrl(msrs->counters[i].addr, -reset_value[i]);
>> }
>> }
>>
>> - /* Only P6 based Pentium M need to re-unmask the apic vector but it
>> - * doesn't hurt other P6 variant */
>> - apic_write(APIC_LVTPC, apic_read(APIC_LVTPC) & ~APIC_LVT_MASKED);
>
> Did you also test if it really needs to be inside the if () or
> just before the wrmsrl?
>
Andi, the following patch also works well for me. The key is we must
unmask APIC before the wrmsrl. after/before the rdmsrl has no impact.
I wonder then if the final comment in ppro_check_ctrs() is still applicable.
PATCH] oprofile: un-mask APIC before resetting counter in ppro_check_ctrs()
While using oprofile on my HP BL460c G1, (two quad core intel E5450 CPU),
I noticed that one CPU after the other could not get anymore NMI.
After a while, all cores where blocked (ie not generating events for oprofile)
I tried all major linux versions and all where affected by this freeze.
I found that we have to un-mask APIC *before* writing to MSR counter
when we get event notification, because we use APIC_LVTPC in edge triggered mode.
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
---
arch/x86/oprofile/op_model_ppro.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
[-- Attachment #2: oprofile_msr.patch --]
[-- Type: text/plain, Size: 1009 bytes --]
diff --git a/arch/x86/oprofile/op_model_ppro.c b/arch/x86/oprofile/op_model_ppro.c
index 3f1b81a..8484528 100644
--- a/arch/x86/oprofile/op_model_ppro.c
+++ b/arch/x86/oprofile/op_model_ppro.c
@@ -126,6 +126,12 @@ static int ppro_check_ctrs(struct pt_regs * const regs,
u64 val;
int i;
+ /*
+ * We need to unmask the apic vector *before* writing reset_value
+ * to msr counter, because we use edge trigger
+ */
+ apic_write(APIC_LVTPC, apic_read(APIC_LVTPC) & ~APIC_LVT_MASKED);
+
for (i = 0 ; i < num_counters; ++i) {
if (!reset_value[i])
continue;
@@ -136,10 +142,6 @@ static int ppro_check_ctrs(struct pt_regs * const regs,
}
}
- /* Only P6 based Pentium M need to re-unmask the apic vector but it
- * doesn't hurt other P6 variant */
- apic_write(APIC_LVTPC, apic_read(APIC_LVTPC) & ~APIC_LVT_MASKED);
-
/* We can't work out if we really handled an interrupt. We
* might have caught a *second* counter just after overflowing
* the interrupt for this counter then arrives
next prev parent reply other threads:[~2008-11-11 8:32 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-07 17:13 [git pull] OProfile fixes for v2.6.28 Robert Richter
2008-11-07 18:22 ` Ingo Molnar
2008-11-10 8:05 ` Eric Dumazet
2008-11-10 8:43 ` Andi Kleen
2008-11-10 9:01 ` Eric Dumazet
2008-11-10 14:23 ` [PATCH] oprofile: re-arm APIC_DM_NMI in ppro_check_ctrs() Eric Dumazet
2008-11-10 15:49 ` Andi Kleen
2008-11-10 15:50 ` Eric Dumazet
2008-11-10 17:46 ` Andi Kleen
2008-11-11 8:32 ` Eric Dumazet [this message]
2008-11-17 17:33 ` Robert Richter
2008-11-17 18:25 ` Andi Kleen
2008-11-18 8:57 ` Robert Richter
2008-11-10 16:11 ` Cyrill Gorcunov
2008-11-10 16:19 ` Eric Dumazet
2008-11-10 16:31 ` Cyrill Gorcunov
2008-11-17 17:57 ` [git pull] OProfile fixes for v2.6.28 Robert Richter
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=4919430C.6050502@cosmosbay.com \
--to=dada1@cosmosbay.com \
--cc=andi@firstfloor.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=robert.richter@amd.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