Changeset 4ffa9e0 in mainline


Ignore:
Timestamp:
2005-02-23T11:48:52Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3418c41
Parents:
b109ebb
Message:

New IPI for waking up idle CPU's halted in scheduler.
Added architecture-independent ipi_broadcast().

Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • arch/ia32/Makefile.inc

    rb109ebb r4ffa9e0  
    2727        arch/smp/mp.c \
    2828        arch/smp/atomic.S \
     29        arch/smp/ipi.c \
    2930        arch/ia32.c \
    3031        arch/interrupt.c \
  • arch/ia32/include/interrupt.h

    rb109ebb r4ffa9e0  
    5959#define VECTOR_KBD              (IVT_IRQBASE+IRQ_KBD)
    6060
    61 #define VECTOR_SYSCALL          (IVT_FREEBASE+0)
    62 #define VECTOR_TLB_SHOOTDOWN    (IVT_FREEBASE+1)
     61#define VECTOR_SYSCALL                  (IVT_FREEBASE+0)
     62#define VECTOR_TLB_SHOOTDOWN_IPI        (IVT_FREEBASE+1)
     63#define VECTOR_WAKEUP_IPI               (IVT_FREEBASE+2)
    6364
    6465typedef void (* iroutine)(__u8 n, __u32 stack[]);
     
    7980extern void syscall(__u8 n, __u32 stack[]);
    8081extern void tlb_shootdown_ipi(__u8 n, __u32 stack[]);
     82extern void wakeup_ipi(__u8 n, __u32 stack[]);
    8183
    8284extern void trap_virtual_enable_irqs(__u16 irqmask);
  • arch/ia32/src/ia32.c

    rb109ebb r4ffa9e0  
    5959               
    6060                #ifdef __SMP__
    61                 trap_register(VECTOR_TLB_SHOOTDOWN, tlb_shootdown_ipi);
     61                trap_register(VECTOR_TLB_SHOOTDOWN_IPI, tlb_shootdown_ipi);
     62                trap_register(VECTOR_WAKEUP_IPI, wakeup_ipi);
    6263                #endif /* __SMP__ */
    6364        }
  • arch/ia32/src/interrupt.c

    rb109ebb r4ffa9e0  
    101101}
    102102
     103void wakeup_ipi(__u8 n, __u32 stack[])
     104{
     105        trap_virtual_eoi();
     106}
     107
    103108void trap_virtual_enable_irqs(__u16 irqmask)
    104109{
  • arch/ia32/src/mm/tlb.c

    rb109ebb r4ffa9e0  
    3030#include <arch/asm.h>
    3131
    32 #ifdef __SMP__
    33 #include <arch/apic.h>
    34 #include <arch/interrupt.h>
    35 #endif /* __SMP__ */
    36 
    3732void tlb_invalidate(int asid)
    3833{
    3934        cpu_write_dba(cpu_read_dba());
    4035}
    41 
    42 #ifdef __SMP__
    43 void tlb_shootdown_ipi_send(void)
    44 {
    45         (void) l_apic_broadcast_custom_ipi(VECTOR_TLB_SHOOTDOWN);
    46 }
    47 #endif /* __SMP__ */
  • src/mm/tlb.c

    rb109ebb r4ffa9e0  
    2828
    2929#include <mm/tlb.h>
     30#include <smp/ipi.h>
    3031#include <synch/spinlock.h>
    3132#include <typedefs.h>
    3233#include <arch/atomic.h>
     34#include <arch/interrupt.h>
    3335#include <config.h>
    3436
     
    6062}
    6163
     64void tlb_shootdown_ipi_send(void)
     65{
     66        ipi_broadcast(VECTOR_TLB_SHOOTDOWN_IPI);
     67}
     68
    6269void tlb_shootdown_ipi_recv(void)
    6370{
  • src/proc/thread.c

    rb109ebb r4ffa9e0  
    4646#include <time/clock.h>
    4747#include <list.h>
     48#include <config.h>
     49
     50#ifdef __SMP__
     51#include <arch/interrupt.h>
     52#include <arch/apic.h>
     53#endif /* __SMP__ */
    4854
    4955char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"};
     
    8995        runq_t *r;
    9096        pri_t pri;
    91         int i;
     97        int i, avg, send_ipi = 0;
    9298
    9399        pri = cpu_priority_high();
     
    113119
    114120        spinlock_lock(&nrdylock);
    115         nrdy++;
     121        avg = ++nrdy / config.cpu_active;
    116122        spinlock_unlock(&nrdylock);
    117123
    118124        spinlock_lock(&cpu->lock);
    119         cpu->nrdy++;
     125        if ((++cpu->nrdy) > avg && (config.cpu_active == config.cpu_count)) {
     126                /*
     127                 * If there are idle halted CPU's, this will wake them up.
     128                 */
     129                #ifdef __SMP__
     130                l_apic_broadcast_custom_ipi(VECTOR_WAKEUP_IPI);
     131                #endif /* __SMP__  */
     132        }       
    120133        spinlock_unlock(&cpu->lock);
    121134   
Note: See TracChangeset for help on using the changeset viewer.