Hi all,
The arch/x86_64/kernel/entry-xen.S linux-2.6-xen.hg contains:
sysret_careful:
	CFI_RESTORE_STATE
	bt $TIF_NEED_RESCHED,%edx
	jnc sysret_signal
        XEN_BLOCK_EVENTS(%rsi)	
<<<<<<<<<<<<<<
	pushq %rdi
	CFI_ADJUST_CFA_OFFSET 8
	call schedule
	popq  %rdi
	CFI_ADJUST_CFA_OFFSET -8
	jmp sysret_check
sret_careful:
The equivalent non-Xen chunk is:
sysret_careful:
	CFI_RESTORE_STATE
	bt $TIF_NEED_RESCHED,%edx
	jnc sysret_signal
	TRACE_IRQS_ON
	sti				<<<<<<<<<<<<<<
	pushq %rdi
	CFI_ADJUST_CFA_OFFSET 8
	call schedule
	popq  %rdi
	CFI_ADJUST_CFA_OFFSET -8
	jmp sysret_check
Note the marked lines --- Xen is turning irqs _off_ at this point, when
non-Xen is turning them on.  I just noticed it when merging the
irqtracing code.
Bug?
--Stephen
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
On 15 Jul 2006, at 16:38, Stephen C. Tweedie wrote:> Note the marked lines --- Xen is turning irqs _off_ at this point, when > non-Xen is turning them on. I just noticed it when merging the > irqtracing code. > > Bug?Definitely -- we shouldn''t enter schedule() with interrupts disabled. I think entry-xen.S needs an audit for this kind of thing. Just a few lines above this bug we XEN_UNBLOCK_EVENTS() where we shouldn''t (race to userspace against schedule/signals), and that''s probably unnecessary since we will return to userspace via the IRET hypercall which will safely atomically reenable interrupts anyway. I haven''t currently time to patch and test these problems -- if you can do it quicker and post a patch that would be very handy. Thanks, Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Looks like it should be XEN_UNBLOCK_EVENTS.
Jun
---
Intel Open Source Technology Center 
-----Original Message-----
From: xen-devel-bounces@lists.xensource.com
[mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Stephen C.
Tweedie
Sent: Saturday, July 15, 2006 8:38 AM
To: xen-devel@lists.xensource.com
Subject: [Xen-devel] Xen scheduling bug?
Hi all,
The arch/x86_64/kernel/entry-xen.S linux-2.6-xen.hg contains:
sysret_careful:
	CFI_RESTORE_STATE
	bt $TIF_NEED_RESCHED,%edx
	jnc sysret_signal
        XEN_BLOCK_EVENTS(%rsi)	
<<<<<<<<<<<<<<
	pushq %rdi
	CFI_ADJUST_CFA_OFFSET 8
	call schedule
	popq  %rdi
	CFI_ADJUST_CFA_OFFSET -8
	jmp sysret_check
sret_careful:
The equivalent non-Xen chunk is:
sysret_careful:
	CFI_RESTORE_STATE
	bt $TIF_NEED_RESCHED,%edx
	jnc sysret_signal
	TRACE_IRQS_ON
	sti				<<<<<<<<<<<<<<
	pushq %rdi
	CFI_ADJUST_CFA_OFFSET 8
	call schedule
	popq  %rdi
	CFI_ADJUST_CFA_OFFSET -8
	jmp sysret_check
Note the marked lines --- Xen is turning irqs _off_ at this point, when
non-Xen is turning them on.  I just noticed it when merging the
irqtracing code.
Bug?
--Stephen
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Hi, On Sat, 2006-07-15 at 09:41 -0700, Nakajima, Jun wrote:> Looks like it should be XEN_UNBLOCK_EVENTS.> -----Original Message-----> sysret_careful: > CFI_RESTORE_STATE > bt $TIF_NEED_RESCHED,%edx > jnc sysret_signal > XEN_BLOCK_EVENTS(%rsi) <<<<<<<<<<<<<<Agreed. Can you put a patch together for the list? I''m packing for OLS right now... Thanks, Stephen _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel