linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joel Fernandes <joel@joelfernandes.org>
To: Qais Yousef <qais.yousef@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	juri.lelli@redhat.com, vincent.guittot@linaro.org,
	Youssef Esmat <youssefesmat@google.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	bristot@redhat.com, clark.williams@gmail.com,
	bigeasy@linutronix.de, "Paul E. McKenney" <paulmck@kernel.org>
Subject: Re: Sum of weights idea for CFS PI
Date: Tue, 4 Oct 2022 15:48:34 -0400	[thread overview]
Message-ID: <0773b853-afdf-4368-3494-a5bd1cf01893@joelfernandes.org> (raw)
In-Reply-To: <20221004163039.vv3byszpg5dqjhy5@wubuntu>



On 10/4/2022 12:30 PM, Qais Yousef wrote:
> On 10/03/22 12:27, Joel Fernandes wrote:
>> There's a lot to unwind so I will reply in pieces after spending some time
>> thinking about it, but just for this part:
>>
>> On 10/3/2022 12:14 PM, Qais Yousef wrote:
>>>> In this case, there is no lock involved yet you have a dependency. But I don't
>>>> mean to sound depressing, and just because there are cases like this does not
>>>> mean we should not solve the lock-based ones. When I looked at Android, I saw
>>>> that it uses futex directly from Android Runtime code instead of using pthread.
>>>> So perhaps this can be trivially converted to FUTEX_LOCK_PI and then what we do
>>>> in the kernel will JustWork(Tm) ?
>>> I guess it will depend on individual libc implementation, but I thought all of
>>> them use FUTEX under the hood for pthreads mutexes.
>>>
>>> Maybe we can add a bootparam to force all futexes to be FUTEX_LOCK_PI?
>>>
>>
>> In the case of FUTEX_LOCK_PI, you have to store the TID of the 'lock owner' in
>> the futex word to signify that lock is held.
> 
> Right. So userspace has to opt-in.
> 
>> That wont work for the case above, Producer/Consumer signalling each other on a
>> bounded-buffer, right? That's not locking even though it is acquiring and
>> release of a limited resource.
> 
> Yes but as I tried to point out I don't think proxy-execution handles this case
> where you don't hold a lock explicitly. But I could be wrong.

I don't disagree. Proxy execution is an implementation detail, without more
information from userspace, any implementation cannot help. I was just
responding to your point about converting all futexes which you cannot do
without knowing what the futex is used for.

But I am thinking of messing around with rt_mutex_setprio() and some userspace
tests to see if I can make the sum of weights thing work for the *userspace
locking* usecases (FUTEX_LOCK_PI). Then run some tests and collect some traces.
Perhaps you can do that on the Android side as well.

> IIUC Sebastian's
> understanding is similar to mine. Only 'locks' (FUTEX_LOCK_PI which ends up
> using rt-mutex) do PI inheritance.
> 
> So this signaling scenario is a new class of problems that wasn't handled
> before; to my understanding.
Most certainly, agreed.

Thanks!

 - Joel

  reply	other threads:[~2022-10-04 19:48 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-29 20:38 Sum of weights idea for CFS PI Joel Fernandes
2022-09-30 13:49 ` Qais Yousef
2022-09-30 15:44   ` Youssef Esmat
2022-09-30 17:42     ` Joel Fernandes
2022-09-30 18:10       ` Youssef Esmat
2022-09-30 18:45         ` Joel Fernandes
2022-09-30 17:34   ` Joel Fernandes
2022-10-03 16:14     ` Qais Yousef
2022-10-03 16:27       ` Joel Fernandes
2022-10-04 16:30         ` Qais Yousef
2022-10-04 19:48           ` Joel Fernandes [this message]
2022-10-05  9:31             ` Qais Yousef
2022-10-04 20:27       ` Joel Fernandes
2022-10-05 10:04         ` Qais Yousef
2022-10-06 13:53           ` Joel Fernandes
2022-10-06 19:40             ` Youssef Esmat
2022-10-08 15:04               ` Joel Fernandes
2022-10-10 14:46                 ` Qais Yousef
2022-10-10 15:11                   ` Joel Fernandes
2022-10-12 14:30                     ` Qais Yousef
2022-10-04 11:50     ` Sebastian Andrzej Siewior
2022-10-04 14:43       ` Joel Fernandes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0773b853-afdf-4368-3494-a5bd1cf01893@joelfernandes.org \
    --to=joel@joelfernandes.org \
    --cc=bigeasy@linutronix.de \
    --cc=bristot@redhat.com \
    --cc=clark.williams@gmail.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=qais.yousef@arm.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=vincent.guittot@linaro.org \
    --cc=youssefesmat@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).