linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] Uni-processor interrupt state preservation.
@ 2009-07-30 16:37 Michael S. Zick
  2009-07-30 16:55 ` Roland Dreier
  0 siblings, 1 reply; 5+ messages in thread
From: Michael S. Zick @ 2009-07-30 16:37 UTC (permalink / raw)
  To: linux-kernel

In kernel/up.c - -

int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
                                int wait)
{
        unsigned long flags;

        WARN_ON(cpu != 0);

        local_irq_save(flags);
        (func)(info);
        local_irq_restore(flags);

        return 0;
}

It **looks** reasonable - - 
but:

.L2:
#APP
        # ul native_save_fl(void)
        pushf ; pop %ebx
        # native_irq_disable(void)
        cli
#NO_APP
#(insn:TI 29 27 30 (set (reg:SI 0 ax [ info ])
#        (reg/v/f:SI 4 si [orig:62 info ] [62])) 34 {*movsi_1} (insn_list:REG_DEP_TRUE 27 (nil))
#    (expr_list:REG_DEAD (reg/v/f:SI 4 si [orig:62 info ] [62])
#        (nil)))
        movl    %esi, %eax      # 29    *movsi_1/1      [length = 2]
#(call_insn:TI 30 29 43 (call (mem:QI (reg/v/f:SI 5 di [orig:61 func ] [61]) [0 S1 A8])
#        (const_int 0 [0x0])) 386 {*call_1} (insn_list:REG_DEP_TRUE 29 (insn_list:REG_DEP_TRUE 27 (nil)))
#    (expr_list:REG_DEAD (reg:SI 0 ax [ info ])
#        (expr_list:REG_DEAD (reg/v/f:SI 5 di [orig:61 func ] [61])
#            (nil)))
#    (expr_list:REG_DEP_TRUE (use (reg:SI 0 ax [ info ]))
#        (nil)))
        call    *%edi   # 30    *call_1 [length = 2]
#APP
        # native_restore_fl(ul flags)
        push %ebx ; popf
#NO_APP

Just how is the interrupt state (in ebx) supposed to be preserved across the function call?
(assembly comments where added in macros, just to clarify where this is coming from.)

Mike

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC] Uni-processor interrupt state preservation.
  2009-07-30 16:37 [RFC] Uni-processor interrupt state preservation Michael S. Zick
@ 2009-07-30 16:55 ` Roland Dreier
  2009-07-30 17:01   ` Michael S. Zick
  0 siblings, 1 reply; 5+ messages in thread
From: Roland Dreier @ 2009-07-30 16:55 UTC (permalink / raw)
  To: lkml; +Cc: linux-kernel


 > Just how is the interrupt state (in ebx) supposed to be preserved across
 > the function call?

Doesn't the i386 ABI say that ebx is preserved across function calls?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC] Uni-processor interrupt state preservation.
  2009-07-30 16:55 ` Roland Dreier
@ 2009-07-30 17:01   ` Michael S. Zick
  2009-07-30 17:14     ` Roland Dreier
  0 siblings, 1 reply; 5+ messages in thread
From: Michael S. Zick @ 2009-07-30 17:01 UTC (permalink / raw)
  To: Roland Dreier; +Cc: linux-kernel

On Thu July 30 2009, Roland Dreier wrote:
> 
>  > Just how is the interrupt state (in ebx) supposed to be preserved across
>  > the function call?
> 
> Doesn't the i386 ABI say that ebx is preserved across function calls?
> 
> 

If it does, then that is the answer to my question -
Link to the ABI document please.

Mike

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC] Uni-processor interrupt state preservation.
  2009-07-30 17:01   ` Michael S. Zick
@ 2009-07-30 17:14     ` Roland Dreier
  2009-07-30 17:51       ` Michael S. Zick
  0 siblings, 1 reply; 5+ messages in thread
From: Roland Dreier @ 2009-07-30 17:14 UTC (permalink / raw)
  To: lkml; +Cc: linux-kernel


 > If it does, then that is the answer to my question -
 > Link to the ABI document please.

www.sco.com/developers/devspecs/abi386-4.pdf:

   Registers %ebp, %ebx, %edi, %esi, and %esp ‘‘belong’’ to the cal-
   ling function. In other words, a called function must preserve these
   registers’ values for its caller.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC] Uni-processor interrupt state preservation.
  2009-07-30 17:14     ` Roland Dreier
@ 2009-07-30 17:51       ` Michael S. Zick
  0 siblings, 0 replies; 5+ messages in thread
From: Michael S. Zick @ 2009-07-30 17:51 UTC (permalink / raw)
  To: Roland Dreier; +Cc: linux-kernel

On Thu July 30 2009, Roland Dreier wrote:
> 
>  > If it does, then that is the answer to my question -
>  > Link to the ABI document please.
> 
> www.sco.com/developers/devspecs/abi386-4.pdf:
> 
>    Registers %ebp, %ebx, %edi, %esi, and %esp ‘‘belong’’ to the cal-
>    ling function. In other words, a called function must preserve these
>    registers’ values for its caller.
> 
> 

Super!

Should not be too big a job to make sure that is indeed happening as expected.
Most uses of this function dispatcher are not built in Uni-processor builds.
Only a small handful of references.

Thanks,
Mike

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-07-30 17:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-30 16:37 [RFC] Uni-processor interrupt state preservation Michael S. Zick
2009-07-30 16:55 ` Roland Dreier
2009-07-30 17:01   ` Michael S. Zick
2009-07-30 17:14     ` Roland Dreier
2009-07-30 17:51       ` Michael S. Zick

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).