X-MimeOLE: Produced By Microsoft Exchange V6.5
Received: by onstor-exch02.onstor.net 
	id <01C7D2C6.ADD9CB50@onstor-exch02.onstor.net>; Mon, 30 Jul 2007 08:28:36 -0800
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C7D2C6.ADD9CB50"
Content-class: urn:content-classes:message
Subject: RE: SMP FC locking - version 3
Date: Mon, 30 Jul 2007 08:28:36 -0800
Message-ID: <BB375AF679D4A34E9CA8DFA650E2B04E04AFB02F@onstor-exch02.onstor.net>
In-Reply-To: <BB375AF679D4A34E9CA8DFA650E2B04E018A69D3@onstor-exch02.onstor.net>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: SMP FC locking - version 3
Thread-Index: AcfLI2WbSODYorRwRPa2C6RVMJ0hMQAA2evwAAAZjjAAACfg0AD5asJAAAGbSSAAJVV+kAA8eXmQAIo5A1A=
References: <BB375AF679D4A34E9CA8DFA650E2B04E04AFA695@onstor-exch02.onstor.net> <BB375AF679D4A34E9CA8DFA650E2B04E018A69D3@onstor-exch02.onstor.net>
From: "Maxim Kozlovsky" <maxim.kozlovsky@onstor.com>
To: "Jeff Miller" <jeff.miller@onstor.com>,
	"dl-Cougar" <dl-Cougar@onstor.com>

This is a multi-part message in MIME format.

------_=_NextPart_001_01C7D2C6.ADD9CB50
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable



_____________________________________________
From: Jeff Miller=20
Sent: Friday, July 27, 2007 3:22 PM
To: Maxim Kozlovsky; dl-Cougar
Subject: RE: SMP FC locking - version 3


A second set of per port spin locks protects port control structure and
hardware access.  The polling functions use trylock - if the lock is
acquired the port is checked, otherwise return without doing anything.
The timer functions use spinlock and will wait to gain access to the
port.  If this turns out to have significant performance impact then an
alternative is to have the timer functions do nothing except note that
some operation should be done by a polling function.
[MK] Let's do the right thing from the beginning with the timers.
First, the problem with the timers is not only the locking, but giving
out the pointer without ensuring the pointer lifetime. This is the same
problem as we already discussed, you can not get the lock if you did not
ensure that the structure the lock is embedded into is valid and
continues to be valid while the timer routine is running. Ideally the
timer should receive a smHandle and all it should do is send an event.
The majority of the timer routines already do. Second, I don't want the
timers sit there waiting on the lock for a long time anyway. In the
current software the timers are processed on one CPU only, if the timer
routine waits on the lock for a long time you not only locking out one
CPU, which is just performance problems, but prevent the timers from
running at all.



------_=_NextPart_001_01C7D2C6.ADD9CB50
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
6.5.7652.24">
<TITLE>RE: SMP FC locking - version 3</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P DIR=3DLTR><SPAN LANG=3D"en-us"></SPAN><SPAN =
LANG=3D"en-us"></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"></SPAN><SPAN =
LANG=3D"en-us"></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"></SPAN><SPAN LANG=3D"en-us"><FONT =
SIZE=3D2 =
FACE=3D"Tahoma">_____________________________________________<BR>
</FONT></SPAN><SPAN LANG=3D"en-us"><B></B></SPAN><SPAN =
LANG=3D"en-us"><B><FONT SIZE=3D2 =
FACE=3D"Tahoma">From:</FONT></B></SPAN><SPAN LANG=3D"en-us"></SPAN><SPAN =
LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Tahoma"> Jeff Miller<BR>
</FONT></SPAN><SPAN LANG=3D"en-us"><B></B></SPAN><SPAN =
LANG=3D"en-us"><B><FONT SIZE=3D2 =
FACE=3D"Tahoma">Sent:</FONT></B></SPAN><SPAN LANG=3D"en-us"></SPAN><SPAN =
LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Tahoma"> Friday, July 27, 2007 =
3:22 PM<BR>
</FONT></SPAN><SPAN LANG=3D"en-us"><B></B></SPAN><SPAN =
LANG=3D"en-us"><B><FONT SIZE=3D2 =
FACE=3D"Tahoma">To:</FONT></B></SPAN><SPAN LANG=3D"en-us"></SPAN><SPAN =
LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Tahoma"> Maxim Kozlovsky; =
dl-Cougar<BR>
</FONT></SPAN><SPAN LANG=3D"en-us"><B></B></SPAN><SPAN =
LANG=3D"en-us"><B><FONT SIZE=3D2 =
FACE=3D"Tahoma">Subject:</FONT></B></SPAN><SPAN =
LANG=3D"en-us"></SPAN><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Tahoma"> RE: SMP FC locking - version 3</FONT></SPAN><SPAN =
LANG=3D"en-us"></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"></SPAN><SPAN =
LANG=3D"en-us"></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT COLOR=3D"#000080" SIZE=3D2 =
FACE=3D"Arial">A second set of per port spin locks protects port control =
structure and hardware access.&nbsp; The polling functions use trylock - =
if the lock is acquired the port is checked, otherwise return without =
doing anything.&nbsp; The timer functions use spinlock and will wait to =
gain access to the port.&nbsp; If this turns out to have significant =
performance impact then an alternative is to have the timer functions do =
nothing except note that some operation should be done by a polling =
function.</FONT></SPAN><SPAN LANG=3D"en-us"></SPAN><SPAN =
LANG=3D"en-us"></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><B><I></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I><FONT COLOR=3D"#000080" SIZE=3D2 =
FACE=3D"Arial">[MK]</FONT></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I></I></B></SPAN><SPAN LANG=3D"en-us"><B><I> <FONT =
COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">Let</FONT></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I></I></B></SPAN><SPAN LANG=3D"en-us"><B><I><FONT =
COLOR=3D"#000080" SIZE=3D2 =
FACE=3D"Arial">&#8217;</FONT></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I></I></B></SPAN><SPAN LANG=3D"en-us"><B><I><FONT =
COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">s</FONT></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I></I></B></SPAN><SPAN LANG=3D"en-us"><B><I><FONT =
COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial"> do the right thing from =
the</FONT></I></B></SPAN><SPAN LANG=3D"en-us"><B><I></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I> <FONT COLOR=3D"#000080" SIZE=3D2 =
FACE=3D"Arial">beginning</FONT></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I></I></B></SPAN><SPAN LANG=3D"en-us"><B><I><FONT =
COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial"> with the =
timers</FONT></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I></I></B></SPAN><SPAN LANG=3D"en-us"><B><I><FONT =
COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">.</FONT></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I>&nbsp;<FONT COLOR=3D"#000080" SIZE=3D2 =
FACE=3D"Arial"></FONT></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I></I></B></SPAN><SPAN LANG=3D"en-us"><B><I> <FONT =
COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">First, =
t</FONT></I></B></SPAN><SPAN LANG=3D"en-us"><B><I></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">he =
problem with the timers is not only the locking, but giving out the =
pointer without ensuring the</FONT></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I></I></B></SPAN><SPAN LANG=3D"en-us"><B><I> <FONT =
COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">pointer lifetime. This is the =
same problem as we already discussed, you can not get the lock if you =
did not ensure that the structure the lock is embedded into is =
valid</FONT></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I></I></B></SPAN><SPAN LANG=3D"en-us"><B><I><FONT =
COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial"> and continues to be valid =
while the timer routine is running</FONT></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I></I></B></SPAN><SPAN LANG=3D"en-us"><B><I><FONT =
COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">.</FONT></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I></I></B></SPAN><SPAN LANG=3D"en-us"><B><I><FONT =
COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial"> Ideally the timer should =
receive a smHandle and all it should do is send an event. The =
majority</FONT></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I></I></B></SPAN><SPAN LANG=3D"en-us"><B><I> <FONT =
COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">of the timer routines already =
do.</FONT></I></B></SPAN><SPAN LANG=3D"en-us"><B><I></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I><FONT COLOR=3D"#000080" SIZE=3D2 =
FACE=3D"Arial"></FONT></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I></I></B></SPAN><SPAN LANG=3D"en-us"><B><I> <FONT =
COLOR=3D"#000080" SIZE=3D2 =
FACE=3D"Arial">Second,</FONT></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I></I></B></SPAN><SPAN LANG=3D"en-us"><B><I><FONT =
COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial"> I =
don</FONT></I></B></SPAN><SPAN LANG=3D"en-us"><B><I></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I><FONT COLOR=3D"#000080" SIZE=3D2 =
FACE=3D"Arial">&#8217;</FONT></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I></I></B></SPAN><SPAN LANG=3D"en-us"><B><I><FONT =
COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">t want the timers sit there =
waiting on the lock</FONT></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I></I></B></SPAN><SPAN LANG=3D"en-us"><B><I> <FONT =
COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">for a long =
time</FONT></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I></I></B></SPAN><SPAN LANG=3D"en-us"><B><I><FONT =
COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial"> =
anyway.</FONT></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I></I></B></SPAN><SPAN LANG=3D"en-us"><B><I><FONT =
COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial"> In the current software the =
timers are processed on one CPU only, if the timer routine waits on the =
lock for a long time you not only locking out one CPU, which is just =
performance problems, but prevent the timers from running at =
all.</FONT></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I></I></B></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"></SPAN><SPAN =
LANG=3D"en-us"></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"></SPAN><SPAN =
LANG=3D"en-us"></SPAN></P>

</BODY>
</HTML>
------_=_NextPart_001_01C7D2C6.ADD9CB50--
