DSPBRIDGE: Fix to avoid possible recursive locking
PATCH v4 1/1 DSPBRIDGE: Fix to avoid possible recursive locking
Removed NTFY_Notify() in WMD_MSG_Get() to avoid locking contention as NTFY_Notify() is already invoked in InputMsg().
---
Ref:
v0:http://marc.info/?l=linux-omap&m=126584779011493&w=2 v1:http://marc.info/?l=linux-omap&m=126586224627725&w=2 v2:http://marc.info/?l=linux-omap&m=126591341909124&w=2 v3:http://marc.info/?l=linux-omap&m=126591743315572&w=2 v4:Comment fixes from v3
drivers/dsp/bridge/wmd/msg_sm.c | 10 ++-------- 1 files changed, 2 insertions(+), 8 deletions(-)
drivers/dsp/bridge/wmd/msg_sm.c +2 -8
@@ -295,11 +295,8 @@ DSP_STATUS WMD_MSG_Get(struct MSG_QUEUE *hMsgQueue, (struct list_head *)pMsgFrame);if (LST_IsEmpty (hMsgQueue->msgUsedList))SYNC_ResetEvent (hMsgQueue->hSyncEvent); -else { -NTFY_Notify (hMsgQueue->hNtfy, -DSP_NODEMESSAGEREADY ); +else SYNC_SetEvent (hMsgQueue->hSyncEvent); - } fGotMsg = true; }
@@ -347,11 +344,8 @@ DSP_STATUS WMD_MSG_Get(struct MSG_QUEUE *hMsgQueue, } hMsgQueue->refCount--;/* Reset the event if there are still queued messages */ -if (!LST_IsEmpty (hMsgQueue->msgUsedList)) { -NTFY_Notify (hMsgQueue->hNtfy, -DSP_NODEMESSAGEREADY ); +if (!LST_IsEmpty (hMsgQueue->msgUsedList))SYNC_SetEvent (hMsgQueue->hSyncEvent); - }/* Exit critical section */ (void )SYNC_LeaveCS (hMsgMgr->hSyncCS); }
Signature · 1 line
1.6.3.3
Quoted 8 lines · ext Deepak Chitriki
Removed
NTFY_Notify()inWMD_MSG_Get()to avoid locking contention asNTFY_Notify()is already invoked inInputMsg().Cc Ameya Palande <[email protected]>Cc Omar Ramirez Luna <[email protected]>Cc Nishanth Menon <[email protected]>Signed-off-by Deepak Chitriki <[email protected]>
Quoted 41 lines
---
Ref:
v0:http://marc.info/?l=linux-omap&m=126584779011493&w=2 v1:http://marc.info/?l=linux-omap&m=126586224627725&w=2 v2:http://marc.info/?l=linux-omap&m=126591341909124&w=2 v3:http://marc.info/?l=linux-omap&m=126591743315572&w=2 v4:Comment fixes from v3drivers/dsp/bridge/wmd/msg_sm.c | 10 ++-------- 1 files changed, 2 insertions(+), 8 deletions(-)drivers/dsp/bridge/wmd/msg_sm.c +2
-8@@ -295,11 +295,8 @@ DSP_STATUS WMD_MSG_Get(struct MSG_QUEUE *hMsgQueue, (struct list_head *)pMsgFrame);if (LST_IsEmpty (hMsgQueue->msgUsedList))SYNC_ResetEvent (hMsgQueue->hSyncEvent); -else { -NTFY_Notify (hMsgQueue->hNtfy, -DSP_NODEMESSAGEREADY ); +else SYNC_SetEvent (hMsgQueue->hSyncEvent); - } fGotMsg = true; }@@ -347,11 +344,8 @@ DSP_STATUS WMD_MSG_Get(struct MSG_QUEUE *hMsgQueue, } hMsgQueue->refCount--;/* Reset the event if there are still queued messages */ -if (!LST_IsEmpty (hMsgQueue->msgUsedList)) { -NTFY_Notify (hMsgQueue->hNtfy, -DSP_NODEMESSAGEREADY ); +if (!LST_IsEmpty (hMsgQueue->msgUsedList))SYNC_SetEvent (hMsgQueue->hSyncEvent); - }/* Exit critical section */ (void )SYNC_LeaveCS (hMsgMgr->hSyncCS); }
Hi,
Quoted 10 lines
From: Ameya Palande [mailto:[email protected]]
Sent: Friday, February 12, 2010 12:21 AM
To: Chitriki Rudramuni, Deepak
Cc: linux-omap; Ramirez Luna, Omar; Menon, Nishanth
Subject: Re: [PATCH v4] DSPBRIDGE: Fix to avoid possible recursive lockingQuoted 3 lines · ext Deepak Chitriki
Removed
NTFY_Notify()inWMD_MSG_Get()to avoid locking contention asNTFY_Notify()is already invoked inInputMsg().
Quoted 7 lines
Quoted 5 lines
Cc Ameya Palande <[email protected]>Cc Omar Ramirez Luna <[email protected]>Cc Nishanth Menon <[email protected]>Signed-off-by Deepak Chitriki <[email protected]>Acked-by Ameya Palande <[email protected]>
Could this patch be pushed if there are no more comments?
Quoted 28 lines
Quoted 9 lines
---
Ref:
v0:http://marc.info/?l=linux-omap&m=126584779011493&w=2 v1:http://marc.info/?l=linux-omap&m=126586224627725&w=2 v2:http://marc.info/?l=linux-omap&m=126591341909124&w=2 v3:http://marc.info/?l=linux-omap&m=126591743315572&w=2 v4:Comment fixes from v3Review
Quoted 4 lines
drivers/dsp/bridge/wmd/msg_sm.c | 10 ++-------- 1 files changed, 2 insertions(+), 8 deletions(-)(quoted diff) +0
-0
b/drivers/dsp/bridge/wmd/msg_sm.cQuoted 14 lines
index 3a275f1..8475e20 100644
drivers/dsp/bridge/wmd/msg_sm.c +1
-4@@ -295,11 +295,8 @@ DSP_STATUS WMD_MSG_Get(struct MSG_QUEUE *hMsgQueue, (struct list_head *)pMsgFrame);if (LST_IsEmpty (hMsgQueue->msgUsedList))SYNC_ResetEvent (hMsgQueue->hSyncEvent); -else { -NTFY_Notify (hMsgQueue->hNtfy, -DSP_NODEMESSAGEREADY ); +else SYNC_SetEvent (hMsgQueue->hSyncEvent); - }
Quoted 15 lines
Quoted 5 lines
drivers/dsp/bridge/wmd/msg_sm.c +0
-0fGotMsg = true; }@@ -347,11 +344,8 @@ DSP_STATUS WMD_MSG_Get(struct MSG_QUEUE *hMsgQueue, } hMsgQueue->refCount--;drivers/dsp/bridge/wmd/msg_sm.c DSP_STATUS WMD_MSG_Get(struct MSG_QUEUE *hMsgQueue, · line 351
Quoted 10 lines
drivers/dsp/bridge/wmd/msg_sm.c +1
-4/* Reset the event if there are still queued messages */ -if (!LST_IsEmpty (hMsgQueue->msgUsedList)) { -NTFY_Notify (hMsgQueue->hNtfy, -DSP_NODEMESSAGEREADY ); +if (!LST_IsEmpty (hMsgQueue->msgUsedList))SYNC_SetEvent (hMsgQueue->hSyncEvent); - }/* Exit critical section */ (void )SYNC_LeaveCS (hMsgMgr->hSyncCS); }
Regards,
Nishanth Menon
Quoted 16 lines · Nishanth
Hi,
Quoted 14 lines
From: Ameya Palande [mailto:[email protected]]
Sent: Friday, February 12, 2010 12:21 AM
To: Chitriki Rudramuni, Deepak
Cc: linux-omap; Ramirez Luna, Omar; Menon, Nishanth
Subject: Re: [PATCH v4] DSPBRIDGE: Fix to avoid possible recursive lockingQuoted 7 lines · ext Deepak Chitriki
Removed
NTFY_Notify()inWMD_MSG_Get()to avoid locking contention asNTFY_Notify()is already invoked inInputMsg().Cc Ameya Palande<[email protected]>Cc Omar Ramirez Luna<[email protected]>Cc Nishanth Menon<[email protected]>
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Deepak Chitriki<[email protected]>Acked-by Ameya Palande<[email protected]>Could this patch be pushed if there are no more comments?
Instead of pushing this patch I'll be reverting this one:
http://marc.info/?l=linux-omap&m=125694410627720&w=2
Explanation:
After reviewing the scenario it seems that the patch "fixing a flood of messages usecase" doesn't seem to be the proper way to fix it.
If the dsp sends 10 messages in a shot for the same client and bridge process them without interrupt, if the client is using DSPManager_WaitForEvents, InputMsg function will notify of all of them but "WaitForEvents" will only catch one notification, then client will call GetMsg ioctl and pick one message from the queue leaving 9 of them still there, whenever WaitForEvents is executed again there won't be a Notification if the dsp stopped sending messages to the same queue, so those 9 messages never will be retrieved because WaitForEvents will timeout.
The fix was only to re-notify the client that a message was still available in its queue and that it needs to pick it up, all of this during GetMsg, however this seems to be triggering a kernel warning because of nested spinlocks called for separate objects.
The reason to avoid pushing this patch is that it is leaving a part of the code introduced by the "flooding" fix.
Please let me know if anyone has comments.
- omar
Quoted 57 lines
-----Original Message-----
From: Ramirez Luna, Omar
Sent: Thursday, February 18, 2010 8:27 PM
To: Menon, Nishanth
Cc: Ameya Palande; Chitriki Rudramuni, Deepak; linux-omap; Guzman Lugo, Fernando
Subject: Re: [PATCH v4] DSPBRIDGE: Fix to avoid possible recursive lockingQuoted 7 lines · Nishanth
Hi,
Quoted 5 lines
From: Ameya Palande [mailto:[email protected]]
Sent: Friday, February 12, 2010 12:21 AM
To: Chitriki Rudramuni, Deepak
Cc: linux-omap; Ramirez Luna, Omar; Menon, Nishanth
Subject: Re: [PATCH v4] DSPBRIDGE: Fix to avoid possible recursivelocking
Quoted 9 lines
Quoted 9 lines · ext Deepak Chitriki
Quoted 7 lines
Removed
NTFY_Notify()inWMD_MSG_Get()to avoid locking contention asNTFY_Notify()is already invoked inInputMsg().Cc Ameya Palande<[email protected]>Cc Omar Ramirez Luna<[email protected]>Cc Nishanth Menon<[email protected]>Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Deepak Chitriki<[email protected]>Acked-by Ameya Palande<[email protected]>Could this patch be pushed if there are no more comments?
Instead of pushing this patch I'll be reverting this one:
http://marc.info/?l=linux-omap&m=125694410627720&w=2
Explanation:
After reviewing the scenario it seems that the patch "fixing a flood of messages usecase" doesn't seem to be the proper way to fix it.
If the dsp sends 10 messages in a shot for the same client and bridge process them without interrupt, if the client is using
DSPManager_WaitForEvents, InputMsg function will notify of all of them but "WaitForEvents" will only catch one notification, then client will call GetMsg ioctl and pick one message from the queue leaving 9 of them still there, whenever WaitForEvents is executed again there won't be a Notification if the dsp stopped sending messages to the same queue, so those 9 messages never will be retrieved because WaitForEvents will timeout.The fix was only to re-notify the client that a message was still available in its queue and that it needs to pick it up, all of this during GetMsg, however this seems to be triggering a kernel warning because of nested spinlocks called for separate objects.
Quoted 4 lines
The reason to avoid pushing this patch is that it is leaving a part of the code introduced by the "flooding" fix.
Please let me know if anyone has comments.
So, do we have a clean complete fix? Why not leave the partial fix which we have in place and incorporate the clean fix on top of that? I would prefer to have something here instead of nothing at all.. but that is just me.
Quoted 2 lines
- omar
Regards,
Nishanth Menon
Quoted 1 line · Nishanth
[...]
Quoted 25 lines
Quoted 25 lines
Instead of pushing this patch I'll be reverting this one:
http://marc.info/?l=linux-omap&m=125694410627720&w=2
Explanation:
After reviewing the scenario it seems that the patch "fixing a flood of messages usecase" doesn't seem to be the proper way to fix it.
If the dsp sends 10 messages in a shot for the same client and bridge process them without interrupt, if the client is using
DSPManager_WaitForEvents, InputMsg function will notify of all of them but "WaitForEvents" will only catch one notification, then client will call GetMsg ioctl and pick one message from the queue leaving 9 of them still there, whenever WaitForEvents is executed again there won't be a Notification if the dsp stopped sending messages to the same queue, so those 9 messages never will be retrieved because WaitForEvents will timeout.The fix was only to re-notify the client that a message was still available in its queue and that it needs to pick it up, all of this during GetMsg, however this seems to be triggering a kernel warning because of nested spinlocks called for separate objects.
Quoted 7 lines
Quoted 4 lines
The reason to avoid pushing this patch is that it is leaving a part of the code introduced by the "flooding" fix.
Please let me know if anyone has comments.
So, do we have a clean complete fix? Why not leave the partial fix which we have in place and incorporate the clean fix on top of that? I would prefer to have something here instead of nothing at all.. but that is just me.
I wrongly pushed Deepak's fix when updating dspbridge, when I revert the old patch it will remove the other line too.
The partial fix is solving the kernel warning but is useless for the flooding of DSP messages, because the line left which is SYNC_SetEvent needs an actual event to be waiting, so right now it is not doing anything (in the original patch wasn't doing anything either), so before we forget that the line left there is useless I'm reverting the patch.
Regards,
Omar