[PATCH] Re: [discuss] Re: preempt_conditional_{sti,cli} use

Andi Kleen ak at suse.de
Wed May 10 11:30:37 CEST 2006


On Wednesday 10 May 2006 09:31, Jan Beulich wrote:
> >>> Andi Kleen <ak at suse.de> 09.05.06 15:16 >>>
> >On Tuesday 09 May 2006 14:45, Jan Beulich wrote:
> >> One question though - would you then want to use this unconditionally in do_trap(), or would you want this to be
> done
> >> only when in fact running on an IST stack? Jan
> >
> >Only on an IST stack to keep interrupt off times short.
> 
> Expand the use of preempt_conditional_{sti,cli} to all cases where interrupts
> are to be re-enabled during exception handling while running on an IST stack.
> 
> Signed-off-by: Jan Beulich <jbeulich at novell.com>
> Cc: John Blackwood <john.blackwood at ccur.com>
> 
> --- linux-2.6.17-rc3/arch/x86_64/kernel/traps.c	2006-04-27 17:49:34.000000000 +0200
> +++ 2.6.17-rc3-x86_64-preempt-conditional-sti-cli/arch/x86_64/kernel/traps.c	2006-05-09 17:34:52.000000000 +0200
> @@ -472,8 +472,21 @@ static void __kprobes do_trap(int trapnr
>  			      siginfo_t *info)
>  {
>  	struct task_struct *tsk = current;
> +	int restore;
>  
> -	conditional_sti(regs);
> +	switch (trapnr) {
> +	/* When running on an IST stack, preemption must be disabled
> +	   whenever interrupts are enabled. */
> +	case 3:
> +	case 12:
> +		preempt_conditional_sti(regs);
> +		restore = 1;
> +		break;
> +	default:
> +		conditional_sti(regs);
> +		restore = 0;
> +		break;
> +	}

That would be better done in the caller macros, no?

Also I assume you checked all the code in there if it won't block?


-Andi



More information about the discuss mailing list