linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] revert the commit 22a9189f (cdrom: use kmalloced buffers instead of buffers on stack)
@ 2008-05-20  4:58 FUJITA Tomonori
  2008-05-20  4:58 ` [PATCH 1/4] block: use ARCH_KMALLOC_MINALIGN as the default dma pad mask FUJITA Tomonori
                   ` (2 more replies)
  0 siblings, 3 replies; 45+ messages in thread
From: FUJITA Tomonori @ 2008-05-20  4:58 UTC (permalink / raw)
  To: linux-scsi, linux-ide
  Cc: jens.axboe, tsbogend, bzolnier, James.Bottomley, jeff, akpm,
	davem, fujita.tomonori

The goal of this patchset is reverting the commit
22a9189fd073db3d03a4cf8b8c098aa207602de1 (cdrom: use kmalloced buffers
instead of buffers on stack).

http://lkml.org/lkml/2008/4/21/634

The commit is using kmalloced buffers for cdrom packet commands to
avoid stack corruption on non coherent platforms. But allocating a
small buffer like this is not nice (unnecessary complicity):

+	buffer = kmalloc(8, GFP_KERNEL);

I tried to remove generic_packet() and convert cdrom users to use the
block queue like pkt_generic_packet (as Jens suggested in the thread
if I correctly understand), but it turned out that it needs tricky
surgery (like handling ssleep and retries for packet commands in ide).

Then I found that we can easily handle packet commands on non coherent
platforms. The diffstat is pretty small except for the revert. All
this patchset does is just setting the dma_pad_mask to
ARCH_KMALLOC_MINALIGN.

Only scsi and ide-cd do DMA generic_packet. In the case of scsi,
sr_packet uses blk_rq_map_kern (the commit
68154e90c9d1492d570671ae181d9a8f8530da55) post 2.6.25. So if we set
the dma padding on non coherent platforms, sr_packet uses allocated
pages properly.

In the case of IDE, ide-cd has a mechanism to handle alignment and
padding for SG_IO. So we can easily exploit it for packet commands.

If some architectures can't do DMA on stack, we also need to a new
queue_flag like QUEUE_FLAG_NO_DMA_ON_STACK in addtion of this
patchset.

The diffstat is:

 block/blk-settings.c      |   30 +++++-
 drivers/ata/libata-scsi.c |    3 +-
 drivers/cdrom/cdrom.c     |  274 +++++++++++++++------------------------------
 drivers/ide/ide-cd.c      |   17 ++-
 include/linux/blkdev.h    |    1 +
 5 files changed, 134 insertions(+), 191 deletions(-)



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

end of thread, other threads:[~2008-05-28  6:43 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-20  4:58 [PATCH 0/4] revert the commit 22a9189f (cdrom: use kmalloced buffers instead of buffers on stack) FUJITA Tomonori
2008-05-20  4:58 ` [PATCH 1/4] block: use ARCH_KMALLOC_MINALIGN as the default dma pad mask FUJITA Tomonori
2008-05-20  4:58   ` [PATCH 2/4] block: add blk_queue_update_dma_pad FUJITA Tomonori
2008-05-20  4:58     ` [PATCH 3/4] ide: use the dma safe check for REQ_TYPE_ATA_PC FUJITA Tomonori
2008-05-20  4:58       ` [PATCH 4/4] cdrom: revert commit 22a9189 (cdrom: use kmalloced buffers instead of buffers on stack) FUJITA Tomonori
2008-05-20  7:33         ` Elias Oltmanns
2008-05-20  7:42           ` Jim Paris
2008-05-20  8:14             ` Elias Oltmanns
2008-05-28  6:43       ` [PATCH 3/4] ide: use the dma safe check for REQ_TYPE_ATA_PC Borislav Petkov
2008-05-20  9:31   ` [PATCH 1/4] block: use ARCH_KMALLOC_MINALIGN as the default dma pad mask Andrew Morton
2008-05-20  9:38     ` Herbert Xu
2008-05-20  9:52       ` Andrew Morton
2008-05-20  9:58         ` FUJITA Tomonori
2008-05-20 11:32         ` Herbert Xu
2008-05-20 13:25       ` FUJITA Tomonori
2008-05-20 15:34         ` Herbert Xu
2008-05-20 15:53           ` Plans for libsas and SAS-2? Marushak, Nathan
2008-05-20 16:09           ` [PATCH 1/4] block: use ARCH_KMALLOC_MINALIGN as the default dma pad mask FUJITA Tomonori
2008-05-21  1:26             ` Herbert Xu
2008-05-21  1:36               ` FUJITA Tomonori
2008-05-21  3:16                 ` Herbert Xu
2008-05-21  6:54                   ` FUJITA Tomonori
2008-05-21  8:47                     ` Herbert Xu
2008-05-21  9:34                       ` FUJITA Tomonori
2008-05-21 10:05                         ` Herbert Xu
2008-05-21 11:01                           ` FUJITA Tomonori
2008-05-21 11:25                             ` Herbert Xu
2008-05-21 12:09                               ` FUJITA Tomonori
2008-05-21 12:22                                 ` Herbert Xu
2008-05-21 12:46                                   ` FUJITA Tomonori
2008-05-21 12:55                                     ` FUJITA Tomonori
2008-05-21 13:19                                       ` Herbert Xu
2008-05-21 13:18                                     ` Herbert Xu
2008-05-22  1:14                                       ` FUJITA Tomonori
2008-05-22  1:19                                         ` David Miller
2008-05-22  1:21                                           ` Herbert Xu
2008-05-22  1:32                                           ` FUJITA Tomonori
2008-05-22  1:56                                             ` Herbert Xu
2008-05-20  9:55     ` Paul Mundt
2008-05-21 22:11 ` [PATCH 0/4] revert the commit 22a9189f (cdrom: use kmalloced buffers instead of buffers on stack) Thomas Bogendoerfer
2008-05-22  1:13   ` FUJITA Tomonori
2008-05-22  1:18     ` David Miller
2008-05-22  8:43       ` James Bottomley
2008-05-26  9:17         ` FUJITA Tomonori
2008-05-27 18:58 ` Bartlomiej Zolnierkiewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).