Re: andrea buffer code (2.2.9-C.gz)

Manfred Spraul (manfreds@colorfullife.com)
Wed, 19 May 1999 13:32:18 +0200


This is a multi-part message in MIME format.
--------------ED30D7D1EEC8FFD3D90FEA51
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Andrea Arcangeli wrote:
> >Is that really required? Have you made any profiling?
>
> If you want to SMP scale well it's needed (I don't think on a two-way SMP
> is a big issue having a per-memmap spinlock instead of a global spinlock
> but on more powerful machines it can help I think).

1 GB memory means 256.000 spinlocks. I think that's overkill regardless
of the number of CPU's.

What about
- 1 spinlock: simple.
OR:
- a hash-table with (NR_CPU*16) spinlocks?
This would limit the memory usage, scale quite well.
The only possible problem is cache line contention, but even
__cache_aligned would still save lots of memory.

BTW, I think I found a major SMP-race, I've posted it to
linux-kernel@vger.
Since your buffer code fixes parts of that problem, I've attached my
mail.

--
Manfred
--------------ED30D7D1EEC8FFD3D90FEA51
Content-Type: text/plain; charset=us-ascii;
 name="smp-race"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="smp-race"

>From - Wed May 19 13:31:34 1999 Message-ID: <37429AFE.6EE21FCE@colorfullife.com> Date: Wed, 19 May 1999 13:05:34 +0200 From: Manfred Spraul <manfreds@colorfullife.com> Reply-To: masp0008@stud.uni-sb.de X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.9 i686) X-Accept-Language: en MIME-Version: 1.0 To: linux-kernel@vger.rutgers.edu Subject: possible SMP-race, 2.2.9 & 2.3.3 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit

__global_cli() cannot stop the other processors if it is called with interrupts disabled.

arch/i386/kernel/irq.c: > A global "cli()" while in an interrupts context turns > into just a local cli(). Interrupts should use a spinlock > for the (very unlikely) case they ever want to protect > against each other.

I've added a check for that event (__global_cli() called with IF cleared), and this happens often. Do we have to fix that? (i.e. convert the callers from __global_cli() to a spinlock?)

I've found one codpath: -> ide_end_request(): acquires io_request_lock, clear local interrupts. -> calls end_that_request_first() -> calls end_buffer_io_async() <<<<<<<<<< calls cli(), needs global sync.

Regards, Manfred

--------------ED30D7D1EEC8FFD3D90FEA51--

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