Re: [PATCH RFC 0/2] x86/fpu: avoid "xstate_fault" in xsave_user/xrestore_user
From: Borislav Petkov
Date: Tue Mar 17 2015 - 05:51:10 EST
On Mon, Mar 16, 2015 at 11:37:44PM +0100, Quentin Casasnovas wrote:
...
> __user_insn("btl [var2], %0 \n\t",
> , /* no outputs, no need for dummy arg */
> SINGLE_ARG("r" (var1), [var2] "r" (var2)), /* two inputs */
> "cc");
So this becomes pretty unreadable IMO. And we shouldn't go nuts with
optimizing this and sacrifice readability a lot.
TBH, I'd much prefer:
if (static_cpu_has_safe(X86_FEATURE_XSAVEOPT)) {
check_insn(XSAVEOPT, ...);
return;
}
if (static_cpu_has_safe(X86_FEATURE_XSAVES)) {
check_insn(XSAVES);
return;
}
check_insn(XSAVE, ...)
which is pretty clear.
We can even go a step further and add a static_cpu_has_safe thing which
checks two features instead of one. The penalty we'd get is a single
inconditional JMP which in the face of XSAVE* is nothing.
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
--
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/