Re: PREEMPT for ppc64

From: Benjamin Herrenschmidt
Date: Mon Jun 07 2004 - 10:24:58 EST



> doesn't seem to make much sense, since "regs->msr" certainly isn't
> changing, so clearly the above is equivalent to just pushing the whole
> preempt disable into "giveup_altivec()".

regs->msr can be changing. If you preempt between those 2 lines,
another process can steal the altivec or FP unit and your "regs"
wille be affected.

> The most _common_ bug (and the one I don't see any code for at all in your
> patch) is stuff that knows which CPU it is on, or that reads actual
> special CPU registers and acts on them. The other thing to look out for is
> anything that gets the CPU number: use "get_cpu() + put_cpu()" rather than
> "smp_processor_id()".
>
> Linus
>
> ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/
--
Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>

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