Skip to contentSkip to conversation

MPT Fusion SAS dma alignment problem

PATCH Ilya Yanok 1 participant 1 message May 28, 2008

Subsystems (2)
lore
Share & tools
lore

Ilya Yanok

author
#0 lore raw

Hello, All.

We've experienced problem with MPT Fusion SAS driver: running smartctl program from smartmontools package resulted in memory corruption after ioctl(SG_IO) call. My investigation showed that problem was introduced by

Commit: 465ff3185e0cb76d46137335a4d21d0d9d3ac8a2
Author: James Bottomley <[email protected]> Tue, 01 Jan 2008

[SCSI] relax scsi dma alignment

This patch relaxes the default SCSI DMA alignment from 512 bytes to 4 bytes. I remember from previous discussions that usb and firewire have sector size alignment requirements, so I upped their alignments in the respective slave allocs.

The reason for doing this is so that we don't get such a huge amount of copy overhead in bio_copy_user() for udev. (basically all inquiries it issues can now be directly mapped).

so I've just added call to blk_queue_update_dma_alignment() (see patch below) but I'm not sure that it'a right (or full) solution. Maybe someone more familiar with this driver can comment?

--
Ilya

---
 drivers/message/fusion/mptsas.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
(quoted diff) +0 -0

b/drivers/message/fusion/mptsas.c
index 4684807..bbb6186 100644

drivers/message/fusion/mptsas.c +1 -0
@@ -1000,6 +1000,7 @@ mptsas_slave_alloc(struct scsi_device *sdev)
     return -ENXIO;
 
  out:
+    blk_queue_update_dma_alignment(sdev->request_queue, 511);
     vdevice->vtarget->num_luns++;
     sdev->hostdata = vdevice;
     return 0;
Signature · 1 line
1.5.5.1