Re: raid6 badness

From: H. Peter Anvin (hpa_at_zytor.com)
Date: 01/31/04

  • Next message: Eric W. Biederman: "Re: [RFC][PATCH] linux-2.6.2-rc2_vsyscall-gtod_B1.patch"
    Date:	Fri, 30 Jan 2004 21:50:23 -0800
    To: Andi Kleen <ak@suse.de>
    
    
    

    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

    
    

    ===================================================================
    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

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


  • Next message: Eric W. Biederman: "Re: [RFC][PATCH] linux-2.6.2-rc2_vsyscall-gtod_B1.patch"

    Relevant Pages

    • [PATCH 2.4] gcc-3.4 more fixes
      ... The attached patch applies to 2.4.27-rc5 + Mikael's patch ... There still are some lvalue related warnings (eicon_idi.c:2057, ... typedef struct _d101m_scb_ext_t { ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH][2.4.30] __attribute__ placement
      ... Please find the updated patch. ... Views expressed in this mail are those of the individual sender and ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [parisc-linux] Re: [PATCH 3/9] mm: parisc pte atomicity
      ... using your own tmpalias area sounds much better than getting ... I've simply not wrapped my head around the races, ... it looks like we agree that my patch is necessary and valid as is; ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: keyboard - was: Re: Linux 2.6.0-test4
      ... >> I was able to get the key unstuck by switching back and forth between ... I rebuild my kernel including your patch; ... I'll get back to you once I verify that the problem doesn't occur ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: m68knommu compile error
      ... compile all the way through. ... With the patch it did fail with a different ... typedef struct pgd_t; ... typedef struct {unsigned long pgprot;} pgprot_t; ...
      (Linux-Kernel)