All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Chartre <alexandre.chartre@oracle.com>
To: Marc Zyngier <maz@kernel.org>
Cc: will@kernel.org, catalin.marinas@arm.com,
	alexandru.elisei@arm.com, james.morse@arm.com,
	suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org,
	konrad.wilk@oracle.com, alexandre.chartre@oracle.com
Subject: Re: [PATCH] KVM: arm64: Disabling disabled PMU counters wastes a lot of time
Date: Tue, 6 Jul 2021 15:50:35 +0200	[thread overview]
Message-ID: <ed86299d-c0d4-f73e-ff7d-86eefd2de650@oracle.com> (raw)
In-Reply-To: <e3843c2c-e20a-ef58-c795-1ba8f1d91ff6@oracle.com>


Hi Marc,

On 6/29/21 3:16 PM, Alexandre Chartre wrote:
> On 6/29/21 11:06 AM, Marc Zyngier wrote
> [...]
>> So the sysreg is the only thing we should consider, and I think we
>> should drop the useless masking. There is at least another instance of
>> this in the PMU code (kvm_pmu_overflow_status()), and apart from
>> kvm_pmu_vcpu_reset(), only the sysreg accessors should care about the
>> masking to sanitise accesses.
>>
>> What do you think?
>>
> 
> I think you are right. PMCNTENSET_EL0 is already masked with kvm_pmu_valid_counter_mask()
> so there's effectively no need to mask it again when we use it. I will send an additional
> patch (on top of this one) to remove useless masking. Basically, changes would be:

I had a closer look and we can't remove the mask. The access functions (for pmcnten, pminten,
pmovs), clear or set only the specified valid counter bits. This means that bits other than
the valid counter bits never change in __vcpu_sys_reg(), and those bits are not necessarily
zero because the initial value is 0x1de7ec7edbadc0deULL (set by reset_unknown()).

So I will resubmit initial patch, with just the commit message changes.

Thanks,

alex.

WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Chartre <alexandre.chartre@oracle.com>
To: Marc Zyngier <maz@kernel.org>
Cc: kvm@vger.kernel.org, catalin.marinas@arm.com,
	konrad.wilk@oracle.com, will@kernel.org,
	kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] KVM: arm64: Disabling disabled PMU counters wastes a lot of time
Date: Tue, 6 Jul 2021 15:50:35 +0200	[thread overview]
Message-ID: <ed86299d-c0d4-f73e-ff7d-86eefd2de650@oracle.com> (raw)
In-Reply-To: <e3843c2c-e20a-ef58-c795-1ba8f1d91ff6@oracle.com>


Hi Marc,

On 6/29/21 3:16 PM, Alexandre Chartre wrote:
> On 6/29/21 11:06 AM, Marc Zyngier wrote
> [...]
>> So the sysreg is the only thing we should consider, and I think we
>> should drop the useless masking. There is at least another instance of
>> this in the PMU code (kvm_pmu_overflow_status()), and apart from
>> kvm_pmu_vcpu_reset(), only the sysreg accessors should care about the
>> masking to sanitise accesses.
>>
>> What do you think?
>>
> 
> I think you are right. PMCNTENSET_EL0 is already masked with kvm_pmu_valid_counter_mask()
> so there's effectively no need to mask it again when we use it. I will send an additional
> patch (on top of this one) to remove useless masking. Basically, changes would be:

I had a closer look and we can't remove the mask. The access functions (for pmcnten, pminten,
pmovs), clear or set only the specified valid counter bits. This means that bits other than
the valid counter bits never change in __vcpu_sys_reg(), and those bits are not necessarily
zero because the initial value is 0x1de7ec7edbadc0deULL (set by reset_unknown()).

So I will resubmit initial patch, with just the commit message changes.

Thanks,

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: Alexandre Chartre <alexandre.chartre@oracle.com>
To: Marc Zyngier <maz@kernel.org>
Cc: will@kernel.org, catalin.marinas@arm.com,
	alexandru.elisei@arm.com, james.morse@arm.com,
	suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org,
	konrad.wilk@oracle.com, alexandre.chartre@oracle.com
Subject: Re: [PATCH] KVM: arm64: Disabling disabled PMU counters wastes a lot of time
Date: Tue, 6 Jul 2021 15:50:35 +0200	[thread overview]
Message-ID: <ed86299d-c0d4-f73e-ff7d-86eefd2de650@oracle.com> (raw)
In-Reply-To: <e3843c2c-e20a-ef58-c795-1ba8f1d91ff6@oracle.com>


Hi Marc,

On 6/29/21 3:16 PM, Alexandre Chartre wrote:
> On 6/29/21 11:06 AM, Marc Zyngier wrote
> [...]
>> So the sysreg is the only thing we should consider, and I think we
>> should drop the useless masking. There is at least another instance of
>> this in the PMU code (kvm_pmu_overflow_status()), and apart from
>> kvm_pmu_vcpu_reset(), only the sysreg accessors should care about the
>> masking to sanitise accesses.
>>
>> What do you think?
>>
> 
> I think you are right. PMCNTENSET_EL0 is already masked with kvm_pmu_valid_counter_mask()
> so there's effectively no need to mask it again when we use it. I will send an additional
> patch (on top of this one) to remove useless masking. Basically, changes would be:

I had a closer look and we can't remove the mask. The access functions (for pmcnten, pminten,
pmovs), clear or set only the specified valid counter bits. This means that bits other than
the valid counter bits never change in __vcpu_sys_reg(), and those bits are not necessarily
zero because the initial value is 0x1de7ec7edbadc0deULL (set by reset_unknown()).

So I will resubmit initial patch, with just the commit message changes.

Thanks,

alex.

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

  parent reply	other threads:[~2021-07-06 15:13 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-28 16:19 [PATCH] KVM: arm64: Disabling disabled PMU counters wastes a lot of time Alexandre Chartre
2021-06-28 16:19 ` Alexandre Chartre
2021-06-28 16:19 ` Alexandre Chartre
2021-06-29  9:06 ` Marc Zyngier
2021-06-29  9:06   ` Marc Zyngier
2021-06-29  9:06   ` Marc Zyngier
2021-06-29 13:16   ` Alexandre Chartre
2021-06-29 13:16     ` Alexandre Chartre
2021-06-29 13:16     ` Alexandre Chartre
2021-06-29 13:47     ` Marc Zyngier
2021-06-29 13:47       ` Marc Zyngier
2021-06-29 13:47       ` Marc Zyngier
2021-06-29 14:17       ` Alexandre Chartre
2021-06-29 14:17         ` Alexandre Chartre
2021-06-29 14:17         ` Alexandre Chartre
2021-06-29 14:25         ` Marc Zyngier
2021-06-29 14:25           ` Marc Zyngier
2021-06-29 14:25           ` Marc Zyngier
2021-06-29 14:40           ` Alexandre Chartre
2021-06-29 14:40             ` Alexandre Chartre
2021-06-29 14:40             ` Alexandre Chartre
2021-07-06 13:50     ` Alexandre Chartre [this message]
2021-07-06 13:50       ` Alexandre Chartre
2021-07-06 13:50       ` Alexandre Chartre
2021-07-06 14:52       ` Marc Zyngier
2021-07-06 14:52         ` Marc Zyngier
2021-07-06 14:52         ` Marc Zyngier
2021-07-06 15:35         ` Alexandre Chartre
2021-07-06 15:35           ` Alexandre Chartre
2021-07-06 15:35           ` Alexandre Chartre
2021-07-06 17:36         ` Marc Zyngier
2021-07-06 17:36           ` Marc Zyngier
2021-07-06 17:36           ` Marc Zyngier
2021-07-07 12:48           ` Alexandre Chartre
2021-07-07 12:48             ` Alexandre Chartre
2021-07-07 12:48             ` Alexandre Chartre

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=ed86299d-c0d4-f73e-ff7d-86eefd2de650@oracle.com \
    --to=alexandre.chartre@oracle.com \
    --cc=alexandru.elisei@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=james.morse@arm.com \
    --cc=konrad.wilk@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maz@kernel.org \
    --cc=suzuki.poulose@arm.com \
    --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.