Patch to optimize "bare" critical sections

Astrodog astrodog at gmail.com
Tue Nov 23 22:18:51 PST 2004


Marcel Moolenaar wrote:

>
> On Nov 23, 2004, at 1:31 PM, John Baldwin wrote:
>
>> On Tuesday 23 November 2004 03:00 pm, John Baldwin wrote:
>>
>>> Basically, I have a patch to divorce the interrupt disable/deferring to
>>> only happen inside of spinlocks using a new spinlock_enter/exit() API
>>> (where a spinlock_enter/exit includes a critical section as well) 
>>> but that
>>> plain critical sections won't have to do such a thing.  I've tested 
>>> it on
>>> i386, alpha, and sparc64 already, and it has also been tested on 
>>> arm.  I'm
>>> unable to get a cross-built powerpc kernel to link (linker dies with a
>>> signal 6), but the compile did finish.  I have cross-compiled ia64 and
>>> amd64
>>> successfully, but have not run tested due to ENOHARDWARE.  So, I would
>>> appreciate it if a few folks could try the patch out on ppc, ia64, and
>>> amd64 to make sure it works ok.  Thanks.
>>>
>>> http://www.FreeBSD.org/~jhb/spinlock.patch
>>
>>
>> *cough*  Ahem, http://www.FreeBSD.org/~jhb/patches/spinlock.patch
>>
>> Sorry about that.
>
>
> The patch doesn't apply cleanly. Can you create a patch against HEAD
> and not your lock branch?
>
> Rejects are:
>
> Hmm...  The next patch looks like a unified diff to me...
> The text leading up to this was:
> --------------------------
> |--- //depot/projects/smpng/sys/kern/kern_mutex.c       2004/11/15 
> 20:20:33
> |+++ //depot/user/jhb/lock/kern/kern_mutex.c    2004/11/17 16:42:34
> --------------------------
> Patching file sys/kern/kern_mutex.c using Plan A...
> Hunk #1 failed at 602.
> Hunk #2 failed at 630.
> 2 out of 2 hunks failed--saving rejects to sys/kern/kern_mutex.c.rej
> Hmm...  The next patch looks like a unified diff to me...
> The text leading up to this was:
> --------------------------
> |--- //depot/projects/smpng/sys/sys/mutex.h     2004/08/18 16:47:14
> |+++ //depot/user/jhb/lock/sys/mutex.h  2004/11/04 23:48:43
> --------------------------
> Patching file sys/sys/mutex.h using Plan A...
> Hunk #1 succeeded at 164 (offset -3 lines).
> Hunk #2 failed at 176.
> Hunk #3 succeeded at 194 (offset -11 lines).
> Hunk #4 succeeded at 212 with fuzz 2 (offset -4 lines).
> Hunk #5 failed at 220.
> 2 out of 5 hunks failed--saving rejects to sys/sys/mutex.h.rej
>
It does not compile. Complains out redundant declarations of 
spinlock_enter and spinlock_exit, for me on amd64. I applied the patch 
by hand, so it could be a mistake on my end. Doesn't appear to be 
though. This was with 5.3-STABLE.

--- Harrison Grundy


More information about the freebsd-amd64 mailing list