All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org,
	jens.axboe@oracle.com, tsbogend@alpha.franken.de,
	bzolnier@gmail.com, James.Bottomley@HansenPartnership.com,
	jeff@garzik.org, davem@davemloft.net, linux-mm@kvack.org,
	Herbert Xu <herbert@gondor.apana.org.au>
Subject: Re: [PATCH 1/4] block: use ARCH_KMALLOC_MINALIGN as the default dma pad mask
Date: Tue, 20 May 2008 02:31:29 -0700	[thread overview]
Message-ID: <20080520023129.2f921f24.akpm@linux-foundation.org> (raw)
In-Reply-To: <1211259514-9131-2-git-send-email-fujita.tomonori@lab.ntt.co.jp>

On Tue, 20 May 2008 13:58:31 +0900 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> wrote:

> This sets the default dma pad mask to ARCH_KMALLOC_MINALIGN in
> blk_queue_make_request(). It affects only non-coherent platforms.
> 
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> Cc: Jens Axboe <jens.axboe@oracle.com>
> ---
>  block/blk-settings.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/block/blk-settings.c b/block/blk-settings.c
> index 8dd8641..781d1bf 100644
> --- a/block/blk-settings.c
> +++ b/block/blk-settings.c
> @@ -84,6 +84,11 @@ EXPORT_SYMBOL(blk_queue_softirq_done);
>   **/
>  void blk_queue_make_request(struct request_queue *q, make_request_fn *mfn)
>  {
> +#ifndef ARCH_KMALLOC_MINALIGN
> +#define ARCH_KMALLOC_MINALIGN 1
> +#endif
> +	unsigned int min_align = ARCH_KMALLOC_MINALIGN;
> +
>  	/*
>  	 * set defaults
>  	 */
> @@ -98,6 +103,7 @@ void blk_queue_make_request(struct request_queue *q, make_request_fn *mfn)
>  	blk_queue_max_sectors(q, SAFE_MAX_SECTORS);
>  	blk_queue_hardsect_size(q, 512);
>  	blk_queue_dma_alignment(q, 511);
> +	blk_queue_dma_pad(q, min_align - 1);
>  	blk_queue_congestion_threshold(q);
>  	q->nr_batching = BLK_BATCH_REQ;

urgh.  This ARCH_KMALLOC_MINALIGN thing has the smell of an expedient
hack which is now growing.

Look at what crypto did (which seems to be a lot worse):

/*
 * The macro CRYPTO_MINALIGN_ATTR (along with the void * type in the actual
 * declaration) is used to ensure that the crypto_tfm context structure is
 * aligned correctly for the given architecture so that there are no alignment
 * faults for C data types.  In particular, this is required on platforms such
 * as arm where pointers are 32-bit aligned but there are data types such as
 * u64 which require 64-bit alignment.
 */
#if defined(ARCH_KMALLOC_MINALIGN)
#define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN
#elif defined(ARCH_SLAB_MINALIGN)
#define CRYPTO_MINALIGN ARCH_SLAB_MINALIGN
#else
#define CRYPTO_MINALIGN __alignof__(unsigned long long)
#endif

So here you're using it for "dma aligment" whereas crypto is using it
(or ARCH_SLAB_MINALIGN!) for "cpu 64-bit alignment".


Why does ARCH_KMALLOC_MINALIGN even exist?  What is its mandate?  Sigh.


It's not really related to your patch (although your patch compounds
the problem a little).  But we should sit down and work out what we
actually want to do here.  Something like:

In each architecture's arch/foo/Kconfig, define

	CONFIG_ARCH_DMA_ALIGN

and

	CONFIG_ARCH_64BIT_POINTER_ALIGN

and then use them.  Note that these have nothing to do with each other,
as far as I can tell.

Which leaves the question: "what should slab use"?  Maybe
CONFIG_ARCH_DMA_ALIGN?  But that depends what ARCH_KMALLOC_MINALIGN is
supposed to exist for.

ick.

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org,
	jens.axboe@oracle.com, tsbogend@alpha.franken.de,
	bzolnier@gmail.com, James.Bottomley@HansenPartnership.com,
	jeff@garzik.org, davem@davemloft.net, linux-mm@kvack.org,
	Herbert Xu <herbert@gondor.apana.org.au>
Subject: Re: [PATCH 1/4] block: use ARCH_KMALLOC_MINALIGN as the default dma pad mask
Date: Tue, 20 May 2008 02:31:29 -0700	[thread overview]
Message-ID: <20080520023129.2f921f24.akpm@linux-foundation.org> (raw)
In-Reply-To: <1211259514-9131-2-git-send-email-fujita.tomonori@lab.ntt.co.jp>

On Tue, 20 May 2008 13:58:31 +0900 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> wrote:

> This sets the default dma pad mask to ARCH_KMALLOC_MINALIGN in
> blk_queue_make_request(). It affects only non-coherent platforms.
> 
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> Cc: Jens Axboe <jens.axboe@oracle.com>
> ---
>  block/blk-settings.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/block/blk-settings.c b/block/blk-settings.c
> index 8dd8641..781d1bf 100644
> --- a/block/blk-settings.c
> +++ b/block/blk-settings.c
> @@ -84,6 +84,11 @@ EXPORT_SYMBOL(blk_queue_softirq_done);
>   **/
>  void blk_queue_make_request(struct request_queue *q, make_request_fn *mfn)
>  {
> +#ifndef ARCH_KMALLOC_MINALIGN
> +#define ARCH_KMALLOC_MINALIGN 1
> +#endif
> +	unsigned int min_align = ARCH_KMALLOC_MINALIGN;
> +
>  	/*
>  	 * set defaults
>  	 */
> @@ -98,6 +103,7 @@ void blk_queue_make_request(struct request_queue *q, make_request_fn *mfn)
>  	blk_queue_max_sectors(q, SAFE_MAX_SECTORS);
>  	blk_queue_hardsect_size(q, 512);
>  	blk_queue_dma_alignment(q, 511);
> +	blk_queue_dma_pad(q, min_align - 1);
>  	blk_queue_congestion_threshold(q);
>  	q->nr_batching = BLK_BATCH_REQ;

urgh.  This ARCH_KMALLOC_MINALIGN thing has the smell of an expedient
hack which is now growing.

Look at what crypto did (which seems to be a lot worse):

/*
 * The macro CRYPTO_MINALIGN_ATTR (along with the void * type in the actual
 * declaration) is used to ensure that the crypto_tfm context structure is
 * aligned correctly for the given architecture so that there are no alignment
 * faults for C data types.  In particular, this is required on platforms such
 * as arm where pointers are 32-bit aligned but there are data types such as
 * u64 which require 64-bit alignment.
 */
#if defined(ARCH_KMALLOC_MINALIGN)
#define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN
#elif defined(ARCH_SLAB_MINALIGN)
#define CRYPTO_MINALIGN ARCH_SLAB_MINALIGN
#else
#define CRYPTO_MINALIGN __alignof__(unsigned long long)
#endif

So here you're using it for "dma aligment" whereas crypto is using it
(or ARCH_SLAB_MINALIGN!) for "cpu 64-bit alignment".


Why does ARCH_KMALLOC_MINALIGN even exist?  What is its mandate?  Sigh.


It's not really related to your patch (although your patch compounds
the problem a little).  But we should sit down and work out what we
actually want to do here.  Something like:

In each architecture's arch/foo/Kconfig, define

	CONFIG_ARCH_DMA_ALIGN

and

	CONFIG_ARCH_64BIT_POINTER_ALIGN

and then use them.  Note that these have nothing to do with each other,
as far as I can tell.

Which leaves the question: "what should slab use"?  Maybe
CONFIG_ARCH_DMA_ALIGN?  But that depends what ARCH_KMALLOC_MINALIGN is
supposed to exist for.

ick.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2008-05-20  9:33 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` Andrew Morton [this message]
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:38       ` Herbert Xu
2008-05-20  9:52       ` Andrew Morton
2008-05-20  9:52         ` Andrew Morton
2008-05-20  9:58         ` FUJITA Tomonori
2008-05-20  9:58           ` FUJITA Tomonori
2008-05-20 11:32         ` Herbert Xu
2008-05-20 11:32           ` Herbert Xu
2008-05-20 13:25       ` FUJITA Tomonori
2008-05-20 13:25         ` FUJITA Tomonori
2008-05-20 15:34         ` Herbert Xu
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-20 16:09             ` FUJITA Tomonori
2008-05-21  1:26             ` Herbert Xu
2008-05-21  1:26               ` Herbert Xu
2008-05-21  1:36               ` FUJITA Tomonori
2008-05-21  1:36                 ` FUJITA Tomonori
2008-05-21  3:16                 ` Herbert Xu
2008-05-21  3:16                   ` Herbert Xu
2008-05-21  6:54                   ` FUJITA Tomonori
2008-05-21  6:54                     ` FUJITA Tomonori
2008-05-21  8:47                     ` Herbert Xu
2008-05-21  8:47                       ` Herbert Xu
2008-05-21  9:34                       ` FUJITA Tomonori
2008-05-21  9:34                         ` FUJITA Tomonori
2008-05-21 10:05                         ` Herbert Xu
2008-05-21 10:05                           ` Herbert Xu
2008-05-21 11:01                           ` FUJITA Tomonori
2008-05-21 11:01                             ` FUJITA Tomonori
2008-05-21 11:25                             ` Herbert Xu
2008-05-21 11:25                               ` Herbert Xu
2008-05-21 12:09                               ` FUJITA Tomonori
2008-05-21 12:09                                 ` FUJITA Tomonori
2008-05-21 12:22                                 ` Herbert Xu
2008-05-21 12:22                                   ` Herbert Xu
2008-05-21 12:46                                   ` FUJITA Tomonori
2008-05-21 12:46                                     ` FUJITA Tomonori
2008-05-21 12:55                                     ` FUJITA Tomonori
2008-05-21 12:55                                       ` FUJITA Tomonori
2008-05-21 13:19                                       ` Herbert Xu
2008-05-21 13:19                                         ` Herbert Xu
2008-05-21 13:18                                     ` Herbert Xu
2008-05-21 13:18                                       ` Herbert Xu
2008-05-22  1:14                                       ` FUJITA Tomonori
2008-05-22  1:14                                         ` FUJITA Tomonori
2008-05-22  1:19                                         ` David Miller
2008-05-22  1:19                                           ` David Miller, FUJITA Tomonori
2008-05-22  1:21                                           ` Herbert Xu
2008-05-22  1:21                                             ` Herbert Xu
2008-05-22  1:32                                           ` FUJITA Tomonori
2008-05-22  1:32                                             ` FUJITA Tomonori
2008-05-22  1:56                                             ` Herbert Xu
2008-05-22  1:56                                               ` Herbert Xu
2008-05-20  9:55     ` Paul Mundt
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

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=20080520023129.2f921f24.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=bzolnier@gmail.com \
    --cc=davem@davemloft.net \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=herbert@gondor.apana.org.au \
    --cc=jeff@garzik.org \
    --cc=jens.axboe@oracle.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-scsi@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.