ia64/xen-unstable

changeset 5328:0fd1b16571fb

bitkeeper revision 1.1677 (42a312b3NoXLv1fa_qVHaQXgt_JhLw)

Fix smp_call_function race (introduced a couple of days ago).
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Sun Jun 05 14:56:51 2005 +0000 (2005-06-05)
parents 84ce09862452
children c380b155f68e
files xen/arch/x86/smp.c
line diff
     1.1 --- a/xen/arch/x86/smp.c	Sun Jun 05 14:05:20 2005 +0000
     1.2 +++ b/xen/arch/x86/smp.c	Sun Jun 05 14:56:51 2005 +0000
     1.3 @@ -272,6 +272,7 @@ void smp_send_event_check_mask(cpumask_t
     1.4  struct call_data_struct {
     1.5      void (*func) (void *info);
     1.6      void *info;
     1.7 +    int wait;
     1.8      atomic_t started;
     1.9      atomic_t finished;
    1.10  };
    1.11 @@ -299,6 +300,7 @@ int smp_call_function(
    1.12  
    1.13      data.func = func;
    1.14      data.info = info;
    1.15 +    data.wait = wait;
    1.16      atomic_set(&data.started, 0);
    1.17      atomic_set(&data.finished, 0);
    1.18  
    1.19 @@ -345,17 +347,22 @@ asmlinkage void smp_event_check_interrup
    1.20  
    1.21  asmlinkage void smp_call_function_interrupt(void)
    1.22  {
    1.23 -    void (*func) (void *info) = call_data->func;
    1.24 +    void (*func)(void *info) = call_data->func;
    1.25      void *info = call_data->info;
    1.26  
    1.27      ack_APIC_irq();
    1.28      perfc_incrc(ipis);
    1.29  
    1.30 -    mb();
    1.31 -    atomic_inc(&call_data->started);
    1.32 -
    1.33 -    (*func)(info);
    1.34 -
    1.35 -    mb();
    1.36 -    atomic_inc(&call_data->finished);
    1.37 +    if ( call_data->wait )
    1.38 +    {
    1.39 +        (*func)(info);
    1.40 +        mb();
    1.41 +        atomic_inc(&call_data->finished);
    1.42 +    }
    1.43 +    else
    1.44 +    {
    1.45 +        mb();
    1.46 +        atomic_inc(&call_data->started);
    1.47 +        (*func)(info);
    1.48 +    }
    1.49  }