qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Claudio Fontana <cfontana@suse.de>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Alessandro Di Federico" <ale@rev.ng>,
	qemu-devel@nongnu.org
Cc: Richard Henderson <richard.henderson@linaro.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Eduardo Habkost <eduardo@habkost.net>,
	Fabiano Rosas <fabiano.rosas@suse.com>,
	Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [PATCH 03/10] accel/tcg: move i386 halt handling to sysemu_ops
Date: Tue, 21 Mar 2023 09:47:32 +0100	[thread overview]
Message-ID: <a886906c-2933-c072-1202-597f53c36660@suse.de> (raw)
In-Reply-To: <15e31292-9365-7eb4-6bcd-d74c1a50c5a0@linaro.org>

On 3/20/23 16:34, Philippe Mathieu-Daudé wrote:
> On 20/3/23 16:23, Claudio Fontana wrote:
>> Hi Alex, all,
>>
>> again, this moves TCG-only code to common code, no?
> 
> Oh, good point.
> 
>> Even if this happens to work, the idea is to avoid adding unneeded accel TCG code to a KVM-only binary.
> 
> Could yet another AccelSysemuCPUOps *accel struct in SysemuCPUOps
> help being stricter? ...

Just a thought, in general I wonder if we could devise a less error prone way to keep things in the right place.
Just thinking out loud here, something like a QEMU_ATTRIBUTE_TCG, _KVM, ... to add to symbols to avoid ending up in the wrong binary.

Keeping in mind all these dimensions is probably very taxing, maybe getting some support from the build system would be beneficial,
checking that a build requested with specific features contains only compatible objects.

Any ideas?

Ciao,

C

> 
>> We need to keep in mind all dimensions when we do refactorings:
>>
>> user-mode vs sysemu,
>> the architecture,
>> the accel, in particular tcg, non-tcg (which could be not compiled in, built-in, or loaded as separate module).
>>
>> In many cases, testing with --disable-tcg --enable-kvm helps to avoid breakages,
>> but it is possible also to move in unneeded code in a way that does not generate compile or link-time errors, so we need to be a bit alert to that.
>>
>> Ciao,
>>
>> C
>>
>>
>> On 3/20/23 11:10, Alex Bennée wrote:
>>> We don't want to be polluting the core run loop code with target
>>> specific handling, punt it to sysemu_ops where it belongs.
>>>
>>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>>> ---
>>>   include/hw/core/sysemu-cpu-ops.h |  5 +++++
>>>   target/i386/cpu-internal.h       |  1 +
>>>   accel/tcg/cpu-exec.c             | 14 +++-----------
>>>   target/i386/cpu-sysemu.c         | 12 ++++++++++++
>>>   target/i386/cpu.c                |  1 +
>>>   5 files changed, 22 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h
>>> index ee169b872c..c9d30172c4 100644
>>> --- a/include/hw/core/sysemu-cpu-ops.h
>>> +++ b/include/hw/core/sysemu-cpu-ops.h
>>> @@ -48,6 +48,11 @@ typedef struct SysemuCPUOps {
>>>        * GUEST_PANICKED events.
>>>        */
>>>       GuestPanicInformation* (*get_crash_info)(CPUState *cpu);
>>> +    /**
>>> +     * @handle_cpu_halt: Callback for special handling during cpu_handle_halt()
>>> +     * @cs: The CPUState
>>> +     */
> 
> Perhaps insert within a 'tcg' structure for now.
> 
>      #ifdef CONFIG_TCG
>      struct {
> 
>>> +    void (*handle_cpu_halt)(CPUState *cpu);
> 
>      } tcg;
>      #endif
> 
> Then we could extract as accel.
> 
>>>       /**
>>>        * @write_elf32_note: Callback for writing a CPU-specific ELF note to a
>>>        * 32-bit VM coredump.
> 
> 



  reply	other threads:[~2023-03-21  8:47 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20 10:10 [PATCH 00/10] accel/tcg: refactor the cpu-exec loop Alex Bennée
2023-03-20 10:10 ` [PATCH 01/10] metadata: add .git-blame-ignore-revs Alex Bennée
2023-03-21 14:17   ` Philippe Mathieu-Daudé
2023-03-20 10:10 ` [PATCH 02/10] accel/tcg: move cpu_reloading_memory_map into cpu-exec-softmmu Alex Bennée
2023-03-20 12:56   ` Claudio Fontana
2023-03-20 13:32     ` Alex Bennée
2023-03-20 14:01       ` Claudio Fontana
2023-03-20 14:33         ` Alex Bennée
2023-03-20 16:14           ` Richard Henderson
2023-03-21 16:07   ` Alessandro Di Federico via
2023-03-20 10:10 ` [PATCH 03/10] accel/tcg: move i386 halt handling to sysemu_ops Alex Bennée
2023-03-20 14:52   ` Philippe Mathieu-Daudé
2023-03-20 17:18     ` Alex Bennée
2023-03-20 15:23   ` Claudio Fontana
2023-03-20 15:34     ` Philippe Mathieu-Daudé
2023-03-21  8:47       ` Claudio Fontana [this message]
2023-03-20 17:20     ` Alex Bennée
2023-03-20 10:10 ` [PATCH 04/10] accel/tcg: don't bother with ifdef for CPU_DUMP_CCOP Alex Bennée
2023-03-20 16:16   ` Richard Henderson
2023-03-20 16:17   ` Richard Henderson
2023-03-20 10:10 ` [PATCH 05/10] accel/tcg: remove the fake_user_interrupt guards Alex Bennée
2023-03-20 16:18   ` Richard Henderson
2023-03-20 10:10 ` [PATCH 06/10] includes: move irq definitions out of cpu-all.h Alex Bennée
2023-03-20 16:20   ` Richard Henderson
2023-03-21 16:06   ` Alessandro Di Federico via
2023-03-22  5:25     ` Richard Henderson
2023-03-22 21:15       ` Alessandro Di Federico
2023-03-20 10:10 ` [PATCH 07/10] accel/tcg: use QEMU_IOTHREAD_LOCK_GUARD to cover the exit Alex Bennée
2023-03-20 14:55   ` Philippe Mathieu-Daudé
2023-03-20 16:21   ` Richard Henderson
2023-03-20 10:10 ` [PATCH 08/10] accel/tcg: push i386 specific hacks into handle_cpu_interrupt callback Alex Bennée
2023-03-20 16:27   ` Richard Henderson
2023-03-20 17:14     ` Alex Bennée
2023-03-21  6:04       ` Richard Henderson
2023-03-20 10:10 ` [PATCH 09/10] accel/tcg: re-inline the filtering of virtual IRQs but data driven Alex Bennée
2023-03-20 14:58   ` Philippe Mathieu-Daudé
2023-03-20 16:30   ` Richard Henderson
2023-03-20 10:10 ` [PATCH 10/10] accel/tcg: remove unused includes Alex Bennée
2023-03-20 16:30   ` Richard Henderson
2023-03-21 16:07   ` Alessandro Di Federico via

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=a886906c-2933-c072-1202-597f53c36660@suse.de \
    --to=cfontana@suse.de \
    --cc=ale@rev.ng \
    --cc=alex.bennee@linaro.org \
    --cc=eduardo@habkost.net \
    --cc=fabiano.rosas@suse.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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).