Changeset c842f04 in mainline


Ignore:
Timestamp:
2005-09-01T09:19:56Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e3b9572
Parents:
f944715
Message:

Preemption work.
Instrument spinlock functions with preemption_disable() and preemption_enable() calls.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • include/synch/spinlock.h

    rf944715 rc842f04  
    3232#include <arch/types.h>
    3333#include <typedefs.h>
     34#include <preemption.h>
    3435
    3536#ifdef __SMP__
     
    4950
    5051#define spinlock_initialize(x)
    51 #define spinlock_lock(x)
    52 #define spinlock_trylock(x) 1
    53 #define spinlock_unlock(x)
     52#define spinlock_lock(x)                preemption_disable()
     53#define spinlock_trylock(x)             (preemption_disable(), 1)
     54#define spinlock_unlock(x)              preemption_enable()
    5455
    5556#endif
  • src/synch/spinlock.c

    rf944715 rc842f04  
    3232#include <arch/barrier.h>
    3333#include <synch/spinlock.h>
     34#include <preemption.h>
    3435#include <print.h>
    3536
     
    4748        __address caller = ((__u32 *) &sl)[-1];
    4849
     50        preemption_disable();
    4951        while (test_and_set(&sl->val)) {
    5052                if (i++ > 300000) {
     
    5961void spinlock_lock(spinlock_t *sl)
    6062{
     63        preemption_disable();
     64
    6165        /*
    6266         * Each architecture has its own efficient/recommended
     
    7276        int rc;
    7377       
     78        preemption_disable();
    7479        rc = !test_and_set(&sl->val);
    7580        CS_ENTER_BARRIER();
     81
     82        if (!rc)
     83                preemption_enable();
    7684       
    7785        return rc;
     
    8290        CS_LEAVE_BARRIER();
    8391        sl->val = 0;
     92        preemption_enable();
    8493}
    8594
Note: See TracChangeset for help on using the changeset viewer.