* Re: [PATCH] KVM: x86: get rid of odd out jump label in pdptrs_changed
@ 2019-10-25 10:43 linmiaohe
0 siblings, 0 replies; 3+ messages in thread
From: linmiaohe @ 2019-10-25 10:43 UTC (permalink / raw)
To: Paolo Bonzini
Cc: rkrcmar, sean.j.christopherson, vkuznets, wanpengli, jmattson,
joro, tglx, mingo, bp, hpa, x86, kvm, linux-kernel
On 25/10/19, Paolo Bonzini wrote:
>On 25/10/19 04:01, Miaohe Lin wrote:
>> - if (r < 0)
>> - goto out;
>> - changed = memcmp(pdpte, vcpu->arch.walk_mmu->pdptrs, sizeof(pdpte)) != 0;
>> -out:
>> + if (r >= 0)
>> + changed = memcmp(pdpte, vcpu->arch.walk_mmu->pdptrs,
>> + sizeof(pdpte)) != 0;
>>
>> return changed;
>
>Even better:
>
> if (r < 0)
> return true;
>
> return memcmp(...) != 0;
>
>Paolo
Thanks for your suggestion. I will send a patch v2 to complete it. Many thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] KVM: x86: get rid of odd out jump label in pdptrs_changed
2019-10-25 2:01 Miaohe Lin
@ 2019-10-25 9:43 ` Paolo Bonzini
0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2019-10-25 9:43 UTC (permalink / raw)
To: Miaohe Lin, rkrcmar, sean.j.christopherson, vkuznets, wanpengli,
jmattson, joro, tglx, mingo, bp, hpa
Cc: x86, kvm, linux-kernel
On 25/10/19 04:01, Miaohe Lin wrote:
> - if (r < 0)
> - goto out;
> - changed = memcmp(pdpte, vcpu->arch.walk_mmu->pdptrs, sizeof(pdpte)) != 0;
> -out:
> + if (r >= 0)
> + changed = memcmp(pdpte, vcpu->arch.walk_mmu->pdptrs,
> + sizeof(pdpte)) != 0;
>
> return changed;
Even better:
if (r < 0)
return true;
return memcmp(...) != 0;
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] KVM: x86: get rid of odd out jump label in pdptrs_changed
@ 2019-10-25 2:01 Miaohe Lin
2019-10-25 9:43 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Miaohe Lin @ 2019-10-25 2:01 UTC (permalink / raw)
To: pbonzini, rkrcmar, sean.j.christopherson, vkuznets, wanpengli,
jmattson, joro, tglx, mingo, bp, hpa
Cc: x86, kvm, linux-kernel, linmiaohe
The odd out jump label is really not needed. Get rid of
it by check r >= 0.
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
arch/x86/kvm/x86.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index ff395f812719..b6235872fd58 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -737,10 +737,9 @@ bool pdptrs_changed(struct kvm_vcpu *vcpu)
offset = (kvm_read_cr3(vcpu) & 0xffffffe0ul) & (PAGE_SIZE - 1);
r = kvm_read_nested_guest_page(vcpu, gfn, pdpte, offset, sizeof(pdpte),
PFERR_USER_MASK | PFERR_WRITE_MASK);
- if (r < 0)
- goto out;
- changed = memcmp(pdpte, vcpu->arch.walk_mmu->pdptrs, sizeof(pdpte)) != 0;
-out:
+ if (r >= 0)
+ changed = memcmp(pdpte, vcpu->arch.walk_mmu->pdptrs,
+ sizeof(pdpte)) != 0;
return changed;
}
--
2.19.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-25 10:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-25 10:43 [PATCH] KVM: x86: get rid of odd out jump label in pdptrs_changed linmiaohe
-- strict thread matches above, loose matches on Subject: below --
2019-10-25 2:01 Miaohe Lin
2019-10-25 9:43 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).