linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Andrew Jones <drjones@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	dinechin@redhat.com, sean.j.christopherson@intel.com,
	pbonzini@redhat.com, jasowang@redhat.com, yan.y.zhao@intel.com,
	mst@redhat.com, kevin.tian@intel.com, alex.williamson@redhat.com,
	dgilbert@redhat.com, vkuznets@redhat.com
Subject: Re: [PATCH 13/14] KVM: selftests: Let dirty_log_test async for dirty ring test
Date: Wed, 5 Feb 2020 10:55:51 -0500	[thread overview]
Message-ID: <20200205155551.GB378317@xz-x1> (raw)
In-Reply-To: <20200205094806.dqkzpxhrndocjl6g@kamzik.brq.redhat.com>

On Wed, Feb 05, 2020 at 10:48:06AM +0100, Andrew Jones wrote:
> On Tue, Feb 04, 2020 at 09:58:41PM -0500, Peter Xu wrote:
> > diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h
> > index 4b78a8d3e773..e64fbfe6bbd5 100644
> > --- a/tools/testing/selftests/kvm/include/kvm_util.h
> > +++ b/tools/testing/selftests/kvm/include/kvm_util.h
> > @@ -115,6 +115,7 @@ vm_paddr_t addr_gva2gpa(struct kvm_vm *vm, vm_vaddr_t gva);
> >  struct kvm_run *vcpu_state(struct kvm_vm *vm, uint32_t vcpuid);
> >  void vcpu_run(struct kvm_vm *vm, uint32_t vcpuid);
> >  int _vcpu_run(struct kvm_vm *vm, uint32_t vcpuid);
> > +int __vcpu_run(struct kvm_vm *vm, uint32_t vcpuid);
> >  void vcpu_run_complete_io(struct kvm_vm *vm, uint32_t vcpuid);
> >  void vcpu_set_mp_state(struct kvm_vm *vm, uint32_t vcpuid,
> >  		       struct kvm_mp_state *mp_state);
> > diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
> > index 25edf20d1962..5137882503bd 100644
> > --- a/tools/testing/selftests/kvm/lib/kvm_util.c
> > +++ b/tools/testing/selftests/kvm/lib/kvm_util.c
> > @@ -1203,6 +1203,14 @@ int _vcpu_run(struct kvm_vm *vm, uint32_t vcpuid)
> >  	return rc;
> >  }
> >  
> > +int __vcpu_run(struct kvm_vm *vm, uint32_t vcpuid)
> > +{
> > +	struct vcpu *vcpu = vcpu_find(vm, vcpuid);
> > +
> > +	TEST_ASSERT(vcpu != NULL, "vcpu not found, vcpuid: %u", vcpuid);
> > +	return ioctl(vcpu->fd, KVM_RUN, NULL);
> > +}
> > +
> >  void vcpu_run_complete_io(struct kvm_vm *vm, uint32_t vcpuid)
> >  {
> >  	struct vcpu *vcpu = vcpu_find(vm, vcpuid);
> 
> I think we should add a vcpu_get_fd(vm, vcpuid) function instead, and
> then call ioctl directly from the test.

Currently the vcpu struct is still internal to the lib/ directory (as
defined in lib/kvm_util_internal.h).  Wit that, it seems the vcpu fd
should also be limited to the lib/ as well?

But I feel like I got your point, because when I worked on the
selftests I did notice that in many places it's easier to expose all
these things for test cases (e.g., the struct vcpu).  For me, it's not
only for the vcpu fd, but also for the rest of internal structures to
be able to be accessed from tests directly.  Not sure whether that's
what you thought too.  It's just a separate topic of what this series
was trying to do.

Thanks,

-- 
Peter Xu


  reply	other threads:[~2020-02-05 15:56 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-05  2:50 [PATCH v4 00/14] KVM: Dirty ring interface Peter Xu
2020-02-05  2:50 ` [PATCH v4 01/14] KVM: X86: Change parameter for fast_page_fault tracepoint Peter Xu
2020-02-05  2:50 ` [PATCH v4 02/14] KVM: Cache as_id in kvm_memory_slot Peter Xu
2020-02-05  2:50 ` [PATCH v4 03/14] KVM: X86: Don't track dirty for KVM_SET_[TSS_ADDR|IDENTITY_MAP_ADDR] Peter Xu
2020-02-05  2:58 ` [PATCH 04/14] KVM: Pass in kvm pointer into mark_page_dirty_in_slot() Peter Xu
2020-02-05  2:58   ` [PATCH 05/14] KVM: X86: Implement ring-based dirty memory tracking Peter Xu
2020-02-05  2:58   ` [PATCH 06/14] KVM: Make dirty ring exclusive to dirty bitmap log Peter Xu
2020-02-05  2:58   ` [PATCH 07/14] KVM: Don't allocate dirty bitmap if dirty ring is enabled Peter Xu
2020-02-05  2:58   ` [PATCH 08/14] KVM: selftests: Always clear dirty bitmap after iteration Peter Xu
2020-02-05  2:58   ` [PATCH 09/14] KVM: selftests: Sync uapi/linux/kvm.h to tools/ Peter Xu
2020-02-05  2:58   ` [PATCH 10/14] KVM: selftests: Use a single binary for dirty/clear log test Peter Xu
2020-02-05  9:28     ` Andrew Jones
2020-02-05 15:46       ` Peter Xu
2020-02-05 17:11         ` Andrew Jones
2020-02-05 17:39           ` Peter Xu
2020-02-06 22:40             ` Peter Xu
2020-02-07  8:31               ` Andrew Jones
2020-02-05  2:58   ` [PATCH 11/14] KVM: selftests: Introduce after_vcpu_run hook for dirty " Peter Xu
2020-02-05  2:58   ` [PATCH 12/14] KVM: selftests: Add dirty ring buffer test Peter Xu
2020-02-05  2:58   ` [PATCH 13/14] KVM: selftests: Let dirty_log_test async for dirty ring test Peter Xu
2020-02-05  9:48     ` Andrew Jones
2020-02-05 15:55       ` Peter Xu [this message]
2020-02-05 17:15         ` Andrew Jones
2020-02-05  3:00 ` [PATCH 14/14] KVM: selftests: Add "-c" parameter to dirty log test Peter Xu
2020-03-03 17:33 ` [PATCH v4 00/14] KVM: Dirty ring interface Peter Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200205155551.GB378317@xz-x1 \
    --to=peterx@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=dinechin@redhat.com \
    --cc=drjones@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=vkuznets@redhat.com \
    --cc=yan.y.zhao@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).