All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/4] mvsas: Deadlocks meet when TMF tasks issue
@ 2009-05-08  6:16 Ying Chu
  2009-05-08 15:49 ` James Bottomley
  0 siblings, 1 reply; 6+ messages in thread
From: Ying Chu @ 2009-05-08  6:16 UTC (permalink / raw)
  To: linux-scsi; +Cc: jeff, james.bottomley

>From 58f754f51fced4a39adcf708319e3de946a0d61a Mon Sep 17 00:00:00 2001
From: Andy <ayan@marvell.com>
Date: Mon, 4 May 2009 23:31:43 +0800
Subject: [PATCH 2/4] bug fix: deal lock 

TMF task need be issued with Interrupt Disabled, or Deadlock may take place.

Signed-off-by: Ying Chu <jasonchu@marvell.com>
Signed-off-by: Andy Yan <ayan@marvell.com>
Signed-off-by: Ke Wei <kewei@marvell.com>
---
 drivers/scsi/mvsas/mv_sas.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
index 318ec01..cb002ef 100644
--- a/drivers/scsi/mvsas/mv_sas.c
+++ b/drivers/scsi/mvsas/mv_sas.c
@@ -1446,7 +1446,7 @@ static int mvs_exec_internal_tmf_task(struct domain_device *dev,
 		task->timer.expires = jiffies + MVS_TASK_TIMEOUT*HZ;
 		add_timer(&task->timer);
 
-		res = mvs_task_exec(task, 1, GFP_KERNEL, NULL, 0, 1, tmf);
+		res = mvs_task_exec(task, 1, GFP_KERNEL, NULL, 1, 1, tmf);
 
 		if (res) {
 			del_timer(&task->timer);
-- 
1.6.0.3

-- 
Regards,
Ying Chu

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/4] mvsas: Deadlocks meet when TMF tasks issue
  2009-05-08  6:16 [PATCH 2/4] mvsas: Deadlocks meet when TMF tasks issue Ying Chu
@ 2009-05-08 15:49 ` James Bottomley
  2009-05-08 22:05   ` Jeff Garzik
  0 siblings, 1 reply; 6+ messages in thread
From: James Bottomley @ 2009-05-08 15:49 UTC (permalink / raw)
  To: Ying Chu; +Cc: linux-scsi, jeff

On Fri, 2009-05-08 at 14:16 +0800, Ying Chu wrote:
> >From 58f754f51fced4a39adcf708319e3de946a0d61a Mon Sep 17 00:00:00 2001
> From: Andy <ayan@marvell.com>
> Date: Mon, 4 May 2009 23:31:43 +0800
> Subject: [PATCH 2/4] bug fix: deal lock 
> 
> TMF task need be issued with Interrupt Disabled, or Deadlock may take place.
> 
> Signed-off-by: Ying Chu <jasonchu@marvell.com>
> Signed-off-by: Andy Yan <ayan@marvell.com>
> Signed-off-by: Ke Wei <kewei@marvell.com>
> ---
>  drivers/scsi/mvsas/mv_sas.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
> index 318ec01..cb002ef 100644
> --- a/drivers/scsi/mvsas/mv_sas.c
> +++ b/drivers/scsi/mvsas/mv_sas.c
> @@ -1446,7 +1446,7 @@ static int mvs_exec_internal_tmf_task(struct domain_device *dev,
>  		task->timer.expires = jiffies + MVS_TASK_TIMEOUT*HZ;
>  		add_timer(&task->timer);
>  
> -		res = mvs_task_exec(task, 1, GFP_KERNEL, NULL, 0, 1, tmf);
> +		res = mvs_task_exec(task, 1, GFP_KERNEL, NULL, 1, 1, tmf);

That eliminates the last user of the unlocked case.

Can't we just drop the conditional lock from mvs_task_exec() now
instead?  It will make the code much cleaner.

James



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/4] mvsas: Deadlocks meet when TMF tasks issue
  2009-05-08 15:49 ` James Bottomley
@ 2009-05-08 22:05   ` Jeff Garzik
  2009-05-09  7:25     ` Andy Yan
  0 siblings, 1 reply; 6+ messages in thread
From: Jeff Garzik @ 2009-05-08 22:05 UTC (permalink / raw)
  To: James Bottomley; +Cc: Ying Chu, linux-scsi

James Bottomley wrote:
> On Fri, 2009-05-08 at 14:16 +0800, Ying Chu wrote:
>> >From 58f754f51fced4a39adcf708319e3de946a0d61a Mon Sep 17 00:00:00 2001
>> From: Andy <ayan@marvell.com>
>> Date: Mon, 4 May 2009 23:31:43 +0800
>> Subject: [PATCH 2/4] bug fix: deal lock 
>>
>> TMF task need be issued with Interrupt Disabled, or Deadlock may take place.
>>
>> Signed-off-by: Ying Chu <jasonchu@marvell.com>
>> Signed-off-by: Andy Yan <ayan@marvell.com>
>> Signed-off-by: Ke Wei <kewei@marvell.com>
>> ---
>>  drivers/scsi/mvsas/mv_sas.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
>> index 318ec01..cb002ef 100644
>> --- a/drivers/scsi/mvsas/mv_sas.c
>> +++ b/drivers/scsi/mvsas/mv_sas.c
>> @@ -1446,7 +1446,7 @@ static int mvs_exec_internal_tmf_task(struct domain_device *dev,
>>  		task->timer.expires = jiffies + MVS_TASK_TIMEOUT*HZ;
>>  		add_timer(&task->timer);
>>  
>> -		res = mvs_task_exec(task, 1, GFP_KERNEL, NULL, 0, 1, tmf);
>> +		res = mvs_task_exec(task, 1, GFP_KERNEL, NULL, 1, 1, tmf);
> 
> That eliminates the last user of the unlocked case.
> 
> Can't we just drop the conditional lock from mvs_task_exec() now
> instead?  It will make the code much cleaner.

Agreed...



^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 2/4] mvsas: Deadlocks meet when TMF tasks issue
  2009-05-08 22:05   ` Jeff Garzik
@ 2009-05-09  7:25     ` Andy Yan
  2009-05-09  7:30       ` Jeff Garzik
  2009-05-09 15:05       ` James Bottomley
  0 siblings, 2 replies; 6+ messages in thread
From: Andy Yan @ 2009-05-09  7:25 UTC (permalink / raw)
  To: Jeff Garzik, James Bottomley; +Cc: Ying Chu, linux-scsi

James,
	For considering the possibility of future use, I did not remove the parameter; I will check this and remove it with next patch if it is OK.

Regards
Andy Yan


-----Original Message-----
From: linux-scsi-owner@vger.kernel.org [mailto:linux-scsi-owner@vger.kernel.org] On Behalf Of Jeff Garzik
Sent: 2009年5月9日 6:06
To: James Bottomley
Cc: Ying Chu; linux-scsi@vger.kernel.org
Subject: Re: [PATCH 2/4] mvsas: Deadlocks meet when TMF tasks issue

James Bottomley wrote:
> On Fri, 2009-05-08 at 14:16 +0800, Ying Chu wrote:
>> >From 58f754f51fced4a39adcf708319e3de946a0d61a Mon Sep 17 00:00:00 2001
>> From: Andy <ayan@marvell.com>
>> Date: Mon, 4 May 2009 23:31:43 +0800
>> Subject: [PATCH 2/4] bug fix: deal lock 
>>
>> TMF task need be issued with Interrupt Disabled, or Deadlock may take place.
>>
>> Signed-off-by: Ying Chu <jasonchu@marvell.com>
>> Signed-off-by: Andy Yan <ayan@marvell.com>
>> Signed-off-by: Ke Wei <kewei@marvell.com>
>> ---
>>  drivers/scsi/mvsas/mv_sas.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
>> index 318ec01..cb002ef 100644
>> --- a/drivers/scsi/mvsas/mv_sas.c
>> +++ b/drivers/scsi/mvsas/mv_sas.c
>> @@ -1446,7 +1446,7 @@ static int mvs_exec_internal_tmf_task(struct domain_device *dev,
>>  		task->timer.expires = jiffies + MVS_TASK_TIMEOUT*HZ;
>>  		add_timer(&task->timer);
>>  
>> -		res = mvs_task_exec(task, 1, GFP_KERNEL, NULL, 0, 1, tmf);
>> +		res = mvs_task_exec(task, 1, GFP_KERNEL, NULL, 1, 1, tmf);
> 
> That eliminates the last user of the unlocked case.
> 
> Can't we just drop the conditional lock from mvs_task_exec() now
> instead?  It will make the code much cleaner.

Agreed...


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/4] mvsas: Deadlocks meet when TMF tasks issue
  2009-05-09  7:25     ` Andy Yan
@ 2009-05-09  7:30       ` Jeff Garzik
  2009-05-09 15:05       ` James Bottomley
  1 sibling, 0 replies; 6+ messages in thread
From: Jeff Garzik @ 2009-05-09  7:30 UTC (permalink / raw)
  To: Andy Yan; +Cc: James Bottomley, Ying Chu, linux-scsi

Andy Yan wrote:
> James,
> 	For considering the possibility of future use, I did not remove the parameter; I will check this and remove it with next patch if it is OK.


Generally, we encourage immediate elimination of all code not actively used.

The only major exception to this rule is structures or ABI that are 
visible to userland, such as ioctls, where we must maintain binary 
compatibility.

	Jeff



^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 2/4] mvsas: Deadlocks meet when TMF tasks issue
  2009-05-09  7:25     ` Andy Yan
  2009-05-09  7:30       ` Jeff Garzik
@ 2009-05-09 15:05       ` James Bottomley
  1 sibling, 0 replies; 6+ messages in thread
From: James Bottomley @ 2009-05-09 15:05 UTC (permalink / raw)
  To: Andy Yan; +Cc: Jeff Garzik, Ying Chu, linux-scsi

On Sat, 2009-05-09 at 00:25 -0700, Andy Yan wrote:
> 	For considering the possibility of future use, I did not remove the parameter; I will check this and remove it with next patch if it is OK.

Well, there are two reasons for removing it.  The first is that it's
unused, but the second is that conditional locking isn't very nice
programming style, since it makes control flow far harder to follow
rationally when just reading the code.  The preferred style is to define
a function that does the unlocked operation, usually with double
underscores and then have a locked version that takes the lock, calls
the double underscore unlocked version and releases the lock again.  In
your case, if you find a use for the unlocked version, you can split it
in the patch that's using it.

Looking at the routine, the only thing you call outside the lock is
mvs_find_dev_mvi().  The thing that strikes me here is that this is a
bit inefficient: why not store mvi in struct mvs_device?  Then you can
get it as a simple pointer operation instead of having to search.

James



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-05-09 15:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-08  6:16 [PATCH 2/4] mvsas: Deadlocks meet when TMF tasks issue Ying Chu
2009-05-08 15:49 ` James Bottomley
2009-05-08 22:05   ` Jeff Garzik
2009-05-09  7:25     ` Andy Yan
2009-05-09  7:30       ` Jeff Garzik
2009-05-09 15:05       ` James Bottomley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.