Patch "pstore: Switch pmsg_lock to an rt_mutex to avoid priority inversion" has been added to the 4.14-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    pstore: Switch pmsg_lock to an rt_mutex to avoid priority inversion

to the 4.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     pstore-switch-pmsg_lock-to-an-rt_mutex-to-avoid-prio.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 42200806393f1ef602df6225560b3f45614d55fd
Author: John Stultz <jstultz@xxxxxxxxxx>
Date:   Wed Dec 14 23:18:34 2022 +0000

    pstore: Switch pmsg_lock to an rt_mutex to avoid priority inversion
    
    [ Upstream commit 76d62f24db07f22ccf9bc18ca793c27d4ebef721 ]
    
    Wei Wang reported seeing priority inversion caused latencies
    caused by contention on pmsg_lock, and suggested it be switched
    to a rt_mutex.
    
    I was initially hesitant this would help, as the tasks in that
    trace all seemed to be SCHED_NORMAL, so the benefit would be
    limited to only nice boosting.
    
    However, another similar issue was raised where the priority
    inversion was seen did involve a blocked RT task so it is clear
    this would be helpful in that case.
    
    Cc: Wei Wang <wvw@xxxxxxxxxx>
    Cc: Midas Chien<midaschieh@xxxxxxxxxx>
    Cc: Connor O'Brien <connoro@xxxxxxxxxx>
    Cc: Kees Cook <keescook@xxxxxxxxxxxx>
    Cc: Anton Vorontsov <anton@xxxxxxxxxx>
    Cc: Colin Cross <ccross@xxxxxxxxxxx>
    Cc: Tony Luck <tony.luck@xxxxxxxxx>
    Cc: kernel-team@xxxxxxxxxxx
    Fixes: 9d5438f462ab ("pstore: Add pmsg - user-space accessible pstore object")
    Reported-by: Wei Wang <wvw@xxxxxxxxxx>
    Signed-off-by: John Stultz <jstultz@xxxxxxxxxx>
    Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221214231834.3711880-1-jstultz@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/pstore/pmsg.c b/fs/pstore/pmsg.c
index 24db02de1787..ffc13ea196d2 100644
--- a/fs/pstore/pmsg.c
+++ b/fs/pstore/pmsg.c
@@ -15,9 +15,10 @@
 #include <linux/device.h>
 #include <linux/fs.h>
 #include <linux/uaccess.h>
+#include <linux/rtmutex.h>
 #include "internal.h"
 
-static DEFINE_MUTEX(pmsg_lock);
+static DEFINE_RT_MUTEX(pmsg_lock);
 
 static ssize_t write_pmsg(struct file *file, const char __user *buf,
 			  size_t count, loff_t *ppos)
@@ -36,9 +37,9 @@ static ssize_t write_pmsg(struct file *file, const char __user *buf,
 	if (!access_ok(VERIFY_READ, buf, count))
 		return -EFAULT;
 
-	mutex_lock(&pmsg_lock);
+	rt_mutex_lock(&pmsg_lock);
 	ret = psinfo->write_user(&record, buf);
-	mutex_unlock(&pmsg_lock);
+	rt_mutex_unlock(&pmsg_lock);
 	return ret ? ret : count;
 }
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux