be2net: use semaphore instead of spin lock for mbox_lock
Subsystems (2)
PATCH 1/1 be2net: use semaphore instead of spin lock for mbox_lock
Since the mbox polling uses the schedule_timeout, the mbox_lock should be a semaphore and not a spin lock.
The commit f25b03a replaced udelay() with schedule_timeout() but didn't change the mbox_lock to a semaphore or a mutex.
--- drivers/net/benet/be.h | 2 +- drivers/net/benet/be_cmds.c | 75 +++++++++++++++++++++++++----------------- drivers/net/benet/be_main.c | 2 +- 3 files changed, 47 insertions(+), 32 deletions(-)
drivers/net/benet/be.h +1 -1
@@ -234,7 +234,7 @@ struct be_adapter {u8 __iomem *db;/* Door Bell */ u8 __iomem *pcicfg;/* PCI config space */ -spinlock_t mbox_lock;/* For serializing mbox cmds to BE card */ +struct semaphore mbox_lock;/* For serializing mbox cmds to BE card */ struct be_dma_mem mbox_mem;/* Mbox mem is adjusted to align to 16 bytes. The allocated addr * is stored for freeing purpose */
drivers/net/benet/be_cmds.c +45 -30
255 lines not on this page · raw message
drivers/net/benet/be_main.c +1 -1
@@ -2677,7 +2677,7 @@ static int be_ctrl_init(struct be_adapter *adapter) }memset (mc_cmd_mem->va,0 , mc_cmd_mem->size); -spin_lock_init (&adapter->mbox_lock); +sema_init (&adapter->mbox_lock,1 );spin_lock_init (&adapter->mcc_lock);spin_lock_init (&adapter->mcc_cq_lock);
Signature · 1 line
1.7.2.2
Quoted 4 lines · Ivan Vecera
Since the mbox polling uses the
schedule_timeout, thembox_lockshould be a semaphore and not a spin lock.
The commit f25b03a replacedudelay()withschedule_timeout()but didn't change thembox_lockto a semaphore or a mutex.
[...]
I see no reason for this to be a semaphore; use a mutex instead.
Ben
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Re: [PATCH net-2.6] be2net: use mutex instead of spin lock for mbox_lock
Quoted 10 lines · Ben Hutchings
Quoted 4 lines · Ivan Vecera
Since the mbox polling uses the
schedule_timeout, thembox_lockshould be a semaphore and not a spin lock.
The commit f25b03a replacedudelay()withschedule_timeout()but didn't change thembox_lockto a semaphore or a mutex.[...]
I see no reason for this to be a semaphore; use a mutex instead.
Ben
Ok, Ben... the new version
Since the mbox polling uses the schedule_timeout, the mbox_lock should be a mutex and not a spin lock.
The commit f25b03a replaced udelay() with schedule_timeout() but didn't change mbox_lock to semaphore or mutex.
--- drivers/net/benet/be.h | 2 +- drivers/net/benet/be_cmds.c | 75 +++++++++++++++++++++++++----------------- drivers/net/benet/be_main.c | 2 +- 3 files changed, 47 insertions(+), 32 deletions(-)
drivers/net/benet/be.h +1 -1
@@ -234,7 +234,7 @@ struct be_adapter {u8 __iomem *db;/* Door Bell */ u8 __iomem *pcicfg;/* PCI config space */ -spinlock_t mbox_lock;/* For serializing mbox cmds to BE card */ +struct mutex mbox_lock;/* For serializing mbox cmds to BE card */ struct be_dma_mem mbox_mem;/* Mbox mem is adjusted to align to 16 bytes. The allocated addr * is stored for freeing purpose */
drivers/net/benet/be_cmds.c +45 -30
255 lines not on this page · raw message
drivers/net/benet/be_main.c +1 -1
@@ -2677,7 +2677,7 @@ static int be_ctrl_init(struct be_adapter *adapter) }memset (mc_cmd_mem->va,0 , mc_cmd_mem->size); -spin_lock_init (&adapter->mbox_lock); +mutex_init (&adapter->mbox_lock);spin_lock_init (&adapter->mcc_lock);spin_lock_init (&adapter->mcc_cq_lock);
Signature · 1 line
1.7.2.2
Re: [PATCH net-2.6] be2net: use mutex instead of spin lock for mbox_lock
From: Ivan Vecera <[email protected]>
Date: Tue, 14 Dec 2010 16:43:19 +0100
Quoted 11 lines · Ben Hutchings
Quoted 10 lines · Ivan Vecera
Quoted 4 lines
Since the mbox polling uses the
schedule_timeout, thembox_lockshould be a semaphore and not a spin lock.
The commit f25b03a replacedudelay()withschedule_timeout()but didn't change thembox_lockto a semaphore or a mutex.[...]
I see no reason for this to be a semaphore; use a mutex instead.
Ben
Quoted 8 lines
Ok, Ben... the new version
Since the mbox polling uses the
schedule_timeout, thembox_lockshould be a mutex and not a spin lock.
The commit f25b03a replacedudelay()withschedule_timeout()but didn't changembox_lockto semaphore or mutex.Signed-off-by Ivan Vecera <[email protected]>
Applied, thanks.