public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] aic94xx: fix SMP request DMA direction
@ 2007-09-28  2:33 Jeff Garzik
  2007-09-28 23:55 ` Darrick J. Wong
  0 siblings, 1 reply; 6+ messages in thread
From: Jeff Garzik @ 2007-09-28  2:33 UTC (permalink / raw)
  To: linux-scsi


Unless I'm missing something, the SMP request goes /to/ the PCI device :)

Signed-off-by: Jeff Garzik <jeff@garzik.org>
---
 drivers/scsi/aic94xx/aic94xx_task.c |    4 -
 2 files changed, 83 insertions(+), 17 deletions(-)

diff --git a/drivers/scsi/aic94xx/aic94xx_task.c b/drivers/scsi/aic94xx/aic94xx_task.c
index d5d8cab..ab13824 100644
--- a/drivers/scsi/aic94xx/aic94xx_task.c
+++ b/drivers/scsi/aic94xx/aic94xx_task.c
@@ -451,7 +451,7 @@ static int asd_build_smp_ascb(struct asd_ascb *ascb, struct sas_task *task,
 	struct scb *scb;
 
 	pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_req, 1,
-		   PCI_DMA_FROMDEVICE);
+		   PCI_DMA_TODEVICE);
 	pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_resp, 1,
 		   PCI_DMA_FROMDEVICE);
 
@@ -486,7 +486,7 @@ static void asd_unbuild_smp_ascb(struct asd_ascb *a)
 
 	BUG_ON(!task);
 	pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_req, 1,
-		     PCI_DMA_FROMDEVICE);
+		     PCI_DMA_TODEVICE);
 	pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_resp, 1,
 		     PCI_DMA_FROMDEVICE);
 }

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

* Re: [PATCH] aic94xx: fix SMP request DMA direction
  2007-09-28  2:33 [PATCH] aic94xx: fix SMP request DMA direction Jeff Garzik
@ 2007-09-28 23:55 ` Darrick J. Wong
  2007-09-29  6:22   ` Muli Ben-Yehuda
  0 siblings, 1 reply; 6+ messages in thread
From: Darrick J. Wong @ 2007-09-28 23:55 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-scsi

On Thu, Sep 27, 2007 at 10:33:41PM -0400, Jeff Garzik wrote:
> 
> Unless I'm missing something, the SMP request goes /to/ the PCI device :)
> 
> Signed-off-by: Jeff Garzik <jeff@garzik.org>

ACK; builds ok and SMP commands seem to work ok (not that they didn't
before).

--Darrick

> ---
>  drivers/scsi/aic94xx/aic94xx_task.c |    4 -
>  2 files changed, 83 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/scsi/aic94xx/aic94xx_task.c b/drivers/scsi/aic94xx/aic94xx_task.c
> index d5d8cab..ab13824 100644
> --- a/drivers/scsi/aic94xx/aic94xx_task.c
> +++ b/drivers/scsi/aic94xx/aic94xx_task.c
> @@ -451,7 +451,7 @@ static int asd_build_smp_ascb(struct asd_ascb *ascb, struct sas_task *task,
>  	struct scb *scb;
> 
>  	pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_req, 1,
> -		   PCI_DMA_FROMDEVICE);
> +		   PCI_DMA_TODEVICE);
>  	pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_resp, 1,
>  		   PCI_DMA_FROMDEVICE);
> 
> @@ -486,7 +486,7 @@ static void asd_unbuild_smp_ascb(struct asd_ascb *a)
> 
>  	BUG_ON(!task);
>  	pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_req, 1,
> -		     PCI_DMA_FROMDEVICE);
> +		     PCI_DMA_TODEVICE);
>  	pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_resp, 1,
>  		     PCI_DMA_FROMDEVICE);
>  }
> -
> 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] aic94xx: fix SMP request DMA direction
  2007-09-28 23:55 ` Darrick J. Wong
@ 2007-09-29  6:22   ` Muli Ben-Yehuda
  2007-09-29  6:25     ` Jeff Garzik
  0 siblings, 1 reply; 6+ messages in thread
From: Muli Ben-Yehuda @ 2007-09-29  6:22 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Jeff Garzik, linux-scsi

On Fri, Sep 28, 2007 at 04:55:34PM -0700, Darrick J. Wong wrote:
> On Thu, Sep 27, 2007 at 10:33:41PM -0400, Jeff Garzik wrote:
> > 
> > Unless I'm missing something, the SMP request goes /to/ the PCI device :)
> > 
> > Signed-off-by: Jeff Garzik <jeff@garzik.org>
> 
> ACK; builds ok and SMP commands seem to work ok (not that they
> didn't before).

Could this explain some weirdness we were seeing with aic94xx and
Calgary/CalIOC2 enabled, or are SMP commands not likely to be used in
normal operation? We map the IOMMU entries differently for FROMDEVICE
(RW) and TODEVICE(RO).

Cheers,
Muli
-- 
SYSTOR 2007 --- 1st Annual Haifa Systems and Storage Conference 2007
http://www.haifa.il.ibm.com/Workshops/systor2007/

Oct 29, 2007: virtualization workshop | Oct 30, 2007: storage workshop

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

* Re: [PATCH] aic94xx: fix SMP request DMA direction
  2007-09-29  6:22   ` Muli Ben-Yehuda
@ 2007-09-29  6:25     ` Jeff Garzik
  2007-09-30  7:13       ` Darrick J. Wong
  0 siblings, 1 reply; 6+ messages in thread
From: Jeff Garzik @ 2007-09-29  6:25 UTC (permalink / raw)
  To: Muli Ben-Yehuda; +Cc: Darrick J. Wong, linux-scsi

Muli Ben-Yehuda wrote:
> On Fri, Sep 28, 2007 at 04:55:34PM -0700, Darrick J. Wong wrote:
>> On Thu, Sep 27, 2007 at 10:33:41PM -0400, Jeff Garzik wrote:
>>> Unless I'm missing something, the SMP request goes /to/ the PCI device :)
>>>
>>> Signed-off-by: Jeff Garzik <jeff@garzik.org>
>> ACK; builds ok and SMP commands seem to work ok (not that they
>> didn't before).
> 
> Could this explain some weirdness we were seeing with aic94xx and
> Calgary/CalIOC2 enabled, or are SMP commands not likely to be used in
> normal operation? We map the IOMMU entries differently for FROMDEVICE
> (RW) and TODEVICE(RO).

SMP == scsi management == not used during normal data transfer.

It could certainly explain flakiness if you have expanders, though

	Jeff




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

* Re: [PATCH] aic94xx: fix SMP request DMA direction
  2007-09-29  6:25     ` Jeff Garzik
@ 2007-09-30  7:13       ` Darrick J. Wong
  2007-09-30  7:26         ` Muli Ben-Yehuda
  0 siblings, 1 reply; 6+ messages in thread
From: Darrick J. Wong @ 2007-09-30  7:13 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Muli Ben-Yehuda, linux-scsi

On Sat, Sep 29, 2007 at 02:25:33AM -0400, Jeff Garzik wrote:
> Muli Ben-Yehuda wrote:
>> On Fri, Sep 28, 2007 at 04:55:34PM -0700, Darrick J. Wong wrote:
>>> On Thu, Sep 27, 2007 at 10:33:41PM -0400, Jeff Garzik wrote:
>>>> Unless I'm missing something, the SMP request goes /to/ the PCI device 
>>>> :)
>>>>
>>>> Signed-off-by: Jeff Garzik <jeff@garzik.org>
>>> ACK; builds ok and SMP commands seem to work ok (not that they
>>> didn't before).
>> Could this explain some weirdness we were seeing with aic94xx and
>> Calgary/CalIOC2 enabled, or are SMP commands not likely to be used in
>> normal operation? We map the IOMMU entries differently for FROMDEVICE
>> (RW) and TODEVICE(RO).
>
> SMP == scsi management == not used during normal data transfer.
>
> It could certainly explain flakiness if you have expanders, though

Actually, SMP commands are used during device discovery to find things
attached to expanders, so it seems likely that "it blows up almost
immediately after loading the module" symptoms are a result of this bug.

That said, the bug that Jeff fixed resulted in extra permissions (+w)
being set for the SMP request buffer, so that's probably why I've never
seen any problems manifesting on x260/x3800 systems.

(Unless the CalIOC2 has a write only mode?)

--D

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

* Re: [PATCH] aic94xx: fix SMP request DMA direction
  2007-09-30  7:13       ` Darrick J. Wong
@ 2007-09-30  7:26         ` Muli Ben-Yehuda
  0 siblings, 0 replies; 6+ messages in thread
From: Muli Ben-Yehuda @ 2007-09-30  7:26 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Jeff Garzik, linux-scsi

On Sun, Sep 30, 2007 at 12:13:55AM -0700, Darrick J. Wong wrote:

> Actually, SMP commands are used during device discovery to find
> things attached to expanders, so it seems likely that "it blows up
> almost immediately after loading the module" symptoms are a result
> of this bug.
> 
> That said, the bug that Jeff fixed resulted in extra permissions
> (+w) being set for the SMP request buffer, so that's probably why
> I've never seen any problems manifesting on x260/x3800 systems.
> 
> (Unless the CalIOC2 has a write only mode?)

It does (you can turn on each of the R and W bits in the TCE entry
seperately) but we don't make use of it - we set it to either none, RO
or RW.

Cheers,
Muli

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

end of thread, other threads:[~2007-09-30  7:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-28  2:33 [PATCH] aic94xx: fix SMP request DMA direction Jeff Garzik
2007-09-28 23:55 ` Darrick J. Wong
2007-09-29  6:22   ` Muli Ben-Yehuda
2007-09-29  6:25     ` Jeff Garzik
2007-09-30  7:13       ` Darrick J. Wong
2007-09-30  7:26         ` Muli Ben-Yehuda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox