Skip to contentSkip to conversation

GFP_DMA Janitation

DISCUSSION Matthew Wilcox 2 participants 2 messages Dec 14, 2002 – Dec 16, 2002 SCSI

lore
Share & tools
lore
#0 lore raw

I know there's a lot of clean-up and janitorial work going on at the moment, so maybe someone already fixed the bogus uses of GFP_DMA in drivers/scsi? For those who're not aware, GFP_DMA is _only_ a flag, not a full specifier. ie it should be used as

	buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); 
rather than
	buffer = kmalloc(512, GFP_DMA);

which is how sr.c uses it at present.

Current offenders:

drivers/scsi/aha1542.c:703: SCpnt->host_scribble = (unsigned char *) kmalloc(512, GFP_DMA);
drivers/scsi/megaraid.c:5020: _tv = (void *)__get_free_pages(GFP_DMA, order);
drivers/scsi/pluto.c:120: fcs = (struct ctrl_inquiry *) kmalloc (sizeof (struct ctrl_inquiry) * fcscount, GFP_DMA);
drivers/scsi/sd.c:1124: buffer = kmalloc(512, GFP_DMA); drivers/scsi/sr.c:596: buffer = kmalloc(512, GFP_DMA); drivers/scsi/sr.c:708: buffer = kmalloc(512, GFP_DMA);
drivers/scsi/sr_ioctl.c:99: bounce_buffer = (char *) kmalloc(cgc->buflen, GFP_DMA);

The other users of GFP_DMA seem to use it correctly.

BTW, not specifing anything with GFP_DMA leads to the allocation currently being performed as GFP_ATOMIC, only without the permission to access the emergency pools. A terribly risky situation.

Signature · 3 lines
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
#1 lore raw
Quoted 4 lines

I know there's a lot of clean-up and janitorial work going on at the moment, so maybe someone already fixed the bogus uses of GFP_DMA in drivers/scsi?
drivers/scsi/megaraid.c:5020: _tv = (void *)__get_free_pages(GFP_DMA, order);

The megaraid 2.00.2 driver (2.00.1 is in -ac right now) gets this right (in fact, there are no GFP_DMA allocations ever, it uses the PCI DMA API properly).

Thanks,
Matt

Signature · 4 lines
Matt Domsch
Sr. Software Engineer, Lead Engineer, Architect
Dell Linux Solutions www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com