This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix rwlock stall with PREFER_WRITER_NONRECURSIVE_NP (bug 23861)


On Nov 08 2018, Carlos O'Donell <carlos@redhat.com> wrote:

> On 11/8/18 9:54 AM, Andreas Schwab wrote:
>> 	[BZ #23861]
>> 	* nptl/pthread_rwlock_common.c (__pthread_rwlock_rdlock_full):
>> 	Update expected value for __readers while waiting on
>> 	PTHREAD_RWLOCK_RWAITING.
>> 	* nptl/tst-rwlock-pwn.c: New file.
>> 	* nptl/Makefile (tests): Add tst-rwlock-pwn.
>
> Is this at all related to this bug?
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=23844

This part of the code is exclusively used for
PREFER_WRITER_NONRECURSIVE_NP rwlocks.

> Please don't call this pwn :-)

Why?

> Please use a more descriptive name like "tst-rwlock-stall"

It is testing PREFER_WRITER_NONRECURSIVE_NP, so pwn is very descriptive.

>>  		  int err = futex_abstimed_wait (&rwlock->__data.__readers,
>> -		      r, abstime, private);
>> +						 r, abstime, private);
>
> Why is this change correct?

Emacs told me so, and Emacs is always right.

>> +#define LOOPS 10
>
> Why 10?

Just to make the bug reproducable enough.

>
>> +#define NTHREADS 3
>
> Why 3?

>From the original test case.

> Does it still stall if you just increment a counter
> and then alternate between the two operations?

No.

>> +  for (int n = 0; n < LOOPS; n++)
>> +    {
>> +      pthread_t tids[NTHREADS];
>> +      do_exit = 0;
>> +      for (int i = 0; i < NTHREADS; i++)
>> +	tids[i] = xpthread_create (NULL, wrloop, NULL);
>> +      sleep (1);
>
> Why sleep?

To let the threads running for some time.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]