From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752799Ab2GIJYq (ORCPT ); Mon, 9 Jul 2012 05:24:46 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:57321 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752238Ab2GIJYo (ORCPT ); Mon, 9 Jul 2012 05:24:44 -0400 Date: Mon, 9 Jul 2012 11:24:36 +0200 From: Ingo Molnar To: "Michael S. Tsirkin" Cc: Marcelo Tosatti , "H. Peter Anvin" , Avi Kivity , Randy Dunlap , Stephen Rothwell , x86@kernel.org, kvm@vger.kernel.org, linux-next@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar Subject: Re: [PATCH] apic: fix kvm build on UP without IOAPIC Message-ID: <20120709092436.GD2901@gmail.com> References: <20120701150506.GA31304@redhat.com> <4FF0849D.5080406@zytor.com> <20120706111314.GG19552@gmail.com> <20120706113209.GB18059@amt.cnet> <20120706141222.GA23400@gmail.com> <20120708205625.GA5292@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120708205625.GA5292@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Michael S. Tsirkin wrote: > On Fri, Jul 06, 2012 at 04:12:23PM +0200, Ingo Molnar wrote: > > > > * Marcelo Tosatti wrote: > > > > > On Fri, Jul 06, 2012 at 01:13:14PM +0200, Ingo Molnar wrote: > > > > > > > > * H. Peter Anvin wrote: > > > > > > > > > On 07/01/2012 08:05 AM, Michael S. Tsirkin wrote: > > > > > >On UP i386, when APIC is disabled > > > > > ># CONFIG_X86_UP_APIC is not set > > > > > ># CONFIG_PCI_IOAPIC is not set > > > > > > > > > > > >code looking at apicdrivers never has any effect but it > > > > > >still gets compiled in. In particular, this causes > > > > > >build failures with kvm, but it generally bloats the kernel > > > > > >unnecessarily. > > > > > > > > > > > >Fix by defining both __apicdrivers and __apicdrivers_end > > > > > >to be NULL when CONFIG_X86_LOCAL_APIC is unset: I verified > > > > > >that as the result any loop scanning __apicdrivers gets optimized out by > > > > > >the compiler. > > > > > > > > > > > >Warning: a .config with apic disabled doesn't seem to boot > > > > > >for me (even without this patch). Still verifying why, > > > > > >meanwhile this patch is compile-tested only. > > > > > > > > > > > >Signed-off-by: Michael S. Tsirkin > > > > > >--- > > > > > > > > > > > >Note: if this patch makes sense, can x86 maintainers > > > > > >please ACK applying it through the kvm tree, since that is > > > > > >where we see the issue that it addresses? > > > > > >Avi, Marcelo, maybe you can carry this in kvm/linux-next as a temporary > > > > > >measure so that linux-next builds? > > > > > > > > > > > > > > > > I'm not happy about that as a workflow, but since you guys have an > > > > > immediate problem I guess we can do that. > > > > > > > > I'm rather unhappy about this workflow - we've got quite a few > > > > apic bits in the x86 tree this cycle as well and need extra > > > > external interaction, not. > > > > > > > > Which KVM tree commit caused this, could someone please give a > > > > lkml link or quote it here? It's not referenced in the fix patch > > > > either. > > > > > > > > Thanks, > > > > > > > > Ingo > > > > > > This tree (kvm.git next): > > > > > > http://git.kernel.org/?p=virt/kvm/kvm.git;a=shortlog;h=refs/heads/next > > > > > > Introduced by this commit: > > > > > > http://git.kernel.org/?p=virt/kvm/kvm.git;a=commit;h=ab9cf4996bb989983e73da894b8dd0239aa2c3c2 > > > > This bit: > > > > > + if (kvm_para_has_feature(KVM_FEATURE_PV_EOI)) { > > > + struct apic **drv; > > > + > > > + for (drv = __apicdrivers; drv < __apicdrivers_end; drv++) { > > > + /* Should happen once for each apic */ > > > + WARN_ON((*drv)->eoi_write == kvm_guest_apic_eoi_write); > > > + (*drv)->eoi_write = kvm_guest_apic_eoi_write; > > > + } > > > + } > > > + > > > > is rather disgusting I have to say. > > > > WTH is the KVM code meddling with core x86 apic driver data > > structures directly? At minimum factor this out and create a > > proper apic.c function which is EXPORT_SYMBOL_GPL() exported or > > so... > > > > Thanks, > > > > Ingo > > OK, so apic_set_eoi_write()? Yes, with a changelog comment analyzing the design decisions and locking here - what happens if actual APIC driver use races with this update on SMP, why is it all safe, etc? Thanks, Ingo