Re: [PATCH v4 10/40] KVM: arm64: Slightly improve debug save/restore functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 21/02/18 17:39, Andrew Jones wrote:
> On Thu, Feb 15, 2018 at 10:03:02PM +0100, Christoffer Dall wrote:
>> The debug save/restore functions can be improved by using the has_vhe()
>> static key instead of the instruction alternative.  Using the static key
>> uses the same paradigm as we're going to use elsewhere, it makes the
>> code more readable, and it generates slightly better code (no
>> stack setups and function calls unless necessary).
>>
>> We also use a static key on the restore path, because it will be
>> marginally faster than loading a value from memory.
>>
>> Finally, we don't have to conditionally clear the debug dirty flag if
>> it's set, we can just clear it.
>>
>> Reviewed-by: Marc Zyngier <marc.zyngier@xxxxxxx>
>> Signed-off-by: Christoffer Dall <christoffer.dall@xxxxxxxxxx>
>> ---
>>
>> Notes:
>>     Changes since v1:
>>      - Change dot to comma in comment
>>      - Rename __debug_restore_spe to __debug_restore_spe_nvhe
>>
>>  arch/arm64/kvm/hyp/debug-sr.c | 26 ++++++++++++--------------
>>  1 file changed, 12 insertions(+), 14 deletions(-)
>>
> 
> Maybe after this series is merged, if there are any hyp_alternate_select's
> left, we can replace all the remaining ones with has_vhe() and then just
> completely remove hyp_alternate_select.

Note that older compilers (such as GCC 4.8) will generate horrible code
with static keys, as they do not support "asm goto". Not that I want to
preserve the home brew hyp_alternate_select mechanism, but I just want
to make it plain that some distros will definitely suffer from the
transition.

	M.
-- 
Jazz is not dead. It just smells funny...



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux