Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1219489

Re: [RFC][PATCH RT 0/3] RT: Fix trylock deadlock without msleep() hack

From Thomas Gleixner <tglx@linutronix.de>
Newsgroups linux.kernel
Subject Re: [RFC][PATCH RT 0/3] RT: Fix trylock deadlock without msleep() hack
Date 2015-09-05 12:40 +0200
Message-ID <q5j35-6jH-41@gated-at.bofh.it> (permalink)
References <q4NZf-3Zz-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, 3 Sep 2015, Steven Rostedt wrote:
> There are a lot of trylocks in the kernel, and I'm sure there's more around
> that need to be convert to this method.

The only ones we need to convert are those which do an actual trylock
loop. The others, which simply bail if the trylock fails are
completely irrelevant.

> I think this is an elegant solution but others may feel
> differently. As I think a msleep() hail mary is extremely non
> deterministic, it's a blemish for a kernel that prides itself on
> adding determinism.

I agree that the msleep hack is horrible. Though I do not agree that
this solution is elegant. It's clever.

I was looking into that a few days ago and did not come up with
something sensible, but your patch and reading up on your well done
explanation made me look another time.

So the problem we need to solve is:

retry:
	lock(B);
	if (!try_lock(A)) {
		unlock(B);
		cpu_relax();
		goto retry;
	}

So instead of doing that proposed magic boost, we can do something
more straight forward:

retry:
	lock(B);
	if (!try_lock(A)) {
		lock_and_drop(A, B);
		unlock(A);
		goto retry;
	}

lock_and_drop() queues the task as a waiter on A, drops B and then
does the PI adjustment on A. 

Thoughts?

Thanks,

	tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC][PATCH RT 0/3] RT: Fix trylock deadlock without msleep() hack Steven Rostedt <rostedt@goodmis.org> - 2015-09-04 03:30 +0200
  [RFC][PATCH RT 3/3] rt: Make cpu_chill() into yield() and add new cpu_rest() as msleep(1) Steven Rostedt <rostedt@goodmis.org> - 2015-09-04 03:30 +0200
  [RFC][PATCH RT 2/3] locking: Convert trylock spinners over to spin_try_or_boost_lock() Steven Rostedt <rostedt@goodmis.org> - 2015-09-04 03:30 +0200
  [RFC][PATCH RT 1/3] locking: Add spin_try_or_boost_lock() infrastructure Steven Rostedt <rostedt@goodmis.org> - 2015-09-04 03:30 +0200
    Re: [RFC][PATCH RT 1/3] locking: Add spin_try_or_boost_lock()  infrastructure Steven Rostedt <rostedt@goodmis.org> - 2015-09-04 03:50 +0200
  Re: [RFC][PATCH RT 0/3] RT: Fix trylock deadlock without msleep()  hack Thomas Gleixner <tglx@linutronix.de> - 2015-09-05 12:40 +0200
    Re: [RFC][PATCH RT 0/3] RT: Fix trylock deadlock without msleep()  hack Ingo Molnar <mingo@kernel.org> - 2015-09-05 14:10 +0200
      Re: [RFC][PATCH RT 0/3] RT: Fix trylock deadlock without msleep()  hack Steven Rostedt <rostedt@goodmis.org> - 2015-09-05 14:30 +0200
      Re: [RFC][PATCH RT 0/3] RT: Fix trylock deadlock without msleep()  hack Thomas Gleixner <tglx@linutronix.de> - 2015-09-07 10:40 +0200
    Re: [RFC][PATCH RT 0/3] RT: Fix trylock deadlock without msleep()  hack Steven Rostedt <rostedt@goodmis.org> - 2015-09-05 14:20 +0200
      Re: [RFC][PATCH RT 0/3] RT: Fix trylock deadlock without msleep()  hack Steven Rostedt <rostedt@goodmis.org> - 2015-09-05 14:30 +0200
      Re: [RFC][PATCH RT 0/3] RT: Fix trylock deadlock without msleep()  hack Steven Rostedt <rostedt@goodmis.org> - 2015-09-05 15:00 +0200

csiph-web