Bug 124723

Summary: libc.nptl spinlock code is different from kernel?
Product: [Fedora] Fedora Reporter: Bob Cook <bobcook47>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 2Keywords: FutureFeature
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-05-31 14:05:47 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Bob Cook 2004-05-28 20:36:50 UTC
Description of problem: libc.nptl spinlock code is different from
kernel?   Presumably, one is better than the other.


Version-Release number of selected component (if applicable):
libc-2.3.3
linux kernel-2.6.5-1.358


How reproducible: compare source files
http://lxr.linux.no/source/include/asm-i386/spinlock.h?v=2.6.5#L46
libc/nptl/sysdeps/i386/pthread_spin_lock.c

#define spin_lock_string  to asm(  )

why does the library redefine anyway?
it would be cleaner to use kernel includes.


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Bob Cook 2004-05-28 20:39:05 UTC
#define spin_lock_string \from kernel -- note decb instead of decl?
47         "\n1:\t" \
48         "lock ; decb %0\n\t" \
49         "js 2f\n" \
50         LOCK_SECTION_START("") \
51         "2:\t" \
52         "rep;nop\n\t" \
53         "cmpb $0,%0\n\t" \
54         "jle 2b\n\t" \    --note jumps are reversed from library?
55         "jmp 1b\n" \
56         LOCK_SECTION_END

Comment 3 Jakub Jelinek 2004-05-31 14:05:47 UTC
Why does it need to be the same?
In the kernel, the code can assume at most 128 CPUs trying to grab the
spinlock.  glibc cannot make assumptions on how many threads are trying
to acquire the spinlock at once (well, it assumes at most 2^31 threads).