[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d5c0d757232935c6446aeaca9afe4416@www.loen.fr>
Date: Tue, 23 Jul 2019 09:26:04 +0100
From: Marc Zyngier <maz@...nel.org>
To: Julien Thierry <julien.thierry@....com>
Cc: Zenghui Yu <yuzenghui@...wei.com>, <kvmarm@...ts.cs.columbia.edu>,
<linux-arm-kernel@...ts.infradead.org>, <james.morse@....com>,
<suzuki.poulose@....com>, <julien.thierry.kdev@...il.com>,
<linux-kernel@...r.kernel.org>, <wanghaibin.wang@...wei.com>,
<andrew.murray@....com>
Subject: Re: [PATCH v2] KVM: arm/arm64: Introduce kvm_pmu_vcpu_init() to setup PMU counter idx
On 2019-07-23 09:17, Julien Thierry wrote:
> Hi Zenghui,
>
> On 18/07/2019 09:15, Zenghui Yu wrote:
>> We use "pmc->idx" and the "chained" bitmap to determine if the pmc
>> is
>> chained, in kvm_pmu_pmc_is_chained(). But idx might be
>> uninitialized
>> (and random) when we doing this decision, through a
>> KVM_ARM_VCPU_INIT
>> ioctl -> kvm_pmu_vcpu_reset(). And the test_bit() against this
>> random
>> idx will potentially hit a KASAN BUG [1].
>>
>> In general, idx is the static property of a PMU counter that is not
>> expected to be modified across resets, as suggested by Julien. It
>> looks more reasonable if we can setup the PMU counter idx for a vcpu
>> in its creation time. Introduce a new function - kvm_pmu_vcpu_init()
>> for this basic setup. Oh, and the KASAN BUG will get fixed this way.
>>
>> [1] https://www.spinics.net/lists/kvm-arm/msg36700.html
>>
>> Fixes: 80f393a23be6 ("KVM: arm/arm64: Support chained PMU counters")
>> Suggested-by: Andrew Murray <andrew.murray@....com>
>> Suggested-by: Julien Thierry <julien.thierry@....com>
>> Cc: Marc Zyngier <maz@...nel.org>
>> Signed-off-by: Zenghui Yu <yuzenghui@...wei.com>
>> ---
>>
>> Changes since v1:
>> - Introduce kvm_pmu_vcpu_init() in vcpu's creation time, move the
>> assignment of pmc->idx into it.
>> - Thus change the subject. The old one is "KVM: arm/arm64: Assign
>> pmc->idx before kvm_pmu_stop_counter()".
>>
>> Julien, I haven't collected your Acked-by into this version. If
>> you're
>> still happy with the change, please Ack again. Thanks!
>>
>
> Thanks for making the change. This looks good to me:
>
> Acked-by: Julien Thierry <julien.thierry@....com>
Applied, thanks both.
M.
--
Jazz is not dead. It just smells funny...
Powered by blists - more mailing lists