All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: Add the missing stub function for kvm_dirty_ring_check_request()
@ 2023-03-16 15:45 Shameer Kolothum
  2023-03-16 17:02 ` Sean Christopherson
  0 siblings, 1 reply; 6+ messages in thread
From: Shameer Kolothum @ 2023-03-16 15:45 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: gshan, maz

The stub for !CONFIG_HAVE_KVM_DIRTY_RING case is missing.

Fixes: cf87ac739e48 ("KVM: x86: Introduce KVM_REQ_DIRTY_RING_SOFT_FULL")
Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
---
 include/linux/kvm_dirty_ring.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/kvm_dirty_ring.h b/include/linux/kvm_dirty_ring.h
index 4862c98d80d3..a00301059da5 100644
--- a/include/linux/kvm_dirty_ring.h
+++ b/include/linux/kvm_dirty_ring.h
@@ -69,6 +69,11 @@ static inline void kvm_dirty_ring_free(struct kvm_dirty_ring *ring)
 {
 }
 
+static inline bool kvm_dirty_ring_check_request(struct kvm_vcpu *vcpu)
+{
+	return false;
+}
+
 #else /* CONFIG_HAVE_KVM_DIRTY_RING */
 
 int kvm_cpu_dirty_log_size(void);
-- 
2.34.1


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

* Re: [PATCH] KVM: Add the missing stub function for kvm_dirty_ring_check_request()
  2023-03-16 15:45 [PATCH] KVM: Add the missing stub function for kvm_dirty_ring_check_request() Shameer Kolothum
@ 2023-03-16 17:02 ` Sean Christopherson
  2023-03-16 19:39   ` Shameerali Kolothum Thodi
  0 siblings, 1 reply; 6+ messages in thread
From: Sean Christopherson @ 2023-03-16 17:02 UTC (permalink / raw)
  To: Shameer Kolothum; +Cc: linux-kernel, kvm, gshan, maz

On Thu, Mar 16, 2023, Shameer Kolothum wrote:
> The stub for !CONFIG_HAVE_KVM_DIRTY_RING case is missing.

No stub is needed.  kvm_dirty_ring_check_request() isn't called from common code,
and should not (and isn't unless I'm missing something) be called from arch code
unless CONFIG_HAVE_KVM_DIRTY_RING=y.

x86 and arm64 are the only users, and they both select HAVE_KVM_DIRTY_RING
unconditionally when KVM is enabled.

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

* RE: [PATCH] KVM: Add the missing stub function for kvm_dirty_ring_check_request()
  2023-03-16 17:02 ` Sean Christopherson
@ 2023-03-16 19:39   ` Shameerali Kolothum Thodi
  2023-03-16 19:57     ` Sean Christopherson
  0 siblings, 1 reply; 6+ messages in thread
From: Shameerali Kolothum Thodi @ 2023-03-16 19:39 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: linux-kernel, kvm, gshan, maz



> -----Original Message-----
> From: Sean Christopherson [mailto:seanjc@google.com]
> Sent: 16 March 2023 17:02
> To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
> Cc: linux-kernel@vger.kernel.org; kvm@vger.kernel.org; gshan@redhat.com;
> maz@kernel.org
> Subject: Re: [PATCH] KVM: Add the missing stub function for
> kvm_dirty_ring_check_request()
> 
> On Thu, Mar 16, 2023, Shameer Kolothum wrote:
> > The stub for !CONFIG_HAVE_KVM_DIRTY_RING case is missing.
> 
> No stub is needed.  kvm_dirty_ring_check_request() isn't called from
> common code,
> and should not (and isn't unless I'm missing something) be called from arch
> code
> unless CONFIG_HAVE_KVM_DIRTY_RING=y.
> 
> x86 and arm64 are the only users, and they both select
> HAVE_KVM_DIRTY_RING
> unconditionally when KVM is enabled.

Yes, it is at present not called from anywhere other than x86 and arm64.
But I still think since it is a common helper, better to have a stub.

Thanks,
Shameer

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

* Re: [PATCH] KVM: Add the missing stub function for kvm_dirty_ring_check_request()
  2023-03-16 19:39   ` Shameerali Kolothum Thodi
@ 2023-03-16 19:57     ` Sean Christopherson
  2023-03-16 20:02       ` Shameerali Kolothum Thodi
  0 siblings, 1 reply; 6+ messages in thread
From: Sean Christopherson @ 2023-03-16 19:57 UTC (permalink / raw)
  To: Shameerali Kolothum Thodi; +Cc: linux-kernel, kvm, gshan, maz

On Thu, Mar 16, 2023, Shameerali Kolothum Thodi wrote:
> > From: Sean Christopherson [mailto:seanjc@google.com]
> > On Thu, Mar 16, 2023, Shameer Kolothum wrote:
> > > The stub for !CONFIG_HAVE_KVM_DIRTY_RING case is missing.
> > 
> > No stub is needed.  kvm_dirty_ring_check_request() isn't called from
> > common code,
> > and should not (and isn't unless I'm missing something) be called from arch
> > code
> > unless CONFIG_HAVE_KVM_DIRTY_RING=y.
> > 
> > x86 and arm64 are the only users, and they both select
> > HAVE_KVM_DIRTY_RING
> > unconditionally when KVM is enabled.
> 
> Yes, it is at present not called from anywhere other than x86 and arm64.
> But I still think since it is a common helper, better to have a stub.

Why?  It buys us nothing other than dead code, and even worse it could let a bug
that would otherwise be caught during build time escape to run time.

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

* RE: [PATCH] KVM: Add the missing stub function for kvm_dirty_ring_check_request()
  2023-03-16 19:57     ` Sean Christopherson
@ 2023-03-16 20:02       ` Shameerali Kolothum Thodi
  2023-03-17  0:18         ` Sean Christopherson
  0 siblings, 1 reply; 6+ messages in thread
From: Shameerali Kolothum Thodi @ 2023-03-16 20:02 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: linux-kernel, kvm, gshan, maz



> -----Original Message-----
> From: Sean Christopherson [mailto:seanjc@google.com]
> Sent: 16 March 2023 19:57
> To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
> Cc: linux-kernel@vger.kernel.org; kvm@vger.kernel.org; gshan@redhat.com;
> maz@kernel.org
> Subject: Re: [PATCH] KVM: Add the missing stub function for
> kvm_dirty_ring_check_request()
> 
> On Thu, Mar 16, 2023, Shameerali Kolothum Thodi wrote:
> > > From: Sean Christopherson [mailto:seanjc@google.com] On Thu, Mar 16,
> > > 2023, Shameer Kolothum wrote:
> > > > The stub for !CONFIG_HAVE_KVM_DIRTY_RING case is missing.
> > >
> > > No stub is needed.  kvm_dirty_ring_check_request() isn't called from
> > > common code, and should not (and isn't unless I'm missing something)
> > > be called from arch code unless CONFIG_HAVE_KVM_DIRTY_RING=y.
> > >
> > > x86 and arm64 are the only users, and they both select
> > > HAVE_KVM_DIRTY_RING unconditionally when KVM is enabled.
> >
> > Yes, it is at present not called from anywhere other than x86 and arm64.
> > But I still think since it is a common helper, better to have a stub.
> 
> Why?  It buys us nothing other than dead code, and even worse it could let
> a bug that would otherwise be caught during build time escape to run time.

Agree, it buys nothing now:) It just came up while I was playing with a custom
build without HAVE_KVM_DIRTY_RING. Since all other functions there has a stub
just thought it would make it easier for future common usage. We could very well
leave it till that comes up as well.

Thanks,
Shameer

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

* Re: [PATCH] KVM: Add the missing stub function for kvm_dirty_ring_check_request()
  2023-03-16 20:02       ` Shameerali Kolothum Thodi
@ 2023-03-17  0:18         ` Sean Christopherson
  0 siblings, 0 replies; 6+ messages in thread
From: Sean Christopherson @ 2023-03-17  0:18 UTC (permalink / raw)
  To: Shameerali Kolothum Thodi; +Cc: linux-kernel, kvm, gshan, maz

On Thu, Mar 16, 2023, Shameerali Kolothum Thodi wrote:
> > From: Sean Christopherson [mailto:seanjc@google.com]
> > On Thu, Mar 16, 2023, Shameerali Kolothum Thodi wrote:
> > > > From: Sean Christopherson [mailto:seanjc@google.com] On Thu, Mar 16,
> > > > 2023, Shameer Kolothum wrote:
> > > > > The stub for !CONFIG_HAVE_KVM_DIRTY_RING case is missing.
> > > >
> > > > No stub is needed.  kvm_dirty_ring_check_request() isn't called from
> > > > common code, and should not (and isn't unless I'm missing something)
> > > > be called from arch code unless CONFIG_HAVE_KVM_DIRTY_RING=y.
> > > >
> > > > x86 and arm64 are the only users, and they both select
> > > > HAVE_KVM_DIRTY_RING unconditionally when KVM is enabled.
> > >
> > > Yes, it is at present not called from anywhere other than x86 and arm64.
> > > But I still think since it is a common helper, better to have a stub.
> > 
> > Why?  It buys us nothing other than dead code, and even worse it could let
> > a bug that would otherwise be caught during build time escape to run time.
> 
> Agree, it buys nothing now:) It just came up while I was playing with a custom
> build without HAVE_KVM_DIRTY_RING. Since all other functions there has a stub
> just thought it would make it easier for future common usage. We could very well
> leave it till that comes up as well.

Stubs are typically only added when they are strictly necessary.  Providing a stub
would make things "easier" in the sense that it could theoretically avoid a build
error, but as above, in many cases we _want_ build errors when new code behaves
in a way that diverges from what's expected/established.

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

end of thread, other threads:[~2023-03-17  0:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-16 15:45 [PATCH] KVM: Add the missing stub function for kvm_dirty_ring_check_request() Shameer Kolothum
2023-03-16 17:02 ` Sean Christopherson
2023-03-16 19:39   ` Shameerali Kolothum Thodi
2023-03-16 19:57     ` Sean Christopherson
2023-03-16 20:02       ` Shameerali Kolothum Thodi
2023-03-17  0:18         ` Sean Christopherson

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.