linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Huacai Chen <chenhc@lemote.com>, Christoph Hellwig <hch@lst.de>,
	Robin Murphy <robin.murphy@arm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Fuxin Zhang <zhangfx@lemote.com>,
	linux-kernel@vger.kernel.org, Ralf Baechle <ralf@linux-mips.org>,
	James Hogan <james.hogan@imgtec.com>,
	linux-mips@linux-mips.org,
	"James E . J . Bottomley" <jejb@linux.vnet.ibm.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org, Tejun Heo <tj@kernel.org>,
	linux-ide@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH V8 4/5] libsas: Align SMP req/resp to dma_get_cache_alignment()
Date: Thu, 19 Oct 2017 17:12:14 +0200	[thread overview]
Message-ID: <20171019151214.GD24204@lst.de> (raw)
In-Reply-To: <286bf838-4d2f-a25f-baf9-ef3ac9b37d93@samsung.com>

On Tue, Oct 17, 2017 at 01:55:43PM +0200, Marek Szyprowski wrote:
> If I remember correctly, kernel guarantees that each kmalloced buffer is
> always at least aligned to the CPU cache line, so CPU cache can be
> invalidated on the allocated buffer without corrupting anything else.

Yes, from slab.h:

/*
 * Some archs want to perform DMA into kmalloc caches and need a guaranteed
 * alignment larger than the alignment of a 64-bit integer.
 * Setting ARCH_KMALLOC_MINALIGN in arch headers allows that.
 */
#if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
#define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN
#define KMALLOC_SHIFT_LOW ilog2(ARCH_DMA_MINALIGN)
#else
#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
#endif

Mips sets this for a few subarchitectures, but it seems like you need
to set it for yours as well.

  parent reply	other threads:[~2017-10-19 15:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-17  8:05 [PATCH V8 1/5] dma-mapping: Rework dma_get_cache_alignment() Huacai Chen
2017-10-17  8:05 ` [PATCH V8 2/5] MIPS: Implement dma_map_ops::get_cache_alignment() Huacai Chen
2017-10-17  8:05 ` [PATCH V8 3/5] scsi: Align block queue to dma_get_cache_alignment() Huacai Chen
2017-10-19 15:10   ` Christoph Hellwig
2017-10-17  8:05 ` [PATCH V8 4/5] libsas: Align SMP req/resp " Huacai Chen
2017-10-17 11:55   ` Marek Szyprowski
2017-10-18  1:12     ` [PATCH V8 4/5] libsas: Align SMP req/resp todma_get_cache_alignment() 陈华才
2017-10-19 15:12     ` Christoph Hellwig [this message]
2017-10-20  0:04   ` [PATCH V8 4/5] libsas: Align SMP req/resp to dma_get_cache_alignment() kbuild test robot
2017-10-17  8:05 ` [PATCH V8 5/5] libata: Align DMA buffer " Huacai Chen
2017-10-17  9:43   ` Sergei Shtylyov
2017-10-18  1:06     ` [PATCH V8 5/5] libata: Align DMA buffer todma_get_cache_alignment() 陈华才
2017-10-18 19:54     ` [PATCH V8 5/5] libata: Align DMA buffer to dma_get_cache_alignment() Alan Cox
2017-10-18 13:03   ` Tejun Heo
2017-10-19  7:52     ` Matt Redfearn
2017-10-20  4:25       ` [PATCH V8 5/5] libata: Align DMA buffer todma_get_cache_alignment() 陈华才
2017-10-18 17:23 ` [PATCH V8 1/5] dma-mapping: Rework dma_get_cache_alignment() Mark Greer
2017-10-19 15:09   ` Christoph Hellwig

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=20171019151214.GD24204@lst.de \
    --to=hch@lst.de \
    --cc=akpm@linux-foundation.org \
    --cc=chenhc@lemote.com \
    --cc=james.hogan@imgtec.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=martin.petersen@oracle.com \
    --cc=ralf@linux-mips.org \
    --cc=robin.murphy@arm.com \
    --cc=stable@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=zhangfx@lemote.com \
    /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 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).