All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] Question about priority of pthread rwlock on linux
@ 2011-12-09 10:01 Kang Kai
  2011-12-09 13:15 ` Cyril Hrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Kang Kai @ 2011-12-09 10:01 UTC (permalink / raw)
  To: ltp-list


[-- Attachment #1.1: Type: text/plain, Size: 1173 bytes --]

Hello everyone,

I am working on Yocto( a kind of  embedded linux) to make POSIX test 
cases pass. It uses kernel 3.0 and eglibc 2.3.

There are 3 failed test cases about pthread rwlock:
pthread_rwlock_rdlock/2-1 pthread_rwlock_rdlock/2-2  
pthread_rwlock_unlock/3-1

In pthread_rwlock_rdlock/2-1,  main thread*read lock* a rwlock,  child 
thread1 *write lock* the rwlock with a medium priority, so it should be 
blocked. child thread2 try to *read lock *the rwlock with low priority, 
the case says child thread2 should block too. But in Yocto linux child 
thread2 doesn't block and then read lock the rwlock, that make test case 
fail.

In eglibc nptl implementation, rwlock has a element "__flags" to 
identify prefer write lock or read lock, default is to prefer read lock. 
If change __flags to prefer write lock, the test case will pass.

My questions are:
1 What is the test case base on? I checked the  POSIX.1-2008 but didn't 
find description priority about the pthread rwlock? Could anyone give me 
a source that make me to understand it better?
2 Which C library or platform can make this case pass? So that I can 
compare it with eglibc.

Thanks a lot!
Kai




[-- Attachment #1.2: Type: text/html, Size: 1588 bytes --]

[-- Attachment #2: Type: text/plain, Size: 384 bytes --]

------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/

[-- Attachment #3: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LTP] Question about priority of pthread rwlock on linux
  2011-12-09 10:01 [LTP] Question about priority of pthread rwlock on linux Kang Kai
@ 2011-12-09 13:15 ` Cyril Hrubis
       [not found]   ` <CAGH67wT1TwR89P+rQpo4gC7Qx0iRFkJbzxVA=PSu0QiC+uDE4g@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2011-12-09 13:15 UTC (permalink / raw)
  To: Kang Kai; +Cc: ltp-list

Hi!
> I am working on Yocto( a kind of  embedded linux) to make POSIX test
> cases pass. It uses kernel 3.0 and eglibc 2.3.
> 
> There are 3 failed test cases about pthread rwlock:
> pthread_rwlock_rdlock/2-1 pthread_rwlock_rdlock/2-2
> pthread_rwlock_unlock/3-1
> 
> In pthread_rwlock_rdlock/2-1,  main thread*read lock* a rwlock,
> child thread1 *write lock* the rwlock with a medium priority, so it
> should be blocked. child thread2 try to *read lock *the rwlock with
> low priority, the case says child thread2 should block too. But in
> Yocto linux child thread2 doesn't block and then read lock the
> rwlock, that make test case fail.
> 
> In eglibc nptl implementation, rwlock has a element "__flags" to
> identify prefer write lock or read lock, default is to prefer read
> lock. If change __flags to prefer write lock, the test case will
> pass.
> 
> My questions are:
> 1 What is the test case base on? I checked the  POSIX.1-2008 but
> didn't find description priority about the pthread rwlock? Could
> anyone give me a source that make me to understand it better?
> 2 Which C library or platform can make this case pass? So that I can
> compare it with eglibc.

These doesn't work with glibc either, see:

http://old.nabble.com/pthread_rwlock_rdlock%28%29-p32423548.html

I haven't got any reply though :(.

The newer POSIX explicitly says that reader thread acquires the lock if
no writer is holding the lock and no writers are locked on the lock. And
it seems that previous standards specified the case of locked writing
threads as implementation defined...

http://pubs.opengroup.org/onlinepubs/007904975/functions/pthread_rwlock_rdlock.html


-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LTP] Question about priority of pthread rwlock on linux
       [not found]   ` <CAGH67wT1TwR89P+rQpo4gC7Qx0iRFkJbzxVA=PSu0QiC+uDE4g@mail.gmail.com>
@ 2011-12-14 11:49     ` Cyril Hrubis
  0 siblings, 0 replies; 3+ messages in thread
From: Cyril Hrubis @ 2011-12-14 11:49 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: ltp-list, Kang Kai

Hi!
> > These doesn't work with glibc either, see:
> >
> > http://old.nabble.com/pthread_rwlock_rdlock%28%29-p32423548.html
> >
> > I haven't got any reply though :(.
> >
> > The newer POSIX explicitly says that reader thread acquires the lock if
> > no writer is holding the lock and no writers are locked on the lock. And
> > it seems that previous standards specified the case of locked writing
> > threads as implementation defined...
> >
> > http://pubs.opengroup.org/onlinepubs/007904975/functions/pthread_rwlock_rdlock.html
> 
>     Once upon a time I intended to upgrade the POSIX compliance of the
> test suite to the 2008 spec -- so I blindly updated the POSIX
> compliance to 2008.1 (before it was set to 2001 compliance, IIRC..
> which wasn't particularly useful). I got busy with other tasks and
> since then my focus has been diverted from this and LTP (for the most
> part).
>     If it turns out that the testcase doesn't make sense given the new
> POSIX spec, or needs to be rewritten, I'll be more than happy to
> review either and provide feedback.

This rather seems to be one of the rare occasions where the testcase is
actually right and the glibc behaves to some very old SUS.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Cloud Computing - Latest Buzzword or a Glimpse of the Future?
This paper surveys cloud computing today: What are the benefits? 
Why are businesses embracing it? What are its payoffs and pitfalls?
http://www.accelacomm.com/jaw/sdnl/114/51425149/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-12-14 11:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-09 10:01 [LTP] Question about priority of pthread rwlock on linux Kang Kai
2011-12-09 13:15 ` Cyril Hrubis
     [not found]   ` <CAGH67wT1TwR89P+rQpo4gC7Qx0iRFkJbzxVA=PSu0QiC+uDE4g@mail.gmail.com>
2011-12-14 11:49     ` Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.