public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: vmx: fix a build warning in hv_enable_direct_tlbflush() on i386
@ 2019-09-25  8:53 Vitaly Kuznetsov
  2019-09-25  9:03 ` Tianyu Lan
  0 siblings, 1 reply; 3+ messages in thread
From: Vitaly Kuznetsov @ 2019-09-25  8:53 UTC (permalink / raw)
  To: kvm
  Cc: linux-kernel, Paolo Bonzini, Radim Krčmář,
	Sean Christopherson, Jim Mattson, Tianyu Lan

The following was reported on i386:

  arch/x86/kvm/vmx/vmx.c: In function 'hv_enable_direct_tlbflush':
  arch/x86/kvm/vmx/vmx.c:503:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

The particular pr_debug() causing it is more or less useless, let's just
remove it. Also, simplify the condition a little bit.

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 arch/x86/kvm/vmx/vmx.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index a7c9922e3905..812553b7270f 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -495,13 +495,11 @@ static int hv_enable_direct_tlbflush(struct kvm_vcpu *vcpu)
 	 * Synthetic VM-Exit is not enabled in current code and so All
 	 * evmcs in singe VM shares same assist page.
 	 */
-	if (!*p_hv_pa_pg) {
+	if (!*p_hv_pa_pg)
 		*p_hv_pa_pg = kzalloc(PAGE_SIZE, GFP_KERNEL);
-		if (!*p_hv_pa_pg)
-			return -ENOMEM;
-		pr_debug("KVM: Hyper-V: allocated PA_PG for %llx\n",
-		       (u64)&vcpu->kvm);
-	}
+
+	if (!*p_hv_pa_pg)
+		return -ENOMEM;
 
 	evmcs = (struct hv_enlightened_vmcs *)to_vmx(vcpu)->loaded_vmcs->vmcs;
 
-- 
2.20.1


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

* RE: [PATCH] KVM: vmx: fix a build warning in hv_enable_direct_tlbflush() on i386
  2019-09-25  8:53 [PATCH] KVM: vmx: fix a build warning in hv_enable_direct_tlbflush() on i386 Vitaly Kuznetsov
@ 2019-09-25  9:03 ` Tianyu Lan
  2019-09-25 13:17   ` Vitaly Kuznetsov
  0 siblings, 1 reply; 3+ messages in thread
From: Tianyu Lan @ 2019-09-25  9:03 UTC (permalink / raw)
  To: vkuznets, kvm@vger.kernel.org
  Cc: linux-kernel@vger.kernel.org, Paolo Bonzini,
	Radim Krčmář, Sean Christopherson, Jim Mattson

There is another warning in the report.

arch/x86/kvm/vmx/vmx.c: In function 'hv_enable_direct_tlbflush':
arch/x86/kvm/vmx/vmx.c:507:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  evmcs->hv_vm_id = (u64)vcpu->kvm;
                    ^
The following change can fix it.
-       evmcs->hv_vm_id = (u64)vcpu->kvm;
+       evmcs->hv_vm_id = (unsigned long)vcpu->kvm;
        evmcs->hv_enlightenments_control.nested_flush_hypercall = 1;

-----Original Message-----
From: Vitaly Kuznetsov <vkuznets@redhat.com> 
Sent: Wednesday, September 25, 2019 4:53 PM
To: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org; Paolo Bonzini <pbonzini@redhat.com>; Radim Krčmář <rkrcmar@redhat.com>; Sean Christopherson <sean.j.christopherson@intel.com>; Jim Mattson <jmattson@google.com>; Tianyu Lan <Tianyu.Lan@microsoft.com>
Subject: [PATCH] KVM: vmx: fix a build warning in hv_enable_direct_tlbflush() on i386

The following was reported on i386:

  arch/x86/kvm/vmx/vmx.c: In function 'hv_enable_direct_tlbflush':
  arch/x86/kvm/vmx/vmx.c:503:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

The particular pr_debug() causing it is more or less useless, let's just remove it. Also, simplify the condition a little bit.

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 arch/x86/kvm/vmx/vmx.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index a7c9922e3905..812553b7270f 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -495,13 +495,11 @@ static int hv_enable_direct_tlbflush(struct kvm_vcpu *vcpu)
 	 * Synthetic VM-Exit is not enabled in current code and so All
 	 * evmcs in singe VM shares same assist page.
 	 */
-	if (!*p_hv_pa_pg) {
+	if (!*p_hv_pa_pg)
 		*p_hv_pa_pg = kzalloc(PAGE_SIZE, GFP_KERNEL);
-		if (!*p_hv_pa_pg)
-			return -ENOMEM;
-		pr_debug("KVM: Hyper-V: allocated PA_PG for %llx\n",
-		       (u64)&vcpu->kvm);
-	}
+
+	if (!*p_hv_pa_pg)
+		return -ENOMEM;
 
 	evmcs = (struct hv_enlightened_vmcs *)to_vmx(vcpu)->loaded_vmcs->vmcs;
 
--
2.20.1


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

* RE: [PATCH] KVM: vmx: fix a build warning in hv_enable_direct_tlbflush() on i386
  2019-09-25  9:03 ` Tianyu Lan
@ 2019-09-25 13:17   ` Vitaly Kuznetsov
  0 siblings, 0 replies; 3+ messages in thread
From: Vitaly Kuznetsov @ 2019-09-25 13:17 UTC (permalink / raw)
  To: Tianyu Lan, kvm@vger.kernel.org
  Cc: linux-kernel@vger.kernel.org, Paolo Bonzini,
	Radim Krčmář, Sean Christopherson, Jim Mattson

Tianyu Lan <Tianyu.Lan@microsoft.com> writes:

> There is another warning in the report.
>
> arch/x86/kvm/vmx/vmx.c: In function 'hv_enable_direct_tlbflush':
> arch/x86/kvm/vmx/vmx.c:507:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
>   evmcs->hv_vm_id = (u64)vcpu->kvm;
>                     ^
> The following change can fix it.
> -       evmcs->hv_vm_id = (u64)vcpu->kvm;
> +       evmcs->hv_vm_id = (unsigned long)vcpu->kvm;
>         evmcs->hv_enlightenments_control.nested_flush_hypercall = 1;
>

Missed that one (and I have to admit I haven't compiled my patch on i386
:-). Will send v2 with this included, thanks!

-- 
Vitaly

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

end of thread, other threads:[~2019-09-25 13:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-25  8:53 [PATCH] KVM: vmx: fix a build warning in hv_enable_direct_tlbflush() on i386 Vitaly Kuznetsov
2019-09-25  9:03 ` Tianyu Lan
2019-09-25 13:17   ` Vitaly Kuznetsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox