Re: [PATCH v2 7/8] KVM: x86: Add helpers to test/mark reg availability and dirtiness
From: Paolo Bonzini
Date: Wed Oct 09 2019 - 07:00:29 EST
On 30/09/19 11:32, Vitaly Kuznetsov wrote:
>> +static inline void kvm_register_mark_dirty(struct kvm_vcpu *vcpu,
>> + enum kvm_reg reg)
>> +{
>> + __set_bit(reg, (unsigned long *)&vcpu->arch.regs_avail);
>> + __set_bit(reg, (unsigned long *)&vcpu->arch.regs_dirty);
>> +}
>> +
> Personal preference again, but I would've named this
> "kvm_register_mark_avail_dirty" to indicate what we're actually doing
> (and maybe even shortened 'kvm_register_' to 'kvm_reg_' everywhere as I
> can't see how 'reg' could be misread).
>
I think this is okay, a register can be either not cached, available or
dirty. But dirty means we have to write it back, so it implies
availability.
Paolo