lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100313124036.GA17769@elte.hu>
Date:	Sat, 13 Mar 2010 13:40:36 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Cyrill Gorcunov <gorcunov@...il.com>
Cc:	Lin Ming <ming.m.lin@...el.com>,
	Peter Zijlstra <peterz@...radead.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86,perf: Unmask LVTPC only if we have APIC supported


* Cyrill Gorcunov <gorcunov@...il.com> wrote:

> On Sat, Mar 13, 2010 at 01:24:32PM +0100, Ingo Molnar wrote:
> > 
> > * Cyrill Gorcunov <gorcunov@...nvz.org> wrote:
> > 
> > > Ingo reported
> > > |
> > > | There's a build failure on -tip with the P4 driver, on UP 32-bit, if
> > > | PERF_EVENTS is enabled but UP_APIC is disabled:
> > > |
> > > | arch/x86/built-in.o: In function `p4_pmu_handle_irq':
> > > | perf_event.c:(.text+0xa756): undefined reference to `apic'
> > > | perf_event.c:(.text+0xa76e): undefined reference to `apic'
> > > |
> > > 
> > > So we have to unmask LVTPC only if we're configured to have one.
> > > 
> > > Reported-by: Ingo Molnar <mingo@...e.hu>
> > > CC: Lin Ming <ming.m.lin@...el.com>
> > > CC: Peter Zijlstra <peterz@...radead.org>
> > > Signed-off-by: Cyrill Gorcunov <gorcunov@...nvz.org>
> > > ---
> > >  arch/x86/kernel/cpu/perf_event_p4.c |    2 ++
> > >  1 file changed, 2 insertions(+)
> > > 
> > > Index: linux-2.6.git/arch/x86/kernel/cpu/perf_event_p4.c
> > > =====================================================================
> > > --- linux-2.6.git.orig/arch/x86/kernel/cpu/perf_event_p4.c
> > > +++ linux-2.6.git/arch/x86/kernel/cpu/perf_event_p4.c
> > > @@ -365,8 +365,10 @@ static int p4_pmu_handle_irq(struct pt_r
> > >  	}
> > >  
> > >  	if (handled) {
> > > +#ifdef CONFIG_X86_LOCAL_APIC
> > >  		/* p4 quirk: unmask it again */
> > >  		apic_write(APIC_LVTPC, apic_read(APIC_LVTPC) & ~APIC_LVT_MASKED);
> > > +#endif
> > >  		inc_irq_stat(apic_perf_irqs);
> > 
> > This ugly #ifdef looks like a workaround though. Why doesnt apic_write() map 
> > to nothing in that case?
> > 
> > 	Ingo
> > 
> 
> It is. I mean -- it maps to nothing if apic is disabled. But the scenario is 
> that no apic configured at all. Actually I wonder how this code is supposed 
> to work without apic support.
> 
> Pehpaps better to make a p4 quirk helper here, since #ifdef at this point 
> looks ugly indeed.
> 
> Don't apply it then. Will back with other solution.

apic_write() is really just equivalent to a spin_lock() on UP without 
UP_IOAPIC set - it should do nothing. So if it does something and fails the 
build, then that should be fixed - not the P4 PMU code.

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ