[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250227-3799414d0651c86f6a815046@orel>
Date: Thu, 27 Feb 2025 09:44:15 +0100
From: Andrew Jones <ajones@...tanamicro.com>
To: Atish Patra <atishp@...osinc.com>
Cc: Anup Patel <anup@...infault.org>, Atish Patra <atishp@...shpatra.org>,
Paul Walmsley <paul.walmsley@...ive.com>, Palmer Dabbelt <palmer@...belt.com>,
Paolo Bonzini <pbonzini@...hat.com>, Shuah Khan <shuah@...nel.org>, kvm@...r.kernel.org,
kvm-riscv@...ts.infradead.org, linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org
Subject: Re: [PATCH 2/4] KVM: riscv: selftests: Do not start the counter in
the overflow handler
On Wed, Feb 26, 2025 at 12:25:04PM -0800, Atish Patra wrote:
> There is no need to start the counter in the overflow handler as we
> intend to trigger precise number of LCOFI interrupts through these
> tests. The overflow irq handler has already stopped the counter. As
> a result, the stop call from the test function may return already
> supported error which is fine as well.
^ stopped
>
> Signed-off-by: Atish Patra <atishp@...osinc.com>
> ---
> tools/testing/selftests/kvm/riscv/sbi_pmu_test.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/tools/testing/selftests/kvm/riscv/sbi_pmu_test.c b/tools/testing/selftests/kvm/riscv/sbi_pmu_test.c
> index f45c0ecc902d..284bc80193bd 100644
> --- a/tools/testing/selftests/kvm/riscv/sbi_pmu_test.c
> +++ b/tools/testing/selftests/kvm/riscv/sbi_pmu_test.c
> @@ -118,8 +118,8 @@ static void stop_counter(unsigned long counter, unsigned long stop_flags)
>
> ret = sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_STOP, counter, 1, stop_flags,
> 0, 0, 0);
> - __GUEST_ASSERT(ret.error == 0, "Unable to stop counter %ld error %ld\n",
> - counter, ret.error);
> + __GUEST_ASSERT(ret.error == 0 || ret.error == SBI_ERR_ALREADY_STOPPED,
> + "Unable to stop counter %ld error %ld\n", counter, ret.error);
> }
>
> static void guest_illegal_exception_handler(struct ex_regs *regs)
> @@ -137,7 +137,6 @@ static void guest_irq_handler(struct ex_regs *regs)
> unsigned int irq_num = regs->cause & ~CAUSE_IRQ_FLAG;
> struct riscv_pmu_snapshot_data *snapshot_data = snapshot_gva;
> unsigned long overflown_mask;
> - unsigned long counter_val = 0;
>
> /* Validate that we are in the correct irq handler */
> GUEST_ASSERT_EQ(irq_num, IRQ_PMU_OVF);
> @@ -151,10 +150,6 @@ static void guest_irq_handler(struct ex_regs *regs)
> GUEST_ASSERT(overflown_mask & 0x01);
>
> WRITE_ONCE(vcpu_shared_irq_count, vcpu_shared_irq_count+1);
> -
> - counter_val = READ_ONCE(snapshot_data->ctr_values[0]);
> - /* Now start the counter to mimick the real driver behavior */
> - start_counter(counter_in_use, SBI_PMU_START_FLAG_SET_INIT_VALUE, counter_val);
> }
>
> static unsigned long get_counter_index(unsigned long cbase, unsigned long cmask,
>
> --
> 2.43.0
>
Other than the commit message,
Reviewed-by: Andrew Jones <ajones@...tanamicro.com>
Powered by blists - more mailing lists