lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210903105516.tu33jhdhwzdwpb6g@linutronix.de>
Date:   Fri, 3 Sep 2021 12:55:16 +0200
From:   Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To:     Davidlohr Bueso <dave@...olabs.net>
Cc:     tglx@...utronix.de, peterz@...radead.org, mingo@...nel.org,
        rostedt@...dmis.org, longman@...hat.com, boqun.feng@...il.com,
        linux-kernel@...r.kernel.org, Davidlohr Bueso <dbueso@...e.de>
Subject: Re: [PATCH 2/2] locking/rwbase_rt: Lockless reader waking up a writer

On 2021-09-01 15:28:25 [-0700], Davidlohr Bueso wrote:
> diff --git a/kernel/locking/rwbase_rt.c b/kernel/locking/rwbase_rt.c
> index 4ba15088e640..3444bc709973 100644
> --- a/kernel/locking/rwbase_rt.c
> +++ b/kernel/locking/rwbase_rt.c
> @@ -141,6 +141,7 @@ static void __sched __rwbase_read_unlock(struct rwbase_rt *rwb,
>  {
>  	struct rt_mutex_base *rtm = &rwb->rtmutex;
>  	struct task_struct *owner;
> +	DEFINE_WAKE_Q(wake_q);
>  
>  	raw_spin_lock_irq(&rtm->wait_lock);
>  	/*
> @@ -151,9 +152,10 @@ static void __sched __rwbase_read_unlock(struct rwbase_rt *rwb,
>  	 */
>  	owner = rt_mutex_owner(rtm);
>  	if (owner)
> -		wake_up_state(owner, state);
> +		wake_q_add(&wake_q, owner);
>  
>  	raw_spin_unlock_irq(&rtm->wait_lock);
> +	wake_up_q_state(&wake_q, state);
>  }

You keep the same wake_q in task_struct. Don't you miss states/wake ups
if a task needs both wakes? one for TASK_NORMAL and one for
TASK_UNINTERRUPTIBLE?
Side note: This wake up happens in an-IRQ off region. So there no
PI-boosting dance around as it would be the case with a sleeping lock.

Sebastian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ