From: "Nicholas Piggin" <npiggin@gmail.com>
To: "Thomas Huth" <thuth@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>,
linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org,
Andrew Jones <andrew.jones@linux.dev>
Subject: Re: [kvm-unit-tests PATCH v10 08/15] powerpc: add pmu tests
Date: Tue, 25 Jun 2024 11:56:12 +1000 [thread overview]
Message-ID: <D28Q3J98V4EC.1RXWN7UR4A3J7@gmail.com> (raw)
In-Reply-To: <5bfe90ca-96aa-405b-a4b9-86ec4a497366@redhat.com>
On Wed Jun 19, 2024 at 4:39 AM AEST, Thomas Huth wrote:
> On 12/06/2024 07.23, Nicholas Piggin wrote:
> > Add some initial PMU testing.
> >
> > - PMC5/6 tests
> > - PMAE / PMI test
> > - BHRB basic tests
> >
> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> > ---
> ...
> > diff --git a/powerpc/pmu.c b/powerpc/pmu.c
> > new file mode 100644
> > index 000000000..bdc45e167
> > --- /dev/null
> > +++ b/powerpc/pmu.c
> > @@ -0,0 +1,562 @@
> ...
> > +static void test_pmc5_with_ldat(void)
> > +{
> > + unsigned long pmc5_1, pmc5_2;
> > + register unsigned long r4 asm("r4");
> > + register unsigned long r5 asm("r5");
> > + register unsigned long r6 asm("r6");
> > + uint64_t val;
> > +
> > + reset_mmcr0();
> > + mtspr(SPR_PMC5, 0);
> > + mtspr(SPR_MMCR0, mfspr(SPR_MMCR0) & ~(MMCR0_FC | MMCR0_FC56));
> > + asm volatile(".rep 20 ; nop ; .endr" ::: "memory");
> > + mtspr(SPR_MMCR0, mfspr(SPR_MMCR0) | (MMCR0_FC | MMCR0_FC56));
> > + pmc5_1 = mfspr(SPR_PMC5);
> > +
> > + val = 0xdeadbeef;
> > + r4 = 0;
> > + r5 = 0xdeadbeef;
> > + r6 = 100;
> > + reset_mmcr0();
> > + mtspr(SPR_PMC5, 0);
> > + mtspr(SPR_MMCR0, mfspr(SPR_MMCR0) & ~(MMCR0_FC | MMCR0_FC56));
> > + asm volatile(".rep 10 ; nop ; .endr ; ldat %0,%3,0x10 ; .rep 10 ; nop ; .endr" : "=r"(r4), "+r"(r5), "+r"(r6) : "r"(&val) :"memory");
>
> Looks like older versions of Clang do not like this instruction:
>
> /tmp/pmu-4fda98.s: Assembler messages:
> /tmp/pmu-4fda98.s:1685: Error: unrecognized opcode: `ldat'
> clang-13: error: assembler command failed with exit code 1 (use -v to see
> invocation)
>
> Could you please work-around that issue?
Ah, just catching up with this -- thanks for working it out.
I will fix.
>
> Also, please break the very long line here. Thanks!
Sure.
Thanks,
Nick
>
> > + mtspr(SPR_MMCR0, mfspr(SPR_MMCR0) | (MMCR0_FC | MMCR0_FC56));
> > + pmc5_2 = mfspr(SPR_PMC5);
> > + assert(r4 == 0xdeadbeef);
> > + assert(val == 0xdeadbeef);
> > +
> > + /* TCG does not count instructions around syscalls correctly */
> > + report_kfail(host_is_tcg, pmc5_1 != pmc5_2 + 1,
> > + "PMC5 counts instructions with ldat");
> > +}
>
> Thomas
next prev parent reply other threads:[~2024-06-25 1:57 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-12 5:23 [kvm-unit-tests PATCH v10 00/15] powerpc improvements Nicholas Piggin
2024-06-12 5:23 ` [kvm-unit-tests PATCH v10 01/15] powerpc: Add facility to query TCG or KVM host Nicholas Piggin
2024-06-12 5:23 ` [kvm-unit-tests PATCH v10 02/15] powerpc: Add atomics tests Nicholas Piggin
2024-06-12 5:23 ` [kvm-unit-tests PATCH v10 03/15] powerpc: Add timebase tests Nicholas Piggin
2024-06-12 5:23 ` [kvm-unit-tests PATCH v10 04/15] powerpc: Add MMU support Nicholas Piggin
2024-06-12 5:23 ` [kvm-unit-tests PATCH v10 05/15] common/sieve: Support machines without MMU Nicholas Piggin
2024-06-12 5:23 ` [kvm-unit-tests PATCH v10 06/15] powerpc: Add sieve.c common test Nicholas Piggin
2024-06-12 5:23 ` [kvm-unit-tests PATCH v10 07/15] powerpc: add usermode support Nicholas Piggin
2024-06-12 5:23 ` [kvm-unit-tests PATCH v10 08/15] powerpc: add pmu tests Nicholas Piggin
2024-06-18 15:20 ` Thomas Huth
2024-06-18 18:39 ` Thomas Huth
2024-06-25 1:56 ` Nicholas Piggin [this message]
2024-06-12 5:23 ` [kvm-unit-tests PATCH v10 09/15] configure: Make arch_libdir a first-class entity Nicholas Piggin
2024-06-12 5:23 ` [kvm-unit-tests PATCH v10 10/15] powerpc: Remove remnants of ppc64 directory and build structure Nicholas Piggin
2024-06-19 7:36 ` Thomas Huth
2024-06-12 5:23 ` [kvm-unit-tests PATCH v10 11/15] powerpc: gitlab CI update Nicholas Piggin
2024-06-12 5:23 ` [kvm-unit-tests PATCH v10 12/15] scripts/arch-run.bash: Fix run_panic() success exit status Nicholas Piggin
2024-06-12 7:26 ` Andrew Jones
2024-06-14 0:56 ` Nicholas Piggin
2024-06-17 14:12 ` Andrew Jones
2024-06-17 14:13 ` Andrew Jones
2024-06-12 5:23 ` [kvm-unit-tests PATCH v10 13/15] powerpc: Add a panic test Nicholas Piggin
2024-06-19 7:42 ` Thomas Huth
2024-06-12 5:23 ` [kvm-unit-tests PATCH v10 14/15] powerpc/gitlab-ci: Upgrade powerpc to Fedora 40 Nicholas Piggin
2024-06-19 7:35 ` Thomas Huth
2024-06-12 5:23 ` [kvm-unit-tests PATCH v10 15/15] powerpc/gitlab-ci: Enable more tests with " Nicholas Piggin
2024-06-19 7:44 ` Thomas Huth
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=D28Q3J98V4EC.1RXWN7UR4A3J7@gmail.com \
--to=npiggin@gmail.com \
--cc=andrew.jones@linux.dev \
--cc=kvm@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lvivier@redhat.com \
--cc=thuth@redhat.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;
as well as URLs for NNTP newsgroup(s).