From: Chinmay Rath <rathc@linux.ibm.com>
To: Thomas Huth <thuth@redhat.com>
Cc: npiggin@gmail.com, harshpb@linux.ibm.com, lvivier@redhat.com,
linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org,
andrew.jones@linux.dev, sbhat@linux.ibm.com
Subject: Re: [kvm-unit-tests RFC PATCH 1/6] powerpc: add pmu tests
Date: Fri, 12 Jun 2026 17:57:48 +0530 [thread overview]
Message-ID: <ac8931ff-5264-45cc-9842-bd240439cefa@linux.ibm.com> (raw)
In-Reply-To: <ab4d83d8-1ffa-4738-b4b5-12d9a4f2d9c0@redhat.com>
On 6/10/26 17:03, Thomas Huth wrote:
> On 10/06/2026 11.27, Chinmay Rath wrote:
>>
>> On 6/8/26 19:27, Thomas Huth wrote:
>>> On 08/06/2026 14.45, Thomas Huth wrote:
>>>> On 02/06/2026 08.48, Chinmay Rath wrote:
>>>>> From: Nicholas Piggin <npiggin@gmail.com>
>>>>>
>>>>> Add some initial PMU testing.
>>>>>
>>>>> - PMC5/6 tests
>>>>> - PMAE / PMI test
>>>>> - BHRB basic tests
>>>>>
>>>>> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
>>>>> Signed-off-by: Chinmay Rath <rathc@linux.ibm.com>
>>>>> ---
>>>>> lib/powerpc/asm/processor.h | 2 +
>>>>> lib/powerpc/asm/reg.h | 9 +
>>>>> lib/powerpc/asm/setup.h | 1 +
>>>>> lib/powerpc/setup.c | 20 ++
>>>>> powerpc/Makefile.common | 3 +-
>>>>> powerpc/pmu.c | 567
>>>>> ++++++++++++++++++++++++++++++++++++
>>>>> powerpc/unittests.cfg | 3 +
>>>>> 7 files changed, 604 insertions(+), 1 deletion(-)
>>>>> create mode 100644 powerpc/pmu.c
>>>>
>>>> Hi Chinmay,
>>>>
>>>> the problem with Clang on Travis [*] still seems to persist:
>>>>
>>>> https://app.travis-ci.com/github/huth/kvm-unit-tests/jobs/639614142
>>>>
>>>> Could you please have a look?
>>>>
>>>> Thanks,
>>>> Thomas
>>>>
>>>>
>>>> [*] This already happened with Nicolas' last version:
>>>>
>>>> https://www.spinics.net/lists/kvm/msg351218.html
>>>
>>> I managed to get access to a ppc64 machine. The error is:
>>>
>>> /tmp/pmu-eab466.s: Assembler messages:
>>> /tmp/pmu-eab466.s:1649: Error: unrecognized opcode: `ldat'
>>> clang: error: assembler command failed with exit code 1 (use -v to
>>> see invocation)
>>> make: *** [<builtin>: powerpc/pmu.o] Error 1
>>>
>>> HTH,
>>> Thomas
>> Hi Thomas,
>>
>> Thanks for looking into this and providing the exact error message.
>>
>> I was looking into this Travis CI job that you pointed to and noticed
>> that the clang version being used was 14.
>> I was wondering, would it be possible to use a newer version of clang
>> for the job since LDAT is a legit PPC insn,
>> that was introduced with Power 9, ISA version 3.0, way back a decade
>> in 2016 !
>> So I was wondering if using a newer version of clang that recognizes
>> the instruction would be a better approach.
>
> I can reproduce the very same issue on a ppc64le box with Clang 22:
>
> # clang --version
> clang version 22.1.6 (Fedora 22.1.6-1.fc44)
> Target: ppc64le-redhat-linux-gnu
> Thread model: posix
> InstalledDir: /usr/bin
> Configuration file: /etc/clang/ppc64le-redhat-linux-gnu-clang.cfg
> # make
> clang -no-integrated-as -std=gnu99 -ffreestanding -O2 -msoft-float
> -mno-altivec -I /root/kvm-unit-tests/lib -I
> /root/kvm-unit-tests/lib/libfdt -I lib -Wa,-mregnames -g -MMD -MP -MF
> powerpc/.pmu.d -fno-strict-aliasing -fno-common -Wall -Wwrite-strings
> -Wempty-body -Wuninitialized -Wignored-qualifiers -Wno-missing-braces
> -Werror -fomit-frame-pointer -fno-stack-protector
> -Wno-frame-address -fno-pic -Wunused-but-set-parameter
> -Wno-override-init -Wmissing-prototypes -Wstrict-prototypes
> -mlittle-endian -c -o powerpc/pmu.o powerpc/pmu.c
> /tmp/pmu-f0c247.s: Assembler messages:
> /tmp/pmu-f0c247.s:1656: Error: unrecognized opcode: `ldat'
> clang: error: assembler command failed with exit code 1 (use -v to see
> invocation)
> make: *** [<builtin>: powerpc/pmu.o] Error 1
>
> Does compiling with Clang work for you? If so, which version?
>
> Thomas
>
>
Thanks for sharing this observation Thomas. I did some digging on a
ppc64 machine and found the following :
The problem isn't with clang. Clang is able to perfectly identify LDAT
insn. This can be verified by writing a small C program using LDAT
within a similar asm volatile block and compiling with Clang. Sails smooth.
The problem is, the GNU assembler does not identify LDAT, unless
"-mpower10" flag is passed to it. Can be verified by writing a small .S
program making use of LDAT and passing to 'as', the GNU assembler binary.
In your Travis CI log, as I can check, the following config is used :
$ export CONFIG="--arch=ppc64 --endian=little --cc=clang
--cflags=-no-integrated-as"
"no-integrated-as" defers the assembling job to GNU assembler, and since
no "-mpower10" flag is passed, the compilation fails.
Using the following flag in the config instead, passes -mpower10 to GNU
assembler and gets the compilation job done :
--cflags="-no-integrated-as -Wa,-mpower10"
Thanks,
Chinmay
PS: I will be away traveling for a while, will get back to this as soon
as I am back. Thanks for understanding :)
next prev parent reply other threads:[~2026-06-12 12:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 6:48 [kvm-unit-tests RFC PATCH 0/6] powerpc improvements Chinmay Rath
2026-06-02 6:48 ` [kvm-unit-tests RFC PATCH 1/6] powerpc: add pmu tests Chinmay Rath
2026-06-08 12:45 ` Thomas Huth
2026-06-08 13:57 ` Thomas Huth
2026-06-10 9:27 ` Chinmay Rath
2026-06-10 11:33 ` Thomas Huth
2026-06-12 12:27 ` Chinmay Rath [this message]
2026-06-02 6:48 ` [kvm-unit-tests RFC PATCH 2/6] configure: Make arch_libdir a first-class entity Chinmay Rath
2026-06-02 15:54 ` Andrew Jones
2026-06-05 8:34 ` Chinmay Rath
2026-06-10 11:30 ` Thomas Huth
2026-06-02 6:48 ` [kvm-unit-tests RFC PATCH 3/6] powerpc: Remove remnants of ppc64 directory and build structure Chinmay Rath
2026-06-02 6:48 ` [kvm-unit-tests RFC PATCH 4/6] powerpc: gitlab CI update Chinmay Rath
2026-06-08 12:48 ` Thomas Huth
2026-06-10 9:36 ` Chinmay Rath
2026-06-02 6:48 ` [kvm-unit-tests RFC PATCH 5/6] scripts/arch-run.bash: Fix run_panic() success exit status Chinmay Rath
2026-06-02 6:48 ` [kvm-unit-tests RFC PATCH 6/6] powerpc: Add a panic test Chinmay Rath
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=ac8931ff-5264-45cc-9842-bd240439cefa@linux.ibm.com \
--to=rathc@linux.ibm.com \
--cc=andrew.jones@linux.dev \
--cc=harshpb@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lvivier@redhat.com \
--cc=npiggin@gmail.com \
--cc=sbhat@linux.ibm.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