All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandru Elisei <alexandru.elisei@arm.com>
To: Marc Zyngier <maz@kernel.org>
Cc: will@kernel.org, kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH kvmtool 9/9] arm64: Add support for KVM_ARM_VCPU_PMU_V3_SET_PMU
Date: Sat, 8 Jan 2022 16:03:36 +0000	[thread overview]
Message-ID: <Ydm12K8O/9SNO3ht@monolith.localdoman> (raw)
In-Reply-To: <87o84mtl1m.wl-maz@kernel.org>

Hi Marc,

On Sat, Jan 08, 2022 at 01:27:17PM +0000, Marc Zyngier wrote:
> On Fri, 07 Jan 2022 12:10:05 +0000,
> Alexandru Elisei <alexandru.elisei@arm.com> wrote:
> > 
> > Hi Marc,
> > 
> > On Tue, Jan 04, 2022 at 02:39:59PM +0000, Marc Zyngier wrote:
> > > On Mon, 15 Nov 2021 16:57:05 +0000,
> > > Alexandru Elisei <alexandru.elisei@arm.com> wrote:
> > > > 
> > > > The KVM_ARM_VCPU_PMU_V3_CTRL(KVM_ARM_VCPU_PMU_V3_SET_PMU) VCPU ioctl is
> > > > used to assign a physical PMU to the events that KVM creates when emulating
> > > > the PMU for that VCPU. This is useful on heterogeneous systems, when there
> > > > is more than one hardware PMU present.
> > > > 
> > > > The assumption that is made in the implementation is that the user will
> > > > pin the kvmtool process on a set of CPUs that share the same PMU. This
> > > > allows kvmtool to set the same PMU for all VCPUs from the main thread,
> > > > instead of in the individual VCPU threads.
> > > 
> > > May I suggest a slightly different use model? Ideally, you'd be able
> > > to run the vcpu threads on the CPUs matching the PMU affinity, and
> > > leave all the other threads to roam on other CPUs.
> > 
> > Right now, the only way for userspace to make kvmtool run on a particular
> > set of CPUs in a heterogeneous configuration is to use taskset, which means
> > the entire kvmtool process ends up being pinned on a subset of CPUs which
> > have the same PMU. I would like to keep this approach, as it's simple and
> > straightforward to implement in kvmtool, and it's easy to change in the
> > future if there's an incentive to do so.
> > 
> > It's also not clear to me how your suggestion would work. Add a command
> > line argument to pin all the VCPUs to the specified cpumask?
> > 
> > > 
> > > With your implementation, the whole of kvmtool gets stuck to a given
> > > CPU type, which can be problematic.
> > 
> > Do you have a specific use case in mind? Or is it more like a general
> > concern regarding, for example, the virtio-blk-io or virtio-net-* threads
> > competing with the VCPU threads if the VM is doing lots of I/O?
> 
> Exactly that. The real requirement is that the vcpu thread affinities
> are that of the PMU, but not that of any other thread. Maybe that's
> just another parameter, independent of the PMU setup. Something like:
> 
> 	lkvm run ... --vcpu-affinity $(< /sys/devices/armv8_pmuv3_0/cpus)
> 
> for example.

That should be easy (famous last words?) to implement as a separate patch
on top of this series, I'll give that a go in the next iteration.

Thanks for the suggestion.

Alex
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

WARNING: multiple messages have this Message-ID (diff)
From: Alexandru Elisei <alexandru.elisei@arm.com>
To: Marc Zyngier <maz@kernel.org>
Cc: will@kernel.org, julien.thierry.kdev@gmail.com,
	linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu, james.morse@arm.com,
	suzuki.poulose@arm.com, mark.rutland@arm.com
Subject: Re: [PATCH kvmtool 9/9] arm64: Add support for KVM_ARM_VCPU_PMU_V3_SET_PMU
Date: Sat, 8 Jan 2022 16:03:36 +0000	[thread overview]
Message-ID: <Ydm12K8O/9SNO3ht@monolith.localdoman> (raw)
In-Reply-To: <87o84mtl1m.wl-maz@kernel.org>

Hi Marc,

On Sat, Jan 08, 2022 at 01:27:17PM +0000, Marc Zyngier wrote:
> On Fri, 07 Jan 2022 12:10:05 +0000,
> Alexandru Elisei <alexandru.elisei@arm.com> wrote:
> > 
> > Hi Marc,
> > 
> > On Tue, Jan 04, 2022 at 02:39:59PM +0000, Marc Zyngier wrote:
> > > On Mon, 15 Nov 2021 16:57:05 +0000,
> > > Alexandru Elisei <alexandru.elisei@arm.com> wrote:
> > > > 
> > > > The KVM_ARM_VCPU_PMU_V3_CTRL(KVM_ARM_VCPU_PMU_V3_SET_PMU) VCPU ioctl is
> > > > used to assign a physical PMU to the events that KVM creates when emulating
> > > > the PMU for that VCPU. This is useful on heterogeneous systems, when there
> > > > is more than one hardware PMU present.
> > > > 
> > > > The assumption that is made in the implementation is that the user will
> > > > pin the kvmtool process on a set of CPUs that share the same PMU. This
> > > > allows kvmtool to set the same PMU for all VCPUs from the main thread,
> > > > instead of in the individual VCPU threads.
> > > 
> > > May I suggest a slightly different use model? Ideally, you'd be able
> > > to run the vcpu threads on the CPUs matching the PMU affinity, and
> > > leave all the other threads to roam on other CPUs.
> > 
> > Right now, the only way for userspace to make kvmtool run on a particular
> > set of CPUs in a heterogeneous configuration is to use taskset, which means
> > the entire kvmtool process ends up being pinned on a subset of CPUs which
> > have the same PMU. I would like to keep this approach, as it's simple and
> > straightforward to implement in kvmtool, and it's easy to change in the
> > future if there's an incentive to do so.
> > 
> > It's also not clear to me how your suggestion would work. Add a command
> > line argument to pin all the VCPUs to the specified cpumask?
> > 
> > > 
> > > With your implementation, the whole of kvmtool gets stuck to a given
> > > CPU type, which can be problematic.
> > 
> > Do you have a specific use case in mind? Or is it more like a general
> > concern regarding, for example, the virtio-blk-io or virtio-net-* threads
> > competing with the VCPU threads if the VM is doing lots of I/O?
> 
> Exactly that. The real requirement is that the vcpu thread affinities
> are that of the PMU, but not that of any other thread. Maybe that's
> just another parameter, independent of the PMU setup. Something like:
> 
> 	lkvm run ... --vcpu-affinity $(< /sys/devices/armv8_pmuv3_0/cpus)
> 
> for example.

That should be easy (famous last words?) to implement as a separate patch
on top of this series, I'll give that a go in the next iteration.

Thanks for the suggestion.

Alex

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-01-08 16:03 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15 16:56 [PATCH kvmtool 0/9] arm64: Improve PMU support on heterogeneous systems Alexandru Elisei
2021-11-15 16:56 ` Alexandru Elisei
2021-11-15 16:56 ` [PATCH kvmtool 1/9] linux/err.h: Add missing stdbool.h include Alexandru Elisei
2021-11-15 16:56   ` Alexandru Elisei
2021-11-15 16:56 ` [PATCH kvmtool 2/9] arm: Move arch specific VCPU features to the arch specific function Alexandru Elisei
2021-11-15 16:56   ` Alexandru Elisei
2021-11-15 16:56 ` [PATCH kvmtool 3/9] arm: Get rid of the ARM_VCPU_FEATURE_FLAGS() macro Alexandru Elisei
2021-11-15 16:56   ` Alexandru Elisei
2021-11-15 16:57 ` [PATCH kvmtool 4/9] arm: Make the PMUv3 emulation code arm64 specific Alexandru Elisei
2021-11-15 16:57   ` Alexandru Elisei
2021-11-15 16:57 ` [PATCH kvmtool 5/9] arm64: Rework set_pmu_attr() Alexandru Elisei
2021-11-15 16:57   ` Alexandru Elisei
2021-11-15 16:57 ` [PATCH kvmtool 6/9] util: Add basic cpumask functions Alexandru Elisei
2021-11-15 16:57   ` Alexandru Elisei
2021-11-15 16:57 ` [PATCH kvmtool 7/9] util: Add cpulist_parse() Alexandru Elisei
2021-11-15 16:57   ` Alexandru Elisei
2021-11-15 16:57 ` [PATCH kvmtool 8/9] update_headers.sh: Sync headers with Linux v5.16-rc1 + SET_PMU attribute Alexandru Elisei
2021-11-15 16:57   ` Alexandru Elisei
2021-11-15 16:57 ` [PATCH kvmtool 9/9] arm64: Add support for KVM_ARM_VCPU_PMU_V3_SET_PMU Alexandru Elisei
2021-11-15 16:57   ` Alexandru Elisei
2022-01-04 14:39   ` Marc Zyngier
2022-01-04 14:39     ` Marc Zyngier
2022-01-07 12:10     ` Alexandru Elisei
2022-01-07 12:10       ` Alexandru Elisei
2022-01-08 13:27       ` Marc Zyngier
2022-01-08 13:27         ` Marc Zyngier
2022-01-08 16:03         ` Alexandru Elisei [this message]
2022-01-08 16:03           ` Alexandru Elisei

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=Ydm12K8O/9SNO3ht@monolith.localdoman \
    --to=alexandru.elisei@arm.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maz@kernel.org \
    --cc=will@kernel.org \
    /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 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.