[ofw] cl_spinlock_osd.h

Smith, Stan stan.smith at intel.com
Fri Apr 12 11:59:14 PDT 2013


Fab writes: Is there similar logic for the release case?

Yes - Similar logic can be applied to the release side - MPI/DAPL/IPOIB testing all passed.


--- C:/Users/scsmith/AppData/Local/Temp/cl_spinlock_osd.h-revBASE.svn000.tmp.h      Wed May 16 14:38:16 2012

+++ C:/Users/scsmith/Documents/openIB-windows/ofw/gen1/branches/WOF3-2/inc/kernel/complib/cl_spinlock_osd.h    Thu Apr 11 08:43:59 2013

@@ -91,15 +91,8 @@

cl_spinlock_acquire(

      IN    cl_spinlock_t* const    p_spinlock )

{

-     KIRQL irql = KeGetCurrentIrql();

     CL_ASSERT( p_spinlock );

-

-     if (irql == DISPATCH_LEVEL) {

-           KeAcquireSpinLockAtDpcLevel( &p_spinlock->lock );

-           p_spinlock->irql = irql;

-     }

-     else

-           KeAcquireSpinLock( &p_spinlock->lock, &p_spinlock->irql );

+     KeAcquireSpinLock( &p_spinlock->lock, &p_spinlock->irql );

}


CL_INLINE void cl_spinlock_release(



#ifdef NTDDI_WIN8

@@ -114,10 +107,7 @@

{

     CL_ASSERT( p_spinlock );

-     if (p_spinlock->irql == DISPATCH_LEVEL)

-           KeReleaseSpinLockFromDpcLevel( &p_spinlock->lock );

-     else

-           KeReleaseSpinLock( &p_spinlock->lock, p_spinlock->irql );

+     KeReleaseSpinLock( &p_spinlock->lock, p_spinlock->irql );

}


From: Fab Tillier [mailto:ftillier at microsoft.com]
Sent: Wednesday, April 10, 2013 10:29 AM
To: Smith, Stan
Subject: RE: cl_spinlock_osd.h

Is there similar logic for the release case?

CL_INLINE void cl_spinlock_release(
           IN           cl_spinlock_t* const       p_spinlock )
{
           CL_ASSERT( p_spinlock );

           if (p_spinlock->irql == DISPATCH_LEVEL)
                           KeReleaseSpinLockFromDpcLevel( &p_spinlock->lock );
           else
                           KeReleaseSpinLock( &p_spinlock->lock, p_spinlock->irql );
}

?

Anyway, this looks good to me.  It would be great to move away from complib altogether (at least in the kernel drivers).

Cheers,
-Fab

From: ofw-bounces at lists.openfabrics.org<mailto:ofw-bounces at lists.openfabrics.org> [mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of Smith, Stan
Sent: Tuesday, April 9, 2013 4:25 PM
To: ofw at lists.openfabrics.org<mailto:ofw at lists.openfabrics.org>
Subject: [ofw] cl_spinlock_osd.h

Remove code which is duplicated in the implementation of MS code KeAcquireSpinLock(), as indicated by our Microsoft OFA members.

Signed-off-by: stan.smith at intel.com<mailto:stan.smith at intel.com>

--- inc/kernel/complib/cl_spinlock_osd.h             Wed Mar 06 10:12:19 2013
+++ inc/kernel/complib/cl_spinlock_osd.h          Tue Feb 26 12:08:56 2013
@@ -91,15 +91,8 @@
cl_spinlock_acquire(
                IN           cl_spinlock_t* const       p_spinlock )
{
-              KIRQL irql = KeGetCurrentIrql();
               CL_ASSERT( p_spinlock );
-
-              if (irql == DISPATCH_LEVEL) {
-                              KeAcquireSpinLockAtDpcLevel( &p_spinlock->lock );
-                              p_spinlock->irql = irql;
-              }
-              else
-                              KeAcquireSpinLock( &p_spinlock->lock, &p_spinlock->irql );
+             KeAcquireSpinLock( &p_spinlock->lock, &p_spinlock->irql );
}

Basically move from

CL_INLINE void
cl_spinlock_acquire(
                IN           cl_spinlock_t* const       p_spinlock )
{
                KIRQL irql = KeGetCurrentIrql();
                CL_ASSERT( p_spinlock );

                if (irql == DISPATCH_LEVEL) {
                                KeAcquireSpinLockAtDpcLevel( &p_spinlock->lock );
                                p_spinlock->irql = irql;
                }
                else
                                KeAcquireSpinLock( &p_spinlock->lock, &p_spinlock->irql );
}

To

CL_INLINE void
cl_spinlock_acquire(
                IN           cl_spinlock_t* const       p_spinlock )
{
                CL_ASSERT( p_spinlock );
                KeAcquireSpinLock( &p_spinlock->lock, &p_spinlock->irql );
}


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20130412/54931f1b/attachment.html>


More information about the ofw mailing list