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] [day] [month] [year] [list]
Date:   Wed, 23 Aug 2023 14:09:06 -0700
From:   Jörn Engel <joern@...estorage.com>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     Uday Shankar <ushankar@...estorage.com>,
        Kees Cook <keescook@...omium.org>,
        Tony Luck <tony.luck@...el.com>,
        "Guilherme G. Piccoli" <gpiccoli@...lia.com>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Len Brown <lenb@...nel.org>, James Morse <james.morse@....com>,
        Borislav Petkov <bp@...en8.de>,
        Len Brown <len.brown@...el.com>,
        linux-hardening@...r.kernel.org, linux-acpi@...r.kernel.org,
        Qiuxu Zhuo <qiuxu.zhuo@...el.com>,
        "Huang, Ying" <ying.huang@...el.com>
Subject: Re: [PATCH] Revert "ACPI, APEI, use raw spinlock in ERST"

On Tue, Aug 22, 2023 at 07:57:52PM -0700, Jörn Engel wrote:
> 
> You are right.  I'm actually quite surprised how we turn a trylock into
> a spinning lock.  Now I know, thank you!

On that subject, why do we turn a trylock into a spinning lock?  Thomas,
is there a good argument against a patch like the one below?

If the question was ever considered, it seems to have happened outside
of mainline.  At least I cannot find it in git history.

Jörn

--
If you cannot make a function run 100x faster, maybe you can
call it 100x less often.
-- Unknown

diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
index fcd9ad3f7f2e..5bda84d5879a 100644
--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -1255,11 +1255,13 @@ static int __sched rt_mutex_slowtrylock(struct rt_mutex_base *lock)
 
 	/*
 	 * The mutex has currently no owner. Lock the wait lock and try to
 	 * acquire the lock. We use irqsave here to support early boot calls.
 	 */
-	raw_spin_lock_irqsave(&lock->wait_lock, flags);
+	ret = raw_spin_trylock_irqsave(&lock->wait_lock, flags);
+	if (!ret)
+		return 0;
 
 	ret = __rt_mutex_slowtrylock(lock);
 
 	raw_spin_unlock_irqrestore(&lock->wait_lock, flags);
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ