From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Richard Henderson <richard.henderson@linaro.org>,
qemu-devel@nongnu.org, qemu-arm@nongnu.org,
Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>,
Fam Zheng <fam@euphon.net>, Stefan Hajnoczi <stefanha@redhat.com>,
qemu-block@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH v2 2/5] target/arm: Ensure icount is enabled when emulating INST_RETIRED
Date: Fri, 8 Dec 2023 12:23:41 +0100 [thread overview]
Message-ID: <793e3c8f-497f-468e-b6b5-accc79e2bef0@linaro.org> (raw)
In-Reply-To: <CAFEAcA-HVf8vWLzmdStEo2NrSKQdZV612rBjiaj-gLW4vXyvpA@mail.gmail.com>
Hi Peter,
On 8/12/23 11:59, Peter Maydell wrote:
> On Fri, 8 Dec 2023 at 10:36, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>>
>> On 7/12/23 23:12, Richard Henderson wrote:
>>> On 12/7/23 07:45, Philippe Mathieu-Daudé wrote:
>>>> pmu_init() register its event checking the pm_event::supported()
>>>> handler. For INST_RETIRED, the event is only registered and the
>>>> bit enabled in the PMU Common Event Identification register when
>>>> icount is enabled as ICOUNT_PRECISE.
>>>>
>>>> Assert the pm_event::get_count() and pm_event::ns_per_count()
>>>> handler will only be called under this icount mode.
>>>>
>>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>>> ---
>>>> target/arm/helper.c | 2 ++
>>>> 1 file changed, 2 insertions(+)
>>>>
>>>> diff --git a/target/arm/helper.c b/target/arm/helper.c
>>>> index adb0960bba..333fd5f4bf 100644
>>>> --- a/target/arm/helper.c
>>>> +++ b/target/arm/helper.c
>>>> @@ -940,11 +940,13 @@ static bool instructions_supported(CPUARMState
>>>> *env)
>>>> static uint64_t instructions_get_count(CPUARMState *env)
>>>> {
>>>> + assert(icount_enabled() == ICOUNT_PRECISE);
>>>> return (uint64_t)icount_get_raw();
>>>> }
>>>> static int64_t instructions_ns_per(uint64_t icount)
>>>> {
>>>> + assert(icount_enabled() == ICOUNT_PRECISE);
>>>> return icount_to_ns((int64_t)icount);
>>>> }
>>>> #endif
>>>
>>> I don't think an assert is required -- that's exactly what the
>>> .supported field is for. If you think this needs additional
>>> clarification, a comment is sufficient.
>>
>> Without this I'm getting this link failure with TCG disabled:
>>
>> ld: Undefined symbols:
>> _icount_to_ns, referenced from:
>> _instructions_ns_per in target_arm_helper.c.o
>> clang: error: linker command failed with exit code 1 (use -v to see
>> invocation)
>
> I think we should fix this earlier by not trying to enable
> these TCG-only PMU event types in a non-TCG config.
I agree... but (as discussed yesterday on IRC), this is a bigger rework.
This icount cleanup blocks 60+ patches on top :/ Since I have a v3
addressing Richard's comments already done, I'll post it, mentioning the
PMU issue in the cover; then see if cleaning it isn't too invasive.
If I end in another rabbit hole, I'll suggest to accept this current
patch and clean the technical debt later, again.
Thanks,
Phil.
next prev parent reply other threads:[~2023-12-08 11:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-07 15:45 [PATCH v2 0/5] sysemu/replay: Restrict icount to TCG system emulation Philippe Mathieu-Daudé
2023-12-07 15:45 ` [PATCH v2 1/5] sysemu/cpu-timers: Introduce ICountMode enumerator Philippe Mathieu-Daudé
2023-12-07 22:06 ` Richard Henderson
2023-12-07 15:45 ` [PATCH v2 2/5] target/arm: Ensure icount is enabled when emulating INST_RETIRED Philippe Mathieu-Daudé
2023-12-07 22:12 ` Richard Henderson
2023-12-08 10:36 ` Philippe Mathieu-Daudé
2023-12-08 10:59 ` Peter Maydell
2023-12-08 11:23 ` Philippe Mathieu-Daudé [this message]
2023-12-08 14:00 ` Philippe Mathieu-Daudé
2023-12-07 15:45 ` [PATCH v2 3/5] util/async: Only call icount_notify_exit() if icount is enabled Philippe Mathieu-Daudé
2023-12-07 22:17 ` Richard Henderson
2023-12-07 15:45 ` [PATCH v2 4/5] system/vl: Restrict icount to TCG emulation Philippe Mathieu-Daudé
2023-12-07 22:38 ` Richard Henderson
2023-12-08 11:17 ` Philippe Mathieu-Daudé
2023-12-07 15:45 ` [PATCH v2 5/5] sysemu/replay: Restrict icount to system emulation Philippe Mathieu-Daudé
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=793e3c8f-497f-468e-b6b5-accc79e2bef0@linaro.org \
--to=philmd@linaro.org \
--cc=fam@euphon.net \
--cc=pavel.dovgaluk@ispras.ru \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=stefanha@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).