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: <57E995B4.4070003@hpe.com>
Date:   Mon, 26 Sep 2016 17:40:04 -0400
From:   Waiman Long <waiman.long@....com>
To:     Davidlohr Bueso <dave@...olabs.net>
CC:     Thomas Gleixner <tglx@...utronix.de>,
        Peter Zijlstra <peterz@...radead.org>,
        Mike Galbraith <umgwanakikbuti@...il.com>,
        Ingo Molnar <mingo@...nel.org>,
        Jonathan Corbet <corbet@....net>,
        <linux-kernel@...r.kernel.org>, <linux-doc@...r.kernel.org>,
        Jason Low <jason.low2@....com>,
        Scott J Norton <scott.norton@....com>,
        Douglas Hatch <doug.hatch@....com>
Subject: Re: [PATCH -tip] locking/rtmutex: Reduce top-waiter blocking on a
 lock

On 09/23/2016 09:28 PM, Davidlohr Bueso wrote:
>
> +#ifdef CONFIG_RT_MUTEX_SPIN_ON_OWNER
> +static bool rt_mutex_spin_on_owner(struct rt_mutex *lock,
> +                   struct task_struct *owner)
> +{
> +    bool ret = true;
> +
> +    /*
> +     * The last owner could have just released the lock,
> +     * immediately try taking it again.
> +     */
> +    if (!owner)
> +        goto done;
> +
> +    rcu_read_lock();
> +    while (rt_mutex_owner(lock) == owner) {
> +        /*
> +         * Ensure we emit the owner->on_cpu, dereference _after_
> +         * checking lock->owner still matches owner. If that fails,
> +         * owner might point to freed memory. If it still matches,
> +         * the rcu_read_lock() ensures the memory stays valid.
> +         */
> +        barrier();
> +        if (!owner->on_cpu || need_resched()) {
> +            ret = false;
> +            break;
> +        }
> +
> +        cpu_relax_lowlatency();
> +    }
> +    rcu_read_unlock();
> +done:
> +    return ret;
> +}
> +

One issue that I saw is that the spinner may no longer be the top waiter 
while spinning. Should we also check this condition in the spin loop?

Cheers,
Longman

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ