All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Jens Axboe <jens.axboe@oracle.com>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: cdrom: use kmalloced buffers instead of buffers on stack
Date: Mon, 21 Apr 2008 22:01:26 -0400	[thread overview]
Message-ID: <480D46F6.3080305@garzik.org> (raw)
In-Reply-To: <200804220100.m3M10sva024025@hera.kernel.org>

Linux Kernel Mailing List wrote:
> Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=22a9189fd073db3d03a4cf8b8c098aa207602de1
> Commit:     22a9189fd073db3d03a4cf8b8c098aa207602de1
> Parent:     0a0c4114df4a6903bccb65b06cabb6ddc968f877
> Author:     Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> AuthorDate: Wed Mar 26 12:09:38 2008 +0100
> Committer:  Jens Axboe <jens.axboe@oracle.com>
> CommitDate: Mon Apr 21 09:50:08 2008 +0200
> 
>     cdrom: use kmalloced buffers instead of buffers on stack
>     
>     If cdrom commands are issued to a scsi drive in most cases the buffer will be
>     filled via dma.  This leads to bad stack corruption on non coherent platforms,
>     because the buffers are neither cache line aligned nor is the size a multiple
>     of the cache line size.  Using kmalloced buffers avoids this.
>     
>     Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
>     Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
> ---
>  drivers/cdrom/cdrom.c |  274 ++++++++++++++++++++++++++++++++-----------------
>  1 files changed, 181 insertions(+), 93 deletions(-)

Eh... AFAICS this is only really useful in two of the cases converted.

For all the other cases (<= 32 bytes), it is _far_ less complex, far 
less code to simply communicate the additional alignment requirements to 
the compiler.

What about __attribute__ __aligned__?  Was that tried?

	Jeff



       reply	other threads:[~2008-04-22  2:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200804220100.m3M10sva024025@hera.kernel.org>
2008-04-22  2:01 ` Jeff Garzik [this message]
2008-04-22  2:03   ` cdrom: use kmalloced buffers instead of buffers on stack David Miller
2008-04-22  5:48   ` Thomas Bogendoerfer
2008-04-22  6:33     ` Jens Axboe
2008-04-22 11:47     ` FUJITA Tomonori
2008-04-22 11:55       ` Jens Axboe
2008-04-22 11:59         ` FUJITA Tomonori
2008-04-22 12:04           ` Jens Axboe
2008-04-22 12:25             ` FUJITA Tomonori
2008-04-22 12:30               ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=480D46F6.3080305@garzik.org \
    --to=jeff@garzik.org \
    --cc=akpm@linux-foundation.org \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tsbogend@alpha.franken.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.