From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: andrew.murray@arm.com, christoffer.dall@arm.com, marc.zyngier@arm.com
Cc: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v8 6/6] KVM: arm/arm64: support chained PMU counters
Date: Mon, 10 Jun 2019 17:05:24 +0100 [thread overview]
Message-ID: <72be95b6-e34b-2a04-d503-10399da09afc@arm.com> (raw)
In-Reply-To: <20190522153019.18645-7-andrew.murray@arm.com>
Hi Andrew,
> @@ -398,27 +531,43 @@ static void kvm_pmu_create_perf_event(struct kvm_vcpu *vcpu, u64 select_idx)
>
> /* Software increment event does't need to be backed by a perf event */
> if (eventsel == ARMV8_PMUV3_PERFCTR_SW_INCR &&
> - select_idx != ARMV8_PMU_CYCLE_IDX)
> + pmc->idx != ARMV8_PMU_CYCLE_IDX)
> return;
>
> memset(&attr, 0, sizeof(struct perf_event_attr));
> attr.type = PERF_TYPE_RAW;
> attr.size = sizeof(attr);
> attr.pinned = 1;
> - attr.disabled = !kvm_pmu_counter_is_enabled(vcpu, select_idx);
> + attr.disabled = !kvm_pmu_counter_is_enabled(vcpu, pmc->idx);
> attr.exclude_user = data & ARMV8_PMU_EXCLUDE_EL0 ? 1 : 0;
> attr.exclude_kernel = data & ARMV8_PMU_EXCLUDE_EL1 ? 1 : 0;
> attr.exclude_hv = 1; /* Don't count EL2 events */
> attr.exclude_host = 1; /* Don't count host events */
> - attr.config = (select_idx == ARMV8_PMU_CYCLE_IDX) ?
> + attr.config = (pmc->idx == ARMV8_PMU_CYCLE_IDX) ?
> ARMV8_PMUV3_PERFCTR_CPU_CYCLES : eventsel;
>
> - counter = kvm_pmu_get_counter_value(vcpu, select_idx);
> - /* The initial sample period (overflow count) of an event. */
> - attr.sample_period = (-counter) & GENMASK(31, 0);
> + counter = kvm_pmu_get_pair_counter_value(vcpu, pmc);
> +
> + if (kvm_pmu_idx_has_chain_evtype(vcpu, pmc->idx)) {
> + /**
> + * The initial sample period (overflow count) of an event. For
> + * chained counters we only support overflow interrupts on the
> + * high counter.
> + */
> + attr.sample_period = (-counter) & GENMASK(63, 0);
> + event = perf_event_create_kernel_counter(&attr, -1, current,
> + kvm_pmu_perf_overflow,
> + pmc + 1);
>
> - event = perf_event_create_kernel_counter(&attr, -1, current,
> + if (kvm_pmu_counter_is_enabled(vcpu, pmc->idx + 1))
> + attr.config1 |= PERF_ATTR_CFG1_KVM_PMU_CHAINED;
> + } else {
> + /* The initial sample period (overflow count) of an event. */
> + attr.sample_period = (-counter) & GENMASK(31, 0);
> + event = perf_event_create_kernel_counter(&attr, -1, current,
> kvm_pmu_perf_overflow, pmc);
> + }
> +
If this was the Cycle counter and t he PMCR_LC was set, shouldn't we be using
64bit mask here ? We fall back to using the Cycle counter in 64bit mode for
"normal" (read guest) kernel. So shouldn't we reflect that here ?
Rest looks fine to me.
Suzuki
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
prev parent reply other threads:[~2019-06-10 16:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-22 15:30 [PATCH v8 0/6] KVM: arm/arm64: add support for chained counters Andrew Murray
2019-05-22 15:30 ` [PATCH v8 1/6] KVM: arm/arm64: rename kvm_pmu_{enable/disable}_counter functions Andrew Murray
2019-05-22 15:30 ` [PATCH v8 2/6] KVM: arm/arm64: extract duplicated code to own function Andrew Murray
2019-05-22 15:30 ` [PATCH v8 3/6] KVM: arm/arm64: re-create event when setting counter value Andrew Murray
2019-05-22 15:30 ` [PATCH v8 4/6] arm64: perf: extract chain helper into header Andrew Murray
2019-06-10 11:39 ` Will Deacon
2019-05-22 15:30 ` [PATCH v8 5/6] KVM: arm/arm64: remove pmc->bitmask Andrew Murray
2019-05-22 16:07 ` Marc Zyngier
2019-05-22 16:26 ` Andrew Murray
2019-06-10 12:54 ` Suzuki K Poulose
2019-06-12 14:30 ` Andrew Murray
2019-05-22 15:30 ` [PATCH v8 6/6] KVM: arm/arm64: support chained PMU counters Andrew Murray
2019-06-10 10:21 ` Julien Thierry
2019-06-10 16:05 ` Suzuki K Poulose [this message]
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=72be95b6-e34b-2a04-d503-10399da09afc@arm.com \
--to=suzuki.poulose@arm.com \
--cc=andrew.murray@arm.com \
--cc=christoffer.dall@arm.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=marc.zyngier@arm.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