All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: X86: Add 'else' to unify fastop and execute call path
@ 2020-01-22  3:21 linmiaohe
  2020-01-22  4:42 ` Sean Christopherson
  2020-01-22  4:43 ` [PATCH 02/01] KVM: x86: Use a typedef for fastop functions Sean Christopherson
  0 siblings, 2 replies; 6+ messages in thread
From: linmiaohe @ 2020-01-22  3:21 UTC (permalink / raw)
  To: pbonzini, rkrcmar, sean.j.christopherson, vkuznets, wanpengli,
	jmattson, joro, tglx, mingo, bp, hpa
  Cc: linmiaohe, kvm, linux-kernel, x86

From: Miaohe Lin <linmiaohe@huawei.com>

It also helps eliminate some duplicated code.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 arch/x86/kvm/emulate.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index c7a0da45f60a..0accce94f660 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -5683,11 +5683,9 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
 		if (ctxt->d & Fastop) {
 			void (*fop)(struct fastop *) = (void *)ctxt->execute;
 			rc = fastop(ctxt, fop);
-			if (rc != X86EMUL_CONTINUE)
-				goto done;
-			goto writeback;
+		} else {
+			rc = ctxt->execute(ctxt);
 		}
-		rc = ctxt->execute(ctxt);
 		if (rc != X86EMUL_CONTINUE)
 			goto done;
 		goto writeback;
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: X86: Add 'else' to unify fastop and execute call path
@ 2020-01-22  6:41 linmiaohe
  0 siblings, 0 replies; 6+ messages in thread
From: linmiaohe @ 2020-01-22  6:41 UTC (permalink / raw)
  To: Sean Christopherson
  Cc: pbonzini@redhat.com, rkrcmar@redhat.com, vkuznets@redhat.com,
	wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org,
	tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org

Hi:
Sean Christopherson <sean.j.christopherson@intel.com> wrote:
> On Wed, Jan 22, 2020 at 11:21:44AM +0800, linmiaohe wrote:
>> From: Miaohe Lin <linmiaohe@huawei.com>
>> 
>> It also helps eliminate some duplicated code.
>
> Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>

Thanks for your review.

>
>>  		if (ctxt->d & Fastop) {
>>  			void (*fop)(struct fastop *) = (void *)ctxt->execute;
>
>The brackets can also be removed with a bit more cleanup, e.g. using a typedef to handling casting ctxt->execute.  I'll send a patch that can be applied on top and/or squashed with this one.

Thanks for doing this. :)

>
>>  			rc = fastop(ctxt, fop);

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-01-22 14:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-22  3:21 [PATCH] KVM: X86: Add 'else' to unify fastop and execute call path linmiaohe
2020-01-22  4:42 ` Sean Christopherson
2020-01-22 14:24   ` Paolo Bonzini
2020-01-22  4:43 ` [PATCH 02/01] KVM: x86: Use a typedef for fastop functions Sean Christopherson
2020-01-22 14:25   ` Paolo Bonzini
  -- strict thread matches above, loose matches on Subject: below --
2020-01-22  6:41 [PATCH] KVM: X86: Add 'else' to unify fastop and execute call path linmiaohe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.