History log of /xv6-public/spinlock.c (Results 1 – 25 of 60)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: xv6-rev11
# 1d19081e 30-Aug-2018 Frans Kaashoek <kaashoek@mit.edu>

Allow holding to be called with interrupts enabled (for Mark Morrissey).


# abf847a0 31-Jan-2017 Frans Kaashoek <kaashoek@mit.edu>

Start of an experiment to remove the use of gs for cpu local variables.


# 469aa8b9 15-Sep-2016 Robert Morris <rtm@csail.mit.edu>

xx


# 6cec0211 14-Sep-2016 Frans Kaashoek <kaashoek@mit.edu>

Update comment a bit.


# 34c2efc1 08-Sep-2016 Robert Morris <rtm@csail.mit.edu>

use asm() for lock release, not a C assignment


Revision tags: xv6-rev9
# bc8221a5 02-Sep-2016 Robert Morris <rtm@csail.mit.edu>

comment about sched() saving/restoring cpu->intena


# 7894fcd2 25-Aug-2016 Frans Kaashoek <kaashoek@mit.edu>

Remove trailing white space with:
for f in *.{h,c}; do sed -i .sed 's/[[:blank:]]*$//' $f; done
(Thanks to Nicolás Wolovick)


# 20d05d44 12-Aug-2016 Robert Morris <rtm@csail.mit.edu>

separate atomic test-and-set from memory barrier.
* use xchg only for its atomicness.
* use __sync_synchronize() for both CPU and compiler barrier.


Revision tags: xv6-rev8, xv6-rev7, osdi12-submit, xv6-rev6
# 1ddfbbb1 29-Aug-2011 Frans Kaashoek <kaashoek@26-4-190.dynamic.csail.mit.edu>

Revert "Introduce and use sleeplocks instead of BUSY flags"
My changes have a race with re-used bufs and the code doesn't seem to get shorter
Keep the changes that fixed ip->off race

This reverts co

Revert "Introduce and use sleeplocks instead of BUSY flags"
My changes have a race with re-used bufs and the code doesn't seem to get shorter
Keep the changes that fixed ip->off race

This reverts commit 3a5fa7ed9020eaf8ab843a16d26db7393b2ec072.

Conflicts:

defs.h
file.c
file.h

show more ...


# 3a5fa7ed 26-Aug-2011 Frans Kaashoek <kaashoek@Frans-Kaashoeks-MacBook-Pro.local>

Introduce and use sleeplocks instead of BUSY flags
Remove I_BUSY, B_BUSY, and intrans defs and usages
One spinlock per buf to avoid ugly loop in bget
fix race in filewrite (don't update f->off after

Introduce and use sleeplocks instead of BUSY flags
Remove I_BUSY, B_BUSY, and intrans defs and usages
One spinlock per buf to avoid ugly loop in bget
fix race in filewrite (don't update f->off after releasing lock)

show more ...


# 9aa0337d 29-Jul-2011 Frans Kaashoek <kaashoek@Frans-Kaashoeks-MacBook-Pro.local>

Map kernel high
Very important to give qemu memory through PHYSTOP :(


Revision tags: xv6-rev5
# 1a81e38b 11-Jan-2011 Russ Cox <rsc@swtch.com>

make new code like old code

Variable declarations at top of function,
separate from initialization.

Use == 0 instead of ! for checking pointers.

Consistent spacing around {, *, casts.

Declare 0-p

make new code like old code

Variable declarations at top of function,
separate from initialization.

Use == 0 instead of ! for checking pointers.

Consistent spacing around {, *, casts.

Declare 0-parameter functions as (void) not ().

Integer valued functions return -1 on failure, 0 on success.

show more ...


# faad047a 13-Sep-2010 Robert Morris <rtm@csail.mit.edu>

change some comments, maybe more informative
delete most comments from bootother.S (since copy of bootasm.S)
ksegment() -> seginit()
move more stuff from main() to mainc()


Revision tags: xv6-2010, xv6-rev4
# 74c82bc1 02-Jul-2010 Frans Kaashoek <kaashoek@fransk-6.local>

nits


# 40889627 02-Jul-2010 Frans Kaashoek <kaashoek@fransk-6.local>

Initial version of single-cpu xv6 with page tables


Revision tags: xv6-rev3
# 48755214 31-Aug-2009 Russ Cox <rsc@swtch.com>

assorted fixes:
* rename c/cp to cpu/proc
* rename cpu.context to cpu.scheduler
* fix some comments
* formatting for printout


# b121486c 12-Jul-2009 Russ Cox <rsc@swtch.com>

spinlock: rename parameter lock -> lk


# 19333efb 31-May-2009 rsc <rsc>

Some proc cleanup, moving some of copyproc into allocproc.

Also, an experiment: use "thread-local" storage for c and cp
instead of the #define macro for curproc[cpu()].


# 21575761 08-Mar-2009 rsc <rsc>

be consistent: no underscores in function names


# c780dbf9 12-Oct-2008 kolya <kolya>

include explicitly initialized globals (int x = 0;) in cross-refs,
also thanks to greg price.


# be38c841 28-Sep-2008 rtm <rtm>

document lock->locked=0 vs xchg(&lock->locked, 0)


Revision tags: xv6-2008
# 943fd378 01-Oct-2007 rsc <rsc>

Incorporate new understanding of/with Intel SMP spec.

Dropped cmpxchg in favor of xchg, to match lecture notes.

Use xchg to release lock, for future protection and to
keep gcc from acting clever.


# 9fd9f804 30-Sep-2007 rsc <rsc>

Re: why cpuid() in locking code?

rtm wrote:
> Why does acquire() call cpuid()? Why does release() call cpuid()?

The cpuid in acquire is redundant with the cmpxchg, as you said.
I have removed the c

Re: why cpuid() in locking code?

rtm wrote:
> Why does acquire() call cpuid()? Why does release() call cpuid()?

The cpuid in acquire is redundant with the cmpxchg, as you said.
I have removed the cpuid from acquire.

The cpuid in release is actually doing something important,
but not on the hardware. It keeps gcc from reordering the
lock->locked assignment above the other two during optimization.
(Not that current gcc -O2 would choose to do that, but it is allowed to.)
I have replaced the cpuid in release with a "gcc barrier" that
keeps gcc from moving things around but has no hardware effect.

On a related note, I don't think the cpuid in mpmain is necessary,
for the same reason that the cpuid wasn't needed in release.

As to the question of whether

acquire();
x = protected;
release();

might read protected after release(), I still haven't convinced
myself whether it can. I'll put the cpuid back into release if
we determine that it can.

Russ

show more ...


# ab08960f 27-Sep-2007 rsc <rsc>

Final word on the locking fiasco?

Change pushcli / popcli so that they can never turn on
interrupts unexpectedly. That is, if interrupts are on,
then pushcli(); popcli(); turns them off and back on

Final word on the locking fiasco?

Change pushcli / popcli so that they can never turn on
interrupts unexpectedly. That is, if interrupts are on,
then pushcli(); popcli(); turns them off and back on, but
if they are off to begin with, then pushcli(); popcli(); is
a no-op.

I think our fundamental mistake was having a primitive
(release and then popcli nee spllo) that could turn
interrupts on at unexpected moments instead of being
explicit about when we want to start allowing interrupts.

With the new semantics, all the manual fiddling of ncli
to force interrupts off in certain sections goes away.
In return, we must explicitly mark the places where
we want to enable interrupts unconditionally, by calling sti().
There is only one: inside the scheduler loop.

show more ...


# 3807c1f2 27-Sep-2007 rsc <rsc>

rename splhi/spllo to pushcli/popcli


123