Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 9 → Rev 10

/SPARTAN/trunk/include/smp/ipi.h
31,6 → 31,9
 
#ifdef __SMP__
extern void ipi_broadcast(int ipi);
extern void ipi_broadcast_arch(int ipi);
#else
#define ipi_broadcast(x) ;
#endif /* __SMP__ */
 
#endif
/SPARTAN/trunk/src/smp/ipi.c
0,0 → 1,46
/*
* Copyright (C) 2005 Jakub Jermar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#ifdef __SMP__
 
#include <smp/ipi.h>
#include <config.h>
 
void ipi_broadcast(int ipi)
{
/*
* Provisions must be made to avoid sending IPI:
* - before all CPU's were configured to accept the IPI
* - if there is only one CPU but the kernel was compiled with __SMP__
*/
 
if ((config.cpu_active > 1) && (config.cpu_active == config.cpu_count))
ipi_broadcast_arch(ipi);
}
 
#endif /* __SMP__ */
/SPARTAN/trunk/src/proc/thread.c
46,11 → 46,8
#include <time/clock.h>
#include <list.h>
#include <config.h>
 
#ifdef __SMP__
#include <arch/interrupt.h>
#include <arch/apic.h>
#endif /* __SMP__ */
#include <smp/ipi.h>
 
char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"};
 
122,13 → 119,11
spinlock_unlock(&nrdylock);
 
spinlock_lock(&cpu->lock);
if ((++cpu->nrdy) > avg && (config.cpu_active == config.cpu_count)) {
if ((++cpu->nrdy) > avg) {
/*
* If there are idle halted CPU's, this will wake them up.
*/
#ifdef __SMP__
ipi_broadcast(VECTOR_WAKEUP_IPI);
#endif /* __SMP__ */
}
spinlock_unlock(&cpu->lock);
/SPARTAN/trunk/src/Makefile
24,7 → 24,8
synch/rwlock.c \
synch/mutex.c \
synch/semaphore.c \
synch/waitq.c
synch/waitq.c \
smp/ipi.c
 
ifdef DEBUG_SPINLOCK
CFLAGS+=-D$(DEBUG_SPINLOCK)
/SPARTAN/trunk/arch/ia32/src/smp/ipi.c
31,7 → 31,7
#include <smp/ipi.h>
#include <arch/apic.h>
 
void ipi_broadcast(int ipi)
void ipi_broadcast_arch(int ipi)
{
(void) l_apic_broadcast_custom_ipi((__u8) ipi);
}