Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Feb 2024 09:00:17 GMT
From:      Olivier Certner <olce@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 9ac3ac9ece62 - main - PP mutexes: lock: Check if priority is too high against base one
Message-ID:  <202402270900.41R90HbS004016@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=9ac3ac9ece6269365ac314fa5fdb484e96d4a32e

commit 9ac3ac9ece6269365ac314fa5fdb484e96d4a32e
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2024-02-22 08:53:51 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2024-02-27 08:59:36 +0000

    PP mutexes: lock: Check if priority is too high against base one
    
    Doing this instead of using the current (user) priority, which includes
    current lendings, prevents gratuitous failures for threads involved in
    multiple locking groups, where each group is defined as the threads that
    can lock a particular PP or PI mutex.  No deadlock can occur in this
    case.  Indeed, if a thread holds such a lock A giving it a higher
    priority than the ceiling of some other lock B that is PP, and B is
    acquired by another thread, effectively the latter may not be able to
    run but this situation can only last until the first thread releases A,
    which it will do eventually.
    
    Reviewed by:            kib
    Approved by:            emaste (mentor)
    MFC after:              2 weeks
    Sponsored by:           The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D44044
---
 sys/kern/kern_umtx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c
index 9c7225863bb1..5abc1e71d763 100644
--- a/sys/kern/kern_umtx.c
+++ b/sys/kern/kern_umtx.c
@@ -2551,7 +2551,7 @@ do_lock_pp(struct thread *td, struct umutex *m, uint32_t flags,
 		}
 
 		mtx_lock(&umtx_lock);
-		if (UPRI(td) < PRI_MIN_REALTIME + ceiling) {
+		if (td->td_base_user_pri < PRI_MIN_REALTIME + ceiling) {
 			mtx_unlock(&umtx_lock);
 			error = EINVAL;
 			goto out;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202402270900.41R90HbS004016>