Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1533277
| From | Chris Wilson <chris@chris-wilson.co.uk> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 4/4] locking: Add kselftests for ww_mutex stress |
| Date | 2016-11-30 14:00 +0100 |
| Message-ID | <sJcEp-6e9-3@gated-at.bofh.it> (permalink) |
| References | <sIteh-22H-3@gated-at.bofh.it> <sJ16i-7fD-11@gated-at.bofh.it> <sJ16i-7fD-17@gated-at.bofh.it> <sJcbn-64I-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Nov 30, 2016 at 01:29:39PM +0100, Maarten Lankhorst wrote:
> > +static void stress_work(struct work_struct *work)
> > +{
> > + struct stress *stress = container_of(work, typeof(*stress), work);
> > + const int nlocks = stress->nlocks;
> > + struct ww_mutex *locks = stress->locks;
> > + struct ww_acquire_ctx ctx;
> > + int contended = -1;
> > + int *order;
> > + int n, ret;
> > +
> > + order = get_random_order(nlocks);
> > + if (!order)
> > + return;
> > +
> > + ww_acquire_init(&ctx, &ww_class);
> > +
> > +retry:
> > + ret = 0;
> > + for (n = 0; n < nlocks; n++) {
> > + if (n == contended)
> > + continue;
> > +
> > + ret = ww_mutex_lock(&locks[order[n]], &ctx);
> > + if (ret < 0)
> > + break;
> > + }
> What's wrong with attempting to lock the contended lock here?
> Who knows, this might find some more bugs than the functional tests already do.
I was trying to follow the guide, which was lock, backoff by unlocking
everything, slowlock the contended lock, then lock everything else.
I have now a second worker that follows the reordering method as well.
(As well as a test that slowlock after the ABBA deadlock detection
resolves the locking order.)
If you have a sketch of something else to try, I'll add it.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/11] locking/ww_mutex: Keep sorted wait list to avoid stampedes Nicolai Hähnle <nhaehnle@gmail.com> - 2016-11-28 13:30 +0100
[PATCH 2/4] locking: Add kselftests for ww_mutex AA deadlock detection Chris Wilson <chris@chris-wilson.co.uk> - 2016-11-30 01:40 +0100
[PATCH 4/4] locking: Add kselftests for ww_mutex stress Chris Wilson <chris@chris-wilson.co.uk> - 2016-11-30 01:40 +0100
Re: [PATCH 4/4] locking: Add kselftests for ww_mutex stress Maarten Lankhorst <dev@mblankhorst.nl> - 2016-11-30 13:30 +0100
Re: [PATCH 4/4] locking: Add kselftests for ww_mutex stress Chris Wilson <chris@chris-wilson.co.uk> - 2016-11-30 14:00 +0100
[PATCH 1/4] locking: Begin kselftests for ww_mutex Chris Wilson <chris@chris-wilson.co.uk> - 2016-11-30 01:40 +0100
[PATCH 3/4] locking: Add kselftests for ww_mutex ABBA deadlock detection Chris Wilson <chris@chris-wilson.co.uk> - 2016-11-30 01:40 +0100
Re: [PATCH 1/4] locking: Begin kselftests for ww_mutex Nicolai Hähnle <nhaehnle@gmail.com> - 2016-11-30 09:10 +0100
Re: [PATCH 00/11] locking/ww_mutex: Keep sorted wait list to avoid stampedes Chris Wilson <chris@chris-wilson.co.uk> - 2016-11-30 10:50 +0100
Re: [PATCH 00/11] locking/ww_mutex: Keep sorted wait list to avoid stampedes Nicolai Hähnle <nhaehnle@gmail.com> - 2016-11-30 13:10 +0100
Re: [PATCH 00/11] locking/ww_mutex: Keep sorted wait list to avoid stampedes Chris Wilson <chris@chris-wilson.co.uk> - 2016-11-30 13:30 +0100
Re: [PATCH 00/11] locking/ww_mutex: Keep sorted wait list to avoid stampedes Nicolai Hähnle <nhaehnle@gmail.com> - 2016-11-30 14:50 +0100
csiph-web