mei: me: reduce the scope on unexpected reset
Subsystems (2)
Alexander Usyskin
maintainerPATCH v3 1/1 mei: me: reduce the scope on unexpected reset
After commit 2cedb296988c ("mei: me: trigger link reset if hw ready is unexpected") some devices started to show long resume times (5-7 seconds).
This happens as mei falsely detects unready hardware,
starts parallel link reset flow and triggers link reset timeouts
in the resume callback.
Address it by performing detection of unready hardware only when driver is in the ENABLED state instead of blacklisting states as done in the original patch.
---
V3: reword commit message, add Rafael and PM list
V2: rebase over v7.0-rc4
drivers/misc/mei/hw-me.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/misc/mei/hw-me.c +4 -10
@@ -1337,19 +1337,13 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)/* check if we need to start the dev */ if (!mei_host_is_ready (dev)) {if (mei_hw_is_ready (dev)) { -/* synchronized by dev mutex */ -if (waitqueue_active (&dev->wait_hw_ready)) { -dev_dbg (&dev->dev,"we need to start the dev.\n" ); - dev->recvd_hw_ready = true; -wake_up (&dev->wait_hw_ready); - }else if (dev->dev_state !=MEI_DEV_UNINITIALIZED && - dev->dev_state !=MEI_DEV_POWERING_DOWN && - dev->dev_state !=MEI_DEV_POWER_DOWN ) { +if (dev->dev_state ==MEI_DEV_ENABLED ) {dev_dbg (&dev->dev,"Force link reset.\n" );schedule_work (&dev->reset_work); }else { -dev_dbg (&dev->dev,"Ignore this interrupt in state = %d\n" , - dev->dev_state); +dev_dbg (&dev->dev,"we need to start the dev.\n" ); + dev->recvd_hw_ready = true; +wake_up (&dev->wait_hw_ready); } }else {dev_dbg (&dev->dev,"Spurious Interrupt\n" );
Signature · 1 line
2.43.0
Quoted 30 lines · Alexander Usyskin
After commit
2cedb296988c("mei: me: trigger link reset if hw ready is unexpected") some devices started to show long resume times (5-7 seconds).
This happens as mei falsely detects unready hardware,
starts parallel link reset flow and triggers link reset timeouts
in the resume callback.Address it by performing detection of unready hardware only when driver is in the ENABLED state instead of blacklisting states as done in the original patch.
Reported-by Todd Brandt <[email protected]>Tested-by Todd Brandt <[email protected]>Fixes 2cedb296988c ("mei: me: trigger link reset if hw ready is unexpected")Signed-off-by Alexander Usyskin <[email protected]>---
V3: reword commit message, add Rafael and PM list
V2: rebase over v7.0-rc4
drivers/misc/mei/hw-me.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)drivers/misc/mei/hw-me.c +0
-0
drivers/misc/mei/hw-me.c irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id) · line 1340
Quoted 4 lines
drivers/misc/mei/hw-me.c +0
-1@@ -1337,19 +1337,13 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)/* check if we need to start the dev */ if (!mei_host_is_ready (dev)) {if (mei_hw_is_ready (dev)) { -/* synchronized by dev mutex */
I think that the comment above is still valid, isn't it? If so, why remove it?
drivers/misc/mei/hw-me.c irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id) · line 1343
Quoted 11 lines
drivers/misc/mei/hw-me.c +1
-7-if (waitqueue_active (&dev->wait_hw_ready)) { -dev_dbg (&dev->dev,"we need to start the dev.\n" ); - dev->recvd_hw_ready = true; -wake_up (&dev->wait_hw_ready); - }else if (dev->dev_state !=MEI_DEV_UNINITIALIZED && - dev->dev_state !=MEI_DEV_POWERING_DOWN && - dev->dev_state !=MEI_DEV_POWER_DOWN ) { +if (dev->dev_state ==MEI_DEV_ENABLED ) {dev_dbg (&dev->dev,"Force link reset.\n" );schedule_work (&dev->reset_work); }else {
Isn't the waitqueue_active() check needed any more?
Quoted 9 lines
drivers/misc/mei/hw-me.c +3
-3-dev_dbg (&dev->dev,"Ignore this interrupt in state = %d\n" , - dev->dev_state); +dev_dbg (&dev->dev,"we need to start the dev.\n" ); + dev->recvd_hw_ready = true; +wake_up (&dev->wait_hw_ready); } }else {dev_dbg (&dev->dev,"Spurious Interrupt\n" ); --
Usyskin, Alexander
maintainerQuoted 55 lines
Subject: Re: [char-misc v3] mei: me: reduce the scope on unexpected reset
Quoted 2 lines · Alexander Usyskin
After commit
2cedb296988c("mei: me: trigger link reset if hw ready isunexpected")
drivers/misc/mei/hw-me.c irqreturn_t mei_me_irq_thread_handler(int
Quoted 28 lines
some devices started to show long resume times (5-7 seconds). This happens as mei falsely detects unready hardware, starts parallel link reset flow and triggers link reset timeouts in the resume callback.
Address it by performing detection of unready hardware only when driver is in the ENABLED state instead of blacklisting states as done in the original patch.
Reported-by Todd Brandt <[email protected]>Tested-by Todd Brandt <[email protected]>Fixes 2cedb296988c ("mei: me: trigger link reset if hw ready is unexpected")Signed-off-by Alexander Usyskin <[email protected]>---
V3: reword commit message, add Rafael and PM list
V2: rebase over v7.0-rc4
drivers/misc/mei/hw-me.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)drivers/misc/mei/hw-me.c +0
-0@@ -1337,19 +1337,13 @@ irqreturn_t mei_me_irq_thread_handler(intirq, void
*dev_id)drivers/misc/mei/hw-me.c irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id) · line 1340
Quoted 4 lines
drivers/misc/mei/hw-me.c +0
-1/* check if we need to start the dev */ if (!mei_host_is_ready (dev)) {if (mei_hw_is_ready (dev)) { -/* synchronized by dev mutex */ I think that the comment above is still valid, isn't it? If so, why remove it?
drivers/misc/mei/hw-me.c irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id) · line 1343
Quoted 11 lines
drivers/misc/mei/hw-me.c +1
-7-if (waitqueue_active (&dev->wait_hw_ready)) { -dev_dbg (&dev->dev,"we need to start the dev.\n" ); - dev->recvd_hw_ready = true; -wake_up (&dev->wait_hw_ready); - }else if (dev->dev_state !=MEI_DEV_UNINITIALIZED && - dev->dev_state !=MEI_DEV_POWERING_DOWN && - dev->dev_state !=MEI_DEV_POWER_DOWN ) { +if (dev->dev_state ==MEI_DEV_ENABLED ) {dev_dbg (&dev->dev,"Force link reset.\n" );schedule_work (&dev->reset_work); }else {
Quoted 2 lines
Isn't the
waitqueue_active()check needed any more?
The fix simplifies original patch as in MEI_DEV_ENABLED state there will be no active waitqueue. This also removes need for comment about waitqueue synchronization.
- -
Thanks,
Sasha
Rafael J. Wysocki
Reviewed-byQuoted 56 lines · Alexander
Quoted 56 lines
Subject: Re: [char-misc v3] mei: me: reduce the scope on unexpected reset
Quoted 2 lines · Alexander Usyskin
After commit
2cedb296988c("mei: me: trigger link reset if hw ready isunexpected")
drivers/misc/mei/hw-me.c irqreturn_t mei_me_irq_thread_handler(int
Quoted 28 lines
some devices started to show long resume times (5-7 seconds). This happens as mei falsely detects unready hardware, starts parallel link reset flow and triggers link reset timeouts in the resume callback.
Address it by performing detection of unready hardware only when driver is in the ENABLED state instead of blacklisting states as done in the original patch.
Reported-by Todd Brandt <[email protected]>Tested-by Todd Brandt <[email protected]>Fixes 2cedb296988c ("mei: me: trigger link reset if hw ready is unexpected")Signed-off-by Alexander Usyskin <[email protected]>---
V3: reword commit message, add Rafael and PM list
V2: rebase over v7.0-rc4
drivers/misc/mei/hw-me.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)drivers/misc/mei/hw-me.c +0
-0@@ -1337,19 +1337,13 @@ irqreturn_t mei_me_irq_thread_handler(intirq, void
*dev_id)drivers/misc/mei/hw-me.c irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id) · line 1340
Quoted 4 lines
drivers/misc/mei/hw-me.c +0
-1/* check if we need to start the dev */ if (!mei_host_is_ready (dev)) {if (mei_hw_is_ready (dev)) { -/* synchronized by dev mutex */ I think that the comment above is still valid, isn't it? If so, why remove it?
Quoted 11 lines
drivers/misc/mei/hw-me.c +1
-7-if (waitqueue_active (&dev->wait_hw_ready)) { -dev_dbg (&dev->dev,"we need to start the dev.\n" ); - dev->recvd_hw_ready = true; -wake_up (&dev->wait_hw_ready); - }else if (dev->dev_state !=MEI_DEV_UNINITIALIZED && - dev->dev_state !=MEI_DEV_POWERING_DOWN && - dev->dev_state !=MEI_DEV_POWER_DOWN ) { +if (dev->dev_state ==MEI_DEV_ENABLED ) {dev_dbg (&dev->dev,"Force link reset.\n" );schedule_work (&dev->reset_work); }else {
Quoted 5 lines
Quoted 2 lines
Isn't the
waitqueue_active()check needed any more?The fix simplifies original patch as in
MEI_DEV_ENABLEDstate there will be no active waitqueue. This also removes need for comment about waitqueue synchronization.
I see, thanks.
It would be good to add the above information to the patch changelog.
With that, please feel free to add
to the patch.