From: "Jan Beulich" Subject: Re: 2.6.32 PV Xen donU guest panic on nested call to arch_enter_lazy_mmu_mode() Date: Wed, 08 Dec 2010 08:48:06 +0000 Message-ID: <4CFF54560200007800026A7C@vpn.id2.novell.com> References: <4CFED74D.1040304@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <4CFED74D.1040304@oracle.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Chuck Anderson Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org >>> On 08.12.10 at 01:54, Chuck Anderson = wrote: > I'm posting this because I am writing a patch to fix a 2.6.32 based = PV=20 > Xen domU panic due to a nested call to arch/x86/include/asm/paravirt.h=20= > arch_enter_lazy_mmu_mode() (see details below). The following = BUG_ON()=20 > was triggered: >=20 > arch/x86/kernel/paravirt.c >=20 > static inline void enter_lazy(enum paravirt_lazy_mode mode) > { > BUG_ON(percpu_read(paravirt_lazy_mode) !=3D PARAVIRT_LAZY_NON= E); >=20 > percpu_write(paravirt_lazy_mode, mode); > } >=20 > because enter_lazy() was called twice, once through mm/memory.c=20 > copy_pte_range() and a second time through an interrupt path. >=20 > The easy fix is to disable interrupts in copy_pte_range() before = calling=20 > arch_enter_lazy_mmu_mode() and re-enable them after the call to=20 > arch_leave_lazy_mmu_mode() but I'm asking if there is a better way to=20 > handle this. If disabling interrupts is best, there are other calls = to=20 > arch_enter_lazy_mmu_mode() that appear to have the same interruption=20 > issue. It may be best then to disable interrupts in=20 > arch_enter_lazy_mmu_mode() or paravirt_enter_lazy_mmu(). I don't think this is an option, as the period of time for which you would disable interrupts could be pretty much unbounded. Instead (being a performance optimization only anyway) the BUG_ON() could be removed (accepting that the interrupted sequence would not batch any further hypercalls, and provided all of this stuff can actually be used in a nested way), the flag could be converted to a counter (again provided nesting is okay here in the first place), or a filter could be applied when actually checking whether to batch (which is what we do in our non-pvops kernels: in IRQ context, no batching happens). Jan