From: "H. Peter Anvin" <hpa@zytor.com>
To: Andi Kleen <ak@suse.de>
Cc: linux-kernel@vger.kernel.org, michael@mvdavid.com
Subject: Re: raid6 badness
Date: Fri, 30 Jan 2004 21:50:23 -0800 [thread overview]
Message-ID: <401B421F.4060104@zytor.com> (raw)
In-Reply-To: <p73ad44n7ig.fsf@verdi.suse.de>
[-- Attachment #1: Type: text/plain, Size: 822 bytes --]
Andi Kleen wrote:
> "H. Peter Anvin" <hpa@zytor.com> writes:
>
>>I don't know what would cause the stack to be misaligned, however.
>
> x86-64 kernel doesn't guarantee the stack to be 16 byte aligned
> (although it usually is). If you need 16 byte alignment you have
> to align yourself.
>
OK, that's unfortunate... per our discussion I really think this is a
bug, since the compiler still does 16-byte alignment, and thus we're
taking the cost without the benefit.
I'll send in the attached patch for now, but at some point I'd like to
fix this. Unfortunately I still don't have an x86-64 machine that I can
actually compile and install kernels on; I only have access to an x86-64
userspace, so I'm a bit limited in what I can test.
Michael: Perhaps you could apply this patch and test it out for me?
-hpa
[-- Attachment #2: diff --]
[-- Type: text/plain, Size: 1411 bytes --]
===================================================================
RCS file: /home/hpa/kernel/bkcvs/linux-2.5/drivers/md/raid6x86.h,v
retrieving revision 1.3
diff -u -r1.3 raid6x86.h
--- linux-2.5/drivers/md/raid6x86.h 22 Jan 2004 16:15:09 -0000 1.3
+++ linux-2.5/drivers/md/raid6x86.h 31 Jan 2004 05:41:49 -0000
@@ -32,18 +32,20 @@
/* N.B.: For SSE we only save %xmm0-%xmm7 even for x86-64, since
the code doesn't know about the additional x86-64 registers */
typedef struct {
- unsigned int sarea[8*4];
- unsigned int cr0;
+ unsigned int sarea[8*4+2];
+ unsigned long cr0;
} raid6_sse_save_t __attribute__((aligned(16)));
/* This is for x86-64-specific code which uses all 16 XMM registers */
typedef struct {
- unsigned int sarea[16*4];
+ unsigned int sarea[16*4+2];
unsigned long cr0;
} raid6_sse16_save_t __attribute__((aligned(16)));
-/* On x86-64 the stack is 16-byte aligned */
-#define SAREA(x) (x->sarea)
+/* On x86-64 the stack *SHOULD* be 16-byte aligned, but currently this
+ is buggy in the kernel and it's only 8-byte aligned in places, so
+ we need to do this anyway. Sigh. */
+#define SAREA(x) ((unsigned int *)((((unsigned long)&(x)->sarea)+15) & ~15))
#else /* __i386__ */
@@ -60,6 +62,7 @@
unsigned long cr0;
} raid6_sse_save_t;
+/* Find the 16-byte aligned save area */
#define SAREA(x) ((unsigned int *)((((unsigned long)&(x)->sarea)+15) & ~15))
#endif
next prev parent reply other threads:[~2004-01-31 5:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.LNX.4.58.0401301158340.8900@sapphire.newearth.org.suse.lists.linux.kernel>
[not found] ` <bvf2vl$6pr$1@terminus.zytor.com.suse.lists.linux.kernel>
2004-01-31 3:04 ` raid6 badness Andi Kleen
2004-01-31 5:50 ` H. Peter Anvin [this message]
2004-01-31 9:24 ` Andi Kleen
2004-01-31 13:10 ` Michael V. David
2004-02-01 7:33 ` H. Peter Anvin
2004-01-30 17:15 Michael V. David
2004-01-31 2:13 ` H. Peter Anvin
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=401B421F.4060104@zytor.com \
--to=hpa@zytor.com \
--cc=ak@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=michael@mvdavid.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