Re: locking structures in the kernel

Richard Guy Briggs (rgb@conscoop.ottawa.on.ca)
Fri, 1 Oct 1999 10:32:23 -0400 (EDT)


-----BEGIN PGP SIGNED MESSAGE-----

> Hi,
>
> You said (in particular):
>
> > Another technique I have seen is to wrap the code in cli() sti() pairs
> > to protect it from being used while being modified, but I understand
> > this is a uniprocessor technique which should be deprecated? Also, I
> > have most often seen it used in conjunction with saving and restoring
> > flags. Details? Opinions?
>
> All the details are in Documentation/spinlocks.txt which every honest
> individual should study (Three Lessons of Linus). Specifically, if you
> have a case where both interrupt and non-interrupt (e.g. ioctl())
> code access the same data structures then you should use
> spin_lock_irqsave() in the non-interrupt code and spin_lock() in the
> interrupt handler as in:

This stuff is *very* clear and your patch make it even more so!
Thanks!

> In UP case, these will be reduced to save_flags(),cli/restore_flags() that
> you mentioned.

In this UP case, what happenned to the named lock? That was the
interesting part.

Now, in retrocomputing, what do I use in 2.0.38? I am supporting code
with compiler directives to support 3 major kernel versions. There is
no text in the 'Documentation' directory, except for file locks. I
have found include/asm/locks.h and include/asm/semaphore.h and am
looking for examples in the code.

> Tigran A. Aivazian | http://www.sco.com

slainte mhath, RGB
- --
Richard Guy Briggs -- PGP key available Auto-Free Ottawa! Canada
<http://www.conscoop.ottawa.on.ca/rgb/> </www.flora.org/afo/>
Prevent Internet Wiretapping! -- FreeS/WAN:<www.xs4all.nl/~freeswan>
Thanks for voting Green! -- <green.ca> Marillion:<www.marillion.co.uk>

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv

iQCVAwUBN/TF9d+sBuIhFagtAQEunwQAn7k4PrjpnbfZcuZj+wedUyOlNV8BoQWF
ntPRLO02WfXje5Yu/0eGu38+xNgEIC7R0nF6lBdnb2mUQuOlMKAO7JPe5sndjMKb
UKovAAoss9s+CRXtc6ptsvtIVHsjOFiJhlhy/uLl5THjVoDvTQuE67+dSWQC7tR+
M+5XNKj3zdc=
=Fvyi
-----END PGP SIGNATURE-----

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/