All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roland Dreier <rdreier@cisco.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-scsi@vger.kernel.org, rmk@arm.linux.org.uk,
	davem@davemloft.net, james.bottomley@steeleye.com,
	ralf@linux-mips.org
Subject: Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd
Date: Fri, 21 Dec 2007 08:57:47 -0800	[thread overview]
Message-ID: <adak5n8x9x0.fsf@cisco.com> (raw)
In-Reply-To: <20071221103326.7ce1bc4f@the-village.bc.nu> (Alan Cox's message of "Fri, 21 Dec 2007 10:33:26 +0000")

 > It's also incomplete as a fix because I don't see what guarantees the
 > buffer size will always exceed cache line size

There's a macro trick that adds a pad member after the buffer too, so
that it gets rounded up to the cacheline size:

 > +#define __dma_aligned	  	__attribute__((aligned(ARCH_MIN_DMA_ALIGNMENT)))
 > +#define __dma_buffer		__dma_buffer_line(__LINE__)
 > +#define __dma_buffer_line(line)	__dma_aligned;\
 > +				char __dma_pad_##line[0] __dma_aligned

So that part is OK at least.

 - R.

WARNING: multiple messages have this Message-ID (diff)
From: Roland Dreier <rdreier@cisco.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	<linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	<linux-scsi@vger.kernel.org>, <rmk@arm.linux.org.uk>,
	<davem@davemloft.net>, <james.bottomley@steeleye.com>,
	<ralf@linux-mips.org>
Subject: Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd
Date: Fri, 21 Dec 2007 08:57:47 -0800	[thread overview]
Message-ID: <adak5n8x9x0.fsf@cisco.com> (raw)
In-Reply-To: <20071221103326.7ce1bc4f@the-village.bc.nu> (Alan Cox's message of "Fri, 21 Dec 2007 10:33:26 +0000")

 > It's also incomplete as a fix because I don't see what guarantees the
 > buffer size will always exceed cache line size

There's a macro trick that adds a pad member after the buffer too, so
that it gets rounded up to the cacheline size:

 > +#define __dma_aligned	  	__attribute__((aligned(ARCH_MIN_DMA_ALIGNMENT)))
 > +#define __dma_buffer		__dma_buffer_line(__LINE__)
 > +#define __dma_buffer_line(line)	__dma_aligned;\
 > +				char __dma_pad_##line[0] __dma_aligned

So that part is OK at least.

 - R.

  parent reply	other threads:[~2007-12-21 16:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-21  2:30 [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd Benjamin Herrenschmidt
2007-12-21  2:30 ` Benjamin Herrenschmidt
2007-12-21 10:33 ` Alan Cox
2007-12-21 10:33   ` Alan Cox
2007-12-21 13:16   ` Matthew Wilcox
2007-12-21 13:30     ` Thomas Bogendoerfer
2007-12-21 14:00       ` Matthew Wilcox
2007-12-21 16:35         ` Thomas Bogendoerfer
2007-12-21 21:29     ` Benjamin Herrenschmidt
2007-12-21 16:57   ` Roland Dreier [this message]
2007-12-21 16:57     ` Roland Dreier
2007-12-21 21:27   ` Benjamin Herrenschmidt
2007-12-23 11:09 ` Boaz Harrosh
2007-12-23 23:04   ` Benjamin Herrenschmidt
2008-01-07  6:53   ` FUJITA Tomonori
2008-01-07 13:25     ` Boaz Harrosh
2008-01-07 23:32       ` FUJITA Tomonori

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=adak5n8x9x0.fsf@cisco.com \
    --to=rdreier@cisco.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=james.bottomley@steeleye.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=ralf@linux-mips.org \
    --cc=rmk@arm.linux.org.uk \
    /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.