Re: PCI DMA to small buffers on cache-incoherent arch

From: Roland Dreier (roland@topspin.com)
Date: Sat Jun 08 2002 - 19:52:49 EST


>>>>> "Anton" == Anton Blanchard <anton@samba.org> writes:

    Anton> I just checked 2.5 and noticed the scsi code is _still_
    Anton> DMAing to the stack! Maybe it would be worth having a debug
    Anton> option for x86 where it uses vmalloc for kernel stack
    Anton> allocation :)

Good catches, just a few comments on the patch.

    Anton> Anyway attached is a patch from Todd Inglett that I updated
    Anton> for 2.5.

===== drivers/scsi/scsi_scan.c 1.13 vs edited =====
- /* Make sure we have something that is valid for DMA purposes */
- scsi_result = ((!shpnt->unchecked_isa_dma)
- ? &scsi_result0[0] : kmalloc(512, GFP_DMA));
+ scsi_result = kmalloc(512, GFP_DMA);

I don't think you should always use GFP_DMA here... probably better to
do:

                scsi_result = kmalloc(512,
                                      shpnt->unchecked_isa_dma ? GFP_DMA : GFP_ATOMIC);

And similarly this:

===== drivers/scsi/sr_ioctl.c 1.13 vs edited =====
+ unsigned char *buffer = kmalloc(512, GFP_DMA);

should probably use GFP_KERNEL (or possibly a check of
unchecked_isa_dma as above, though this doesn't seem to be needed
based on the existing code).

Best,
  Roland
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jun 15 2002 - 22:00:13 EST