platform/x86: thinkpad_acpi: Take mutex in hotkey_resume
PATCH 1/1 platform/x86: thinkpad_acpi: Take mutex in hotkey_resume
From: Dennis Bonke <[email protected]>
hotkey_status_{set,get} expect the hotkey_mutex to be held. It seems like it was missed here and that gives warnings while resuming.
--- drivers/platform/x86/thinkpad_acpi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/platform/x86/thinkpad_acpi.c +2 -0
@@ -4116,9 +4116,11 @@ static void hotkey_resume(void) {tpacpi_disable_brightness_delay (); + mutex_lock(&hotkey_mutex)if (hotkey_status_set (true) <0 ||hotkey_mask_set (hotkey_acpi_mask) <0 )pr_err ("error while attempting to reset the event firmware interface\n" ); +mutex_unlock (&hotkey_mutex);tpacpi_send_radiosw_update ();tpacpi_input_send_tabletsw ();
Signature · 1 line
2.40.1
Hi Dennis,
thanks for the fix!
Quoted 4 lines · On 2023-09-14 01:18:29+0200, [email protected] wrote:
From: Dennis Bonke <[email protected]>
hotkey_status_{set,get} expect the
hotkey_mutexto be held. It seems like it was missed here and that gives warnings while resuming.
Which kind of warnings?
If it's from lockdep then it's triggered by hotkey_mask_set() and the commit message is a bit off.
Also then the patch needs:
With those:
Quoted 25 lines
Signed-off-by Dennis Bonke <[email protected]>--- drivers/platform/x86/thinkpad_acpi.c | 2 ++ 1 file changed, 2 insertions(+)drivers/platform/x86/thinkpad_acpi.c +2
-0@@ -4116,9 +4116,11 @@ static void hotkey_resume(void) {tpacpi_disable_brightness_delay (); + mutex_lock(&hotkey_mutex)if (hotkey_status_set (true) <0 ||hotkey_mask_set (hotkey_acpi_mask) <0 )pr_err ("error while attempting to reset the event firmware interface\n" ); +mutex_unlock (&hotkey_mutex);tpacpi_send_radiosw_update ();tpacpi_input_send_tabletsw ();Signature · 1 line
2.40.1
Quoted 3 lines · Thomas Weißschuh
Hi Dennis,
thanks for the fix!
Hello Thomas,
Thank you for the quick review! I apologize for the messy V2 that I seem to have posted. It's my first time working with a mailing list and it seems that something went wrong.
Quoted 11 lines · On 2023-09-14 01:18:29+0200, [email protected] wrote:
Quoted 4 lines
From: Dennis Bonke <[email protected]>
hotkey_status_{set,get} expect the
hotkey_mutexto be held. It seems like it was missed here and that gives warnings while resuming.Which kind of warnings?
If it's from lockdep then it's triggered by
hotkey_mask_set()and the commit message is a bit off.
It is indeed from lockdep. I've changed the commit message to reflect your comment.
Quoted 9 lines
Also then the patch needs:
Fixes 38831eaf7d4c ("platform/x86: thinkpad_acpi: use lockdep annotations")With those:
Reviewed-by Thomas Weißschuh <[email protected]>
About those tags, do I add them to the patch? Just double checking before I accidentally CC the stable list with an incorrect patch.
Quoted 26 lines
Quoted 26 lines
Signed-off-by Dennis Bonke <[email protected]>---
drivers/platform/x86/thinkpad_acpi.c | 2 ++1 file changed, 2 insertions(+)drivers/platform/x86/thinkpad_acpi.c +0
-0@@ -4116,9 +4116,11 @@ static void hotkey_resume(void) { tpacpi_disable_brightness_delay();
+ mutex_lock(&hotkey_mutex)
if (hotkey_status_set(true)< 0 ||hotkey_mask_set(hotkey_acpi_mask)< 0)
pr_err("error while attempting to reset the event firmware interface\n"); + mutex_unlock(&hotkey_mutex);
tpacpi_send_radiosw_update();
tpacpi_input_send_tabletsw();Signature · 1 line
2.40.1
Hi Dennis,
Quoted 5 lines · Dennis Bonke (admin)
Quoted 1 line · Thomas Weißschuh
thanks for the fix!
Hello Thomas,
Thank you for the quick review!
The least I can do if somebody else has to clean up my mess :-)
Quoted 2 lines
I apologize for the messy V2 that I seem to have posted.
It's my first time working with a mailing list and it seems that something went wrong.
No need to apologize.
Some more notes:
You should also CC LKML ([email protected]) and the subsystems maintainers as per MAINTAINERS / get_maintainers.pl on all your patches.
And now that I have worked with you on a patch also CC me on new revisions.
I can also recommend the usage of the "b4"[0] tool to prepare your patches. It takes care of some of the chores.
[0] https://b4.docs.kernel.org/en/latest/
Some more comments below.
Quoted 4 lines
Quoted 4 lines · On 2023-09-14 01:18:29+0200, [email protected] wrote:
Quoted 2 lines
From: Dennis Bonke <[email protected]>
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
hotkey_status_{set,get} expect the
hotkey_mutexto be held. It seems like it was missed here and that gives warnings while resuming.Which kind of warnings?
If it's from lockdep then it's triggered by
hotkey_mask_set()and the commit message is a bit off.It is indeed from lockdep. I've changed the commit message to reflect your comment.
Thanks!
Quoted 6 lines
Quoted 6 lines
Also then the patch needs:
Fixes 38831eaf7d4c ("platform/x86: thinkpad_acpi: use lockdep annotations")
Quoted 6 lines
Quoted 3 lines
With those:
Reviewed-by Thomas Weißschuh <[email protected]>About those tags, do I add them to the patch? Just double checking before I accidentally CC the stable list with an incorrect patch.
Yes, please add them to the patch.
The CC stable will only have any effect after your patch is in Linus' tree at which point multiple people will have looked at it. If an incorrect patch makes it that far it's not your fault.
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Signed-off-by Dennis Bonke <[email protected]>---
drivers/platform/x86/thinkpad_acpi.c | 2 ++1 file changed, 2 insertions(+)drivers/platform/x86/thinkpad_acpi.c +0
-0@@ -4116,9 +4116,11 @@ static void hotkey_resume(void) { tpacpi_disable_brightness_delay();
+ mutex_lock(&hotkey_mutex)
if (hotkey_status_set(true)< 0 ||hotkey_mask_set(hotkey_acpi_mask)< 0)
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
pr_err("error while attempting to reset the event firmware interface\n"); + mutex_unlock(&hotkey_mutex);
tpacpi_send_radiosw_update();
tpacpi_input_send_tabletsw();Signature · 1 line
2.40.1
Thomas
PATCH v2 1/1 platform/x86: thinkpad_acpi: Take mutex in hotkey_resume
In reply to [email protected]hotkey_status_set expects the hotkey_mutex to be held. It seems like it was missed here and that gives lockdep warnings while resuming.
--- drivers/platform/x86/thinkpad_acpi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/platform/x86/thinkpad_acpi.c +2 -0
@@ -4116,9 +4116,11 @@ static void hotkey_resume(void) {tpacpi_disable_brightness_delay (); +mutex_lock (&hotkey_mutex);if (hotkey_status_set (true) <0 ||hotkey_mask_set (hotkey_acpi_mask) <0 )pr_err ("error while attempting to reset the event firmware interface\n" ); +mutex_unlock (&hotkey_mutex);tpacpi_send_radiosw_update ();tpacpi_input_send_tabletsw ();
Signature · 1 line
2.40.1
PATCH v3 1/1 platform/x86: thinkpad_acpi: Take mutex in hotkey_resume
In reply to [email protected]hotkey_status_set expects the hotkey_mutex to be held. It seems like it was missed here and that gives lockdep warnings while resuming.
--- drivers/platform/x86/thinkpad_acpi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/platform/x86/thinkpad_acpi.c +2 -0
@@ -4116,9 +4116,11 @@ static void hotkey_resume(void) {tpacpi_disable_brightness_delay (); +mutex_lock (&hotkey_mutex);if (hotkey_status_set (true) <0 ||hotkey_mask_set (hotkey_acpi_mask) <0 )pr_err ("error while attempting to reset the event firmware interface\n" ); +mutex_unlock (&hotkey_mutex);tpacpi_send_radiosw_update ();tpacpi_input_send_tabletsw ();
Signature · 1 line
2.40.1
Hi Dennis,
Quoted 8 lines · Dennis Bonke
hotkey_status_setexpects thehotkey_mutexto be held. It seems like it was missed here and that gives lockdep warnings while resuming.Fixes 38831eaf7d4c ("platform/x86: thinkpad_acpi: use lockdep annotations")Reviewed-by Thomas Weißschuh <[email protected]>Signed-off-by Dennis Bonke <[email protected]>
Thank you for your patch, I've applied this patch to my fixes branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=fixes
Note I have dropped the "Cc: stable@..." tag, because the patch this fixes is not in the last stable release (6.5) so Cc: stable is not necessary.
I will include this patch in my next fixes pull-req to Linus for the current kernel development cycle.
Regards,
Hans
Quoted 20 lines
--- drivers/platform/x86/thinkpad_acpi.c | 2 ++ 1 file changed, 2 insertions(+)drivers/platform/x86/thinkpad_acpi.c +2
-0@@ -4116,9 +4116,11 @@ static void hotkey_resume(void) {tpacpi_disable_brightness_delay (); +mutex_lock (&hotkey_mutex);if (hotkey_status_set (true) <0 ||hotkey_mask_set (hotkey_acpi_mask) <0 )pr_err ("error while attempting to reset the event firmware interface\n" ); +mutex_unlock (&hotkey_mutex);tpacpi_send_radiosw_update ();tpacpi_input_send_tabletsw ();