Re: Cache coherency... and locking

From: Tigran Aivazian (tigran@veritas.com)
Date: Fri Jul 21 2000 - 05:58:00 EST


Hi Linda,

You asked:

> If I am a running process, and I am looking at say, my audit mask,
> do I need to lock it?

and I assume "looking" means not just reads but potentially writes.

I am sorry if this is already answered or if you figured it out yourself
(haven't looked at all of your thread) but I would recommend reading the
Chapter 7 of volume III of Intel PIII manuals:

http://developer.intel.com/design/pentiumii/manuals/243192.htm

or at least section 7.1.1 which says that the following basic memory
operations will always be carried out atomically:

1. reading/writing a byte

2. reading/writing a word aligned on a 16-bit boundary

3. reading/writing a doubleword aligned on a 32-bit boundary.

additionally, on P6 only:

4. reading/writing a quadword aligned on a 64bit boundary

5. 16-bit access to uncached memory that fit within a 32-bit data bus

6. 16/32/64-bit access to cached memory that fit within a 32-byte cache
line

This has practical implications in coding kernel code. For example a
little module I wrote in the past called timetravel (for Linux y2k
testing) updates some entries in sys_call_table[] which is declared using
ENTRY() macro in arch/i386/kernel/entry.S. If you look at ENTRY() you will
find that it is aligned well-enough for such updates to be guaranteed to
be atomic.

Hope this helps.

Regards,
Tigran

-
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/



This archive was generated by hypermail 2b29 : Sun Jul 23 2000 - 21:00:15 EST