[RFC 2/3] PowerPC: lazy altivec enabling in kernel
Paul Mackerras
paulus at samba.org
Tue Apr 24 10:52:07 EST 2007
Sebastian Siewior writes:
> void enable_kernel_altivec(void)
> {
> - WARN_ON(preemptible());
> + BUG_ON(preemptible());
> + /*
> + * enable_kernel_altivec() will just save current AltiVec registers (if needed) and
> + * return to caller (with MSR_VEC unchanged (probably not set)). The first AltiVec
> + * instruction will raise an exception and the exception will enable the AltiVec for
> + * the kernel. This is done to avoid the expensive "enable altivec" operation if it
> + * is allready enabled. However, you have to disable preemtion while you are using
> + * AltiVec.
> + */
It would be better to put a test and conditional branch in
giveup_altivec to skip the mtmsrd if MSR_VEC is already set. That
would avoid adding the overhead of the trap in the case when MSR_VEC
isn't already set, besides being much less code.
Paul.
More information about the Linuxppc-dev
mailing list