From mboxrd@z Thu Jan 1 00:00:00 1970 From: Juergen Gross Subject: Re: [RFC/RFT][PATCH 0 of 3] rework locking in sched_adjust Date: Tue, 06 Dec 2011 13:39:27 +0100 Message-ID: <4EDE0CFF.3000203@ts.fujitsu.com> References: <1322060131.30168.15.camel@Abyss> <4EDDD485.70208@ts.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: George Dunlap Cc: Dario Faggioli , xen-devel@lists.xensource.com, Keir Fraser List-Id: xen-devel@lists.xenproject.org On 12/06/2011 01:30 PM, George Dunlap wrote: > On Tue, Dec 6, 2011 at 8:38 AM, Juergen Gross > wrote: >> (XEN) Xen BUG at spinlock.c:47 > [snip] >> (XEN) Xen call trace: >> (XEN) [] check_lock+0x44/0x50 >> (XEN) [] _spin_lock+0x11/0x5d >> (XEN) [] xmem_pool_alloc+0x138/0x4d2 >> (XEN) [] _xmalloc+0x138/0x230 >> (XEN) [] _xzalloc+0x11/0x2d >> (XEN) [] sedf_adjust+0x37c/0x9b2 >> (XEN) [] sched_adjust+0x5f/0xb7 >> (XEN) [] do_domctl+0xf32/0x1a9f >> (XEN) [] syscall_enter+0xc8/0x122 > Hmm, looks like the problem is that we assert that locks must be > called with IRQs enabled all the time, or never. From > xen/common/spinlock.c: > > * We partition locks into IRQ-safe (always held with IRQs disabled) and > * IRQ-unsafe (always held with IRQs enabled) types. The convention for > * every lock must be consistently observed else we can deadlock in > * IRQ-context rendezvous functions (a rendezvous which gets every CPU > * into IRQ context before any CPU is released from the rendezvous). > > sedf_adj() grabs the private lock with irqs disabled, then calls > sedf_adjust_weights(), which calls xmalloc to allocate some local > scratch space, which ultimately grabs a non-IRQ spinlock. > > Not sure the best thing to do here... sedf_adjust_weights() is called only from sedf_adj(). The easiest solution would be to xmalloc the scratch space in sedf_adj() before grabbing the lock and passing the xmalloced area to sedf_adjust_weights(). Juergen -- Juergen Gross Principal Developer Operating Systems PDG ES&S SWE OS6 Telephone: +49 (0) 89 3222 2967 Fujitsu Technology Solutions e-mail: juergen.gross@ts.fujitsu.com Domagkstr. 28 Internet: ts.fujitsu.com D-80807 Muenchen Company details: ts.fujitsu.com/imprint.html