• Andi Kleen's avatar
    [PATCH] Fix incorrect inline assembly in RAID-5 · 9dcbdb7e
    Andi Kleen authored
    Pure luck that this ever worked at all. The optimized assembly for XOR
    in RAID-5 declared did clobber registers, but did declare them as read-only.
    I'm pretty sure that at least the 4 disk and possibly the 5 disk cases
    did corrupt callee saved registers. The others probably got away because
    they were always used in own functions (and only clobbering caller saved
    registers)and only called via pointers, preventing inlining.
    
    Some of the replacements are a bit complicated because the functions
    exceed gcc's 10 asm argument limit when each input/output register needs
    two arguments. Works around that by saving/restoring some of the registers
    manually.
    
    I wasn't able to test it in real-life because I don't have a RAID
    setup and the RAID code didn't compile since several 2.5 releases.
    I wrote some test programs that did test the XOR and they showed
    no regression.
    
    Also aligns to XMM save area to 16 bytes to save a few cycles.
    9dcbdb7e
xor.h 20.1 KB