All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Borislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@amacapital.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	X86 ML <x86@kernel.org>, Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@redhat.com>, Robert Richter <rric@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Jan Stancek <jstancek@redhat.com>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	Sherry Hurwitz <sherry.hurwitz@amd.com>
Subject: Re: [BUG/RFC] perf test fails on AMD CPUs
Date: Wed, 19 Aug 2015 10:55:46 +0200	[thread overview]
Message-ID: <20150819085546.GA5883@krava.local> (raw)
In-Reply-To: <20150819035519.GA31385@nazgul.tnic>

On Wed, Aug 19, 2015 at 05:55:19AM +0200, Borislav Petkov wrote:
> On Tue, Aug 18, 2015 at 12:10:25PM +0200, Jiri Olsa wrote:
> > buuuuuut anyway, it looks like latest AMD firmware issue:
> > 
> > [root@amd-pike-07 ~]# cat /sys/devices/system/cpu/cpu0/microcode/version
> > 0x6000822
> > [root@amd-pike-07 perf]# ./perf test 18
> > 18: Test breakpoint overflow signal handler                  : Ok
> > 
> > [root@amd-pike-07 perf]# cat /sys/devices/system/cpu/cpu0/microcode/version
> > 0x6000832
> > [root@amd-pike-07 perf]# ./perf test 18
> > 18: Test breakpoint overflow signal handler                  : FAILED!
> > 
> > 
> > [root@amd-pike-07 ~]# cat /proc/cpuinfo 
> > processor       : 7
> > vendor_id       : AuthenticAMD
> > cpu family      : 21
> > model           : 2
> > model name      : AMD Opteron(tm) Processor 3380
> > stepping        : 0
> > microcode       : 0x6000832
> > 
> > SNIP
> 
> Whoops.
> 
> Can you please confirm with your debugging code that with version
> 0x6000822 EFLAGS.RF is set and with 0x6000832 it isn't when running the
> aforementioned test?
> 

please check the attached patch (over current tip/master a987577)


this is the perf breakpoint address:
  000000000045b260 <test_function>:

this is trace_printk output for NEW microcode 0x6000832:

DEBUG EX
            perf-893   [003] d...  1358.053633: sync_regs: sync_regs eregs ffff88012ecc7f58, regs ffff8800c9f1bf58
            perf-893   [003] d...  1358.053635: do_debug: do_debug-1 regs ffff8800c9f1bf58, eflags 217, rip 45b260
            perf-893   [003] d.h.  1358.053641: do_debug: do_debug-2 eflags 10217, rip 45b260
            perf-893   [003] d...  1358.053642: prepare_exit_to_usermode: prepare_exit_to_usermode1 regs ffff8800c9f1bf58, eflags 10217, rip 45b260
            perf-893   [003] d...  1358.053643: prepare_exit_to_usermode: prepare_exit_to_usermode3 regs ffff8800c9f1bf58, eflags 10217, rip 45b260

WORK_IRQ
 --->       perf-893   [003] d...  1358.053645: smp_irq_work_interrupt: smp_irq_work_interrupt1 regs ffff8800c9f1bf58, eflags 217, rip 45b260
            perf-893   [003] d.h.  1358.053650: perf_event_wakeup: irq_work SIGIO
            perf-893   [003] d...  1358.053651: smp_irq_work_interrupt: smp_irq_work_interrupt2 regs ffff8800c9f1bf58, eflags 217, rip 45b260

            perf-893   [003] d...  1358.053652: prepare_exit_to_usermode: prepare_exit_to_usermode1 regs ffff8800c9f1bf58, eflags 217, rip 45b260



this is trace_printk output for OLD microcode 0x6000822:

DEBUG EX
            perf-898   [005] d...    87.098816: sync_regs: sync_regs eregs ffff88012ed47f58, regs ffff8800c9c8ff58
            perf-898   [005] d...    87.098817: do_debug: do_debug-1 regs ffff8800c9c8ff58, eflags 217, rip 45b260
            perf-898   [005] d.h.    87.098823: do_debug: do_debug-2 eflags 10217, rip 45b260
            perf-898   [005] d...    87.098824: prepare_exit_to_usermode: prepare_exit_to_usermode1 regs ffff8800c9c8ff58, eflags 10217, rip 45b260
            perf-898   [005] d...    87.098825: prepare_exit_to_usermode: prepare_exit_to_usermode3 regs ffff8800c9c8ff58, eflags 10217, rip 45b260

WORK_IRQ
 --->       perf-898   [005] d...    87.098827: smp_irq_work_interrupt: smp_irq_work_interrupt1 regs ffff8800c9c8ff58, eflags 10217, rip 45b260
            perf-898   [005] d.h.    87.098832: perf_event_wakeup: irq_work SIGIO
            perf-898   [005] d...    87.098833: smp_irq_work_interrupt: smp_irq_work_interrupt2 regs ffff8800c9c8ff58, eflags 10217, rip 45b260

            perf-898   [005] d...    87.098833: prepare_exit_to_usermode: prepare_exit_to_usermode1 regs ffff8800c9c8ff58, eflags 10217, rip 45b260


thanks,
jirka


---
diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
index 80dcc92..d52d598 100644
--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -217,6 +217,8 @@ static struct thread_info *pt_regs_to_thread_info(struct pt_regs *regs)
 /* Called with IRQs disabled. */
 __visible void prepare_exit_to_usermode(struct pt_regs *regs)
 {
+	trace_printk("prepare_exit_to_usermode1 regs %p, eflags %lx, rip %lx\n", regs, regs->flags, regs->ip);
+
 	if (WARN_ON(!irqs_disabled()))
 		local_irq_disable();
 
@@ -263,6 +265,7 @@ __visible void prepare_exit_to_usermode(struct pt_regs *regs)
 	}
 
 	user_enter();
+	trace_printk("prepare_exit_to_usermode3 regs %p, eflags %lx, rip %lx\n", regs, regs->flags, regs->ip);
 }
 
 /*
diff --git a/arch/x86/kernel/irq_work.c b/arch/x86/kernel/irq_work.c
index dc5fa6a..52fe376 100644
--- a/arch/x86/kernel/irq_work.c
+++ b/arch/x86/kernel/irq_work.c
@@ -18,9 +18,13 @@ static inline void __smp_irq_work_interrupt(void)
 
 __visible void smp_irq_work_interrupt(struct pt_regs *regs)
 {
+	trace_printk("smp_irq_work_interrupt1 regs %p, eflags %lx, rip %lx\n", regs, regs->flags, regs->ip);
+
 	ipi_entering_ack_irq();
 	__smp_irq_work_interrupt();
 	exiting_irq();
+
+	trace_printk("smp_irq_work_interrupt2 regs %p, eflags %lx, rip %lx\n", regs, regs->flags, regs->ip);
 }
 
 __visible void smp_trace_irq_work_interrupt(struct pt_regs *regs)
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index da52e6b..cb199dc 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -398,6 +398,7 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig,
 	regs->ss = __USER_DS;
 	regs->cs = __USER_CS;
 
+trace_printk("__setup_rt_frame regs %p, eflags %lx, rip %lx\n", regs, regs->flags, regs->ip);
 	return 0;
 }
 #else /* !CONFIG_X86_32 */
@@ -583,6 +584,7 @@ asmlinkage long sys_rt_sigreturn(void)
 	if (restore_altstack(&frame->uc.uc_stack))
 		goto badframe;
 
+trace_printk("sys_rt_sigreturn regs %p, eflags %lx, rip %lx\n", regs, regs->flags, regs->ip);
 	return regs->ax;
 
 badframe:
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index bfc4f90..cee75d8 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -536,6 +536,7 @@ asmlinkage __visible notrace struct pt_regs *sync_regs(struct pt_regs *eregs)
 {
 	struct pt_regs *regs = task_pt_regs(current);
 	*regs = *eregs;
+trace_printk("sync_regs eregs %p, regs %p\n", eregs, regs);
 	return regs;
 }
 NOKPROBE_SYMBOL(sync_regs);
@@ -602,6 +603,8 @@ dotraplinkage void do_debug(struct pt_regs *regs, long error_code)
 	unsigned long dr6;
 	int si_code;
 
+trace_printk("do_debug-1 regs %p, eflags %lx, rip %lx\n", regs, regs->flags, regs->ip);
+
 	ist_enter(regs);
 
 	get_debugreg(dr6, 6);
@@ -677,6 +680,7 @@ dotraplinkage void do_debug(struct pt_regs *regs, long error_code)
 	debug_stack_usage_dec();
 
 exit:
+	trace_printk("do_debug-2 eflags %lx, rip %lx\n", regs->flags, regs->ip);
 	ist_exit(regs);
 }
 NOKPROBE_SYMBOL(do_debug);
diff --git a/kernel/events/core.c b/kernel/events/core.c
index ae16867..6977f20 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -4803,6 +4803,7 @@ void perf_event_wakeup(struct perf_event *event)
 
 	if (event->pending_kill) {
 		kill_fasync(perf_event_fasync(event), SIGIO, event->pending_kill);
+trace_printk("irq_work SIGIO\n");
 		event->pending_kill = 0;
 	}
 }

  reply	other threads:[~2015-08-19  8:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-16 22:29 [BUG/RFC] perf test fails on AMD CPUs Jiri Olsa
2015-08-17  4:36 ` Borislav Petkov
2015-08-17  7:33   ` Jiri Olsa
2015-08-17 16:06   ` Andy Lutomirski
2015-08-18  8:52     ` Borislav Petkov
2015-08-18 10:10     ` Jiri Olsa
2015-08-19  3:55       ` Borislav Petkov
2015-08-19  8:55         ` Jiri Olsa [this message]
2015-08-19 15:47           ` Borislav Petkov
2015-08-19 15:58             ` Jiri Olsa
2015-08-19 16:12               ` Borislav Petkov
2015-08-21  7:45                 ` Jiri Olsa
2015-08-24 22:37       ` sherry hurwitz
2015-12-10 19:26         ` Borislav Petkov

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=20150819085546.GA5883@krava.local \
    --to=jolsa@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=bp@suse.de \
    --cc=hpa@zytor.com \
    --cc=jstancek@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=rric@kernel.org \
    --cc=sherry.hurwitz@amd.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=tglx@linutronix.de \
    --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 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.