Oprofile : need to adjust PC by 16 bytes

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Eric Dumazet
Date: Friday, November 14, 2008 - 8:25 am

Very strange results on my Intel E5450 CPU

I found that I have to bias regs->ip by 16 bytes in order to have
correct profiling.

Does it rings a bell to anyone ?

opcontrol --version
opcontrol: oprofile 0.9.4 compiled on Nov  3 2008 06:45:57

Thank you

diff --git a/arch/x86/oprofile/op_model_ppro.c b/arch/x86/oprofile/op_model_ppro.c
index 3f1b81a..051fb16 100644
--- a/arch/x86/oprofile/op_model_ppro.c
+++ b/arch/x86/oprofile/op_model_ppro.c
@@ -131,7 +131,9 @@ static int ppro_check_ctrs(struct pt_regs * const regs,
                        continue;
                rdmsrl(msrs->counters[i].addr, val);
                if (CTR_OVERFLOWED(val)) {
+                       regs->ip -= 0x10;
                        oprofile_add_sample(regs, i);
+                       regs->ip += 0x10;
                        wrmsrl(msrs->counters[i].addr, -reset_value[i]);
                }
        }

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Oprofile : need to adjust PC by 16 bytes, Eric Dumazet, (Fri Nov 14, 8:25 am)
Re: Oprofile : need to adjust PC by 16 bytes, Andi Kleen, (Fri Nov 14, 8:59 am)
Re: Oprofile : need to adjust PC by 16 bytes, Eric Dumazet, (Fri Nov 14, 9:02 am)
Re: Oprofile : need to adjust PC by 16 bytes, Mikael Pettersson, (Fri Nov 14, 10:01 am)
Re: Oprofile : need to adjust PC by 16 bytes, Eric Dumazet, (Fri Nov 14, 10:21 am)
Re: Oprofile : need to adjust PC by 16 bytes, Andi Kleen, (Fri Nov 14, 10:50 am)
Re: Oprofile : need to adjust PC by 16 bytes, Eric Dumazet, (Sat Nov 15, 9:30 am)
Re: Oprofile : need to adjust PC by 16 bytes, Andi Kleen, (Sat Nov 15, 11:36 am)
Re: Oprofile : need to adjust PC by 16 bytes, stephane eranian, (Mon Nov 17, 8:02 am)
Re: Oprofile : need to adjust PC by 16 bytes, Eric Dumazet, (Mon Nov 17, 8:16 am)
Re: Oprofile : need to adjust PC by 16 bytes, Andi Kleen, (Mon Nov 17, 8:24 am)