lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 19 Nov 2007 18:10:14 -0800
From:	Roland Dreier <rdreier@...co.com>
To:	David Miller <davem@...emloft.net>
Cc:	benh@...nel.crashing.org, James.Bottomley@...senPartnership.com,
	linux-kernel@...r.kernel.org, linux-scsi@...r.kernel.org,
	rmk@....linux.org.uk
Subject: Re: SCSI breakage on non-cache coherent architectures

 > 2) Add the __dma_cacheline_aligned tag.
 > 
 > But note that with #2 it could get quite ugly because the
 > alignment and size both have a minimum that needs to be
 > enforced, not just the alignment alone.  So either:
 > 
 > struct foo {
 > 	unsigned int other_unrelated_stuff;
 > 
 > 	struct object dma_thing __dma_cacheline_aligned;
 > 
 > 	unsigned int more_nondma_stuff __dma_cacheline_aligned;
 > };
 > 
 > or:
 > 
 > struct foo {
 > 	unsigned int other_unrelated_stuff;
 > 
 > 	union {
 > 		struct object dma_thing __dma_cacheline_aligned;
 > 		char __pad[(sizeof(object) + DMA_CACHELINE_SIZE &
 > 			   ~DMA_CACHELINE_SIZE)];
 > 	} u;
 > 
 > 	unsigned int more_nondma_stuff __dma_cacheline_aligned;
 > };

I wrapped this ugliness up inside the macro back in what I posted in
2002 (http://lkml.org/lkml/2002/6/12/234):

#define __dma_buffer __dma_buffer_line(__LINE__)
#define __dma_buffer_line(line) __dma_buffer_expand_line(line)
#define __dma_buffer_expand_line(line) \
	__attribute__ ((aligned(L1_CACHE_BYTES))); \
	char __dma_pad_ ## line [0] __attribute__ ((aligned(L1_CACHE_BYTES)))

then you just need to tag the actual member like:

	char foo[3] __dma_buffer;

 - R.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ