From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
To: "Maciej S. Szmigiero" <mail@maciej.szmigiero.name>
Cc: kvm@vger.kernel.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Richard Henderson" <richard.henderson@linaro.org>,
qemu-devel@nongnu.org, manos.pitsidianakis@linaro.org,
"Marcelo Tosatti" <mtosatti@redhat.com>,
alex.bennee@linaro.org
Subject: Re: [PATCH 5/7] hw/hyperv/syndbg: common compilation unit
Date: Fri, 7 Mar 2025 09:28:40 -0800 [thread overview]
Message-ID: <ab1a90fb-e068-4ddc-865e-07bdeb2789e3@linaro.org> (raw)
In-Reply-To: <95a6f718-8fab-434c-9b02-6812f7afbcc3@maciej.szmigiero.name>
On 3/7/25 03:07, Maciej S. Szmigiero wrote:
> On 6.03.2025 23:56, Pierrick Bouvier wrote:
>> On 3/6/25 09:58, Philippe Mathieu-Daudé wrote:
>>> On 6/3/25 17:23, Pierrick Bouvier wrote:
>>>> On 3/6/25 08:19, Richard Henderson wrote:
>>>>> On 3/5/25 22:41, Pierrick Bouvier wrote:
>>>>>> Replace TARGET_PAGE.* by runtime calls
>>>>>>
>>>>>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>>>>>> ---
>>>>>> hw/hyperv/syndbg.c | 7 ++++---
>>>>>> hw/hyperv/meson.build | 2 +-
>>>>>> 2 files changed, 5 insertions(+), 4 deletions(-)
>>>>>>
>>>>>> diff --git a/hw/hyperv/syndbg.c b/hw/hyperv/syndbg.c
>>>>>> index d3e39170772..f9382202ed3 100644
>>>>>> --- a/hw/hyperv/syndbg.c
>>>>>> +++ b/hw/hyperv/syndbg.c
>>>>>> @@ -14,7 +14,7 @@
>>>>>> #include "migration/vmstate.h"
>>>>>> #include "hw/qdev-properties.h"
>>>>>> #include "hw/loader.h"
>>>>>> -#include "cpu.h"
>>>>>> +#include "exec/target_page.h"
>>>>>> #include "hw/hyperv/hyperv.h"
>>>>>> #include "hw/hyperv/vmbus-bridge.h"
>>>>>> #include "hw/hyperv/hyperv-proto.h"
>>>>>> @@ -188,7 +188,8 @@ static uint16_t handle_recv_msg(HvSynDbg *syndbg,
>>>>>> uint64_t outgpa,
>>>>>> uint64_t timeout, uint32_t
>>>>>> *retrieved_count)
>>>>>> {
>>>>>> uint16_t ret;
>>>>>> - uint8_t data_buf[TARGET_PAGE_SIZE - UDP_PKT_HEADER_SIZE];
>>>>>> + const size_t buf_size = qemu_target_page_size() -
>>>>>> UDP_PKT_HEADER_SIZE;
>>>>>> + uint8_t *data_buf = g_alloca(buf_size);
>>>>>> hwaddr out_len;
>>>>>> void *out_data;
>>>>>> ssize_t recv_byte_count;
>>>>>
>>>>> We've purged the code base of VLAs, and those are preferable to alloca.
>>>>> Just use g_malloc and g_autofree.
>>>>>
>>>>
>>>> I hesitated, due to potential performance considerations for people
>>>> reviewing the patch. I'll switch to heap based storage.
>>>
>>> OTOH hyperv is x86-only, so we could do:
>>>
>>> #define BUFSZ (4 * KiB)
>>>
>>> handle_recv_msg()
>>> {
>>> uint8_t data_buf[BUFSZ - UDP_PKT_HEADER_SIZE];
>>> ...
>>>
>>> hv_syndbg_class_init()
>>> {
>>> assert(BUFSZ > qemu_target_page_size());
>>> ...
>>>
>>> and call it a day.
>>
>> Could be possible for now yes.
>>
>> Any opinion from concerned maintainers?
>
> I think essentially hardcoding 4k pages in hyperv is okay
> (with an appropriate checking/enforcement asserts() of course),
> since even if this gets ported to ARM64 at some point
> it is going to need *a lot* of changes anyway.
>
Ok, I will hardcode this following Philippe suggestion then.
> Thanks,
> Maciej
>
next prev parent reply other threads:[~2025-03-07 17:28 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-06 6:41 [PATCH 0/7] hw/hyperv: remove duplication compilation units Pierrick Bouvier
2025-03-06 6:41 ` [PATCH 1/7] hw/hyperv/hv-balloon-stub: common compilation unit Pierrick Bouvier
2025-03-06 6:41 ` [PATCH 2/7] hw/hyperv/hyperv.h: header cleanup Pierrick Bouvier
2025-03-06 12:27 ` Alex Bennée
2025-03-06 22:40 ` Pierrick Bouvier
2025-03-06 6:41 ` [PATCH 3/7] hw/hyperv/vmbus: common compilation unit Pierrick Bouvier
2025-03-06 20:29 ` Maciej S. Szmigiero
2025-03-06 22:59 ` Pierrick Bouvier
2025-03-07 11:03 ` Maciej S. Szmigiero
2025-03-07 17:27 ` Pierrick Bouvier
2025-03-06 6:41 ` [PATCH 4/7] hw/hyperv/hyperv-proto: move SYNDBG definition from target/i386 Pierrick Bouvier
2025-03-06 10:42 ` Philippe Mathieu-Daudé
2025-03-06 6:41 ` [PATCH 5/7] hw/hyperv/syndbg: common compilation unit Pierrick Bouvier
2025-03-06 16:19 ` Richard Henderson
2025-03-06 16:23 ` Pierrick Bouvier
2025-03-06 17:58 ` Philippe Mathieu-Daudé
2025-03-06 22:56 ` Pierrick Bouvier
2025-03-07 11:07 ` Maciej S. Szmigiero
2025-03-07 14:50 ` Alex Bennée
2025-03-07 17:34 ` Maciej S. Szmigiero
2025-03-07 17:28 ` Pierrick Bouvier [this message]
2025-03-06 6:41 ` [PATCH 6/7] hw/hyperv/balloon: common balloon compilation units Pierrick Bouvier
2025-03-06 6:41 ` [PATCH 7/7] hw/hyperv/hyperv_testdev: common compilation unit Pierrick Bouvier
2025-03-06 16:26 ` [PATCH 0/7] hw/hyperv: remove duplication compilation units Richard Henderson
2025-03-06 16:35 ` Pierrick Bouvier
2025-03-06 16:35 ` Pierrick Bouvier
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=ab1a90fb-e068-4ddc-865e-07bdeb2789e3@linaro.org \
--to=pierrick.bouvier@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=kvm@vger.kernel.org \
--cc=mail@maciej.szmigiero.name \
--cc=manos.pitsidianakis@linaro.org \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/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).