[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ac250f46-84cb-d4cf-8a75-c9a0354ddad1@redhat.com>
Date: Sun, 7 Nov 2021 20:13:50 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Sean Christopherson <seanjc@...gle.com>, x86@...nel.org,
linux-kernel@...r.kernel.org, jpoimboe@...hat.com,
mark.rutland@....com, dvyukov@...gle.com, mbenes@...e.cz
Subject: Re: [RFC][PATCH 15/22] x86,vmx: Remove .fixup usage
On 11/6/21 09:36, Peter Zijlstra wrote:
>> Ouch, good catch. It should be actually very simple to fix it, just mark
>> "value" as an "early clobber" output:
>>
>> : ASM_CALL_CONSTRAINT, "=&r"(value) : "r"(field) : "cc");
>>
>> That's an output which is written before the instruction is finished using
>> the input operands. The manual even says "this operand may not lie in a
>> register that is read by the instruction or as part of any memory address",
>> which is exactly what you caught with %1 and %2 both being the same GPR.
> Yes, but as Sean points out, that will negatively affect code-gen on the
> happy path. But perhaps that's acceptable if we add the asm-goto-output
> variant?
I think it's acceptable even without the #ifdef. Forcing registers
using the a/b/c/d/S/D constraints takes away some freedom from the
compiler, but using two "r" registers is going to give as good assembly
as anything else. Most callers of __vmcs_readl call it either at the
beginning or at the end of a function, where there aren't many live
registers anyway.
Paolo
Powered by blists - more mailing lists