From: Claudio Fontana <cfontana@suse.de>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: "Paul Durrant" <paul@xen.org>, "Jason Wang" <jasowang@redhat.com>,
qemu-devel@nongnu.org, "Peter Xu" <peterx@redhat.com>,
haxm-team@intel.com, "Colin Xu" <colin.xu@intel.com>,
"Olaf Hering" <ohering@suse.de>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Bruce Rogers" <brogers@suse.com>,
"Emilio G . Cota" <cota@braap.org>,
"Anthony Perard" <anthony.perard@citrix.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Cameron Esfahani" <dirty@apple.com>,
"Dario Faggioli" <dfaggioli@suse.com>,
"Roman Bolshakov" <r.bolshakov@yadro.com>,
"Sunil Muthuswamy" <sunilmut@microsoft.com>,
"Marcelo Tosatti" <mtosatti@redhat.com>,
"Wenchao Wang" <wenchao.wang@intel.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [RFC v5 12/12] accel: centralize initialization of CpusAccelOps
Date: Wed, 25 Nov 2020 10:32:01 +0100 [thread overview]
Message-ID: <60e9ff3e-8896-c9a1-302c-c1378a48a564@suse.de> (raw)
In-Reply-To: <20201124203452.GZ2271382@habkost.net>
On 11/24/20 9:34 PM, Eduardo Habkost wrote:
> On Tue, Nov 24, 2020 at 08:39:33PM +0100, Claudio Fontana wrote:
>> On 11/24/20 8:27 PM, Eduardo Habkost wrote:
>>> On Tue, Nov 24, 2020 at 07:52:15PM +0100, Claudio Fontana wrote:
>>> [...]
>>>>>> + }
>>>>>
>>>>> Additionally, if you call arch_cpu_accel_init() here, you won't
>>>>> need MODULE_INIT_ACCEL_CPU anymore. The
>>>>>
>>>>> module_call_init(MODULE_INIT_ACCEL_CPU)
>>>>>
>>>>> call with implicit dependencies on runtime state inside vl.c and
>>>>> *-user/main.c becomes a trivial:
>>>>>
>>>>> accel_init(accel)
>>>>>
>>>>> call in accel_init_machine() and *-user:main().
>>>>
>>>>
>>>>
>>>> I do need a separate thing for the arch cpu accel specialization though,
>>>> without MODULE_INIT_ACCEL_CPU that link between all operations done at accel-chosen time is missing..
>>>>
>>>
>>> I think this is a key point we need to sort out.
>>>
>>> What do you mean by "link between all operations done at
>>> accel-chosen time" and why that's important?
>>
>>
>> For understanding by a reader that tries to figure this out,
>> (see the gid MODULE_INIT_ACCEL_CPU comment elsewhere in the thread).
>
> Right, but how does the module_call_init(MODULE_INIT_ACCEL_CPU)
> indirection makes this easier to figure out than just looking at
> a accel_init() function that makes regular function calls?
I agree, if we accomplish a single accel_init() call that does everything (accelerator initialization and arch independent ops initialization and arch dependent specialization of the x86 cpu),
that would be the best outcome in my view also.
>
>
>>
>> And it could be that the high level plan to make accelerators fully dynamically loadable plugins in the future
>> also conditioned me to want to have a very clear demarcation line around the choice of the accelerator.
>
> We have dynamically loadable modules for other QOM types,
> already, and they just use type_init(). I don't see why an extra
> module_init() type makes this easier.
>
>>
>>
>>>
>>> accel_init_machine() has 2-3 lines of code with side effects. It
>>> calls AccelClass.init_machine(), which may may have hundreds of
>>
>>
>> could we initialize also all arch-dependent stuff in here?
>
> You can, if you use a wrapper + stub, like arch_cpu_accel_init().
>
As mentioned elsewhere, I'll try to avoid stubs. One is too many I think in the codebase (well one is probably ok, but you get what I mean, I don't like their proliferation).
>
>>
>>
>>> lines of code. accel_setup_post() has one additional method
>>> call, which is triggered at a slightly different moment.
>>>
>>> You are using MODULE_INIT_ACCEL for 2 additional lines of code:
>>> - the cpus_register_accel() call
>>> - the x86_cpu_accel_init() call
>>>
>>> What makes those 2 lines of code so special, to make them deserve
>>> a completely new mechanism to trigger them, instead of using
>>> trivial function calls inside a accel_init() function?
>>>
>>
>> ...can we do also the x86_cpu_accel_init inside accel_init()?
>>
>>
>> In any case I'll try also the alternative, it would be nice if I could bring everything together under the same roof,
>> and easily discoverable, both the arch-specific steps that we need to do at accel-chosen time and the non-arch-specific steps.
>
> One way to bring everything together under the same roof is to
> call everything inside a accel_init() function.
Will try!
>
>
>>
>> Hope this helps clarifying where I am coming from,
>> but I am open to have my mind changed, also trying the alternatives you propose here could help me see first hand how things play out.
>
> Thanks!
>
Thanks,
Ciao,
Claudio
next prev parent reply other threads:[~2020-11-25 9:36 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-24 16:21 [RFC v5 00/12] i386 cleanup Claudio Fontana
2020-11-24 16:21 ` [RFC v5 01/12] i386: move kvm accel files into kvm/ Claudio Fontana
2020-11-24 16:22 ` [RFC v5 02/12] i386: move whpx accel files into whpx/ Claudio Fontana
2020-11-24 16:22 ` [RFC v5 03/12] i386: move hax accel files into hax/ Claudio Fontana
2020-11-24 16:22 ` [RFC v5 04/12] i386: hvf: remove stale MAINTAINERS entry for old hvf stubs Claudio Fontana
2020-11-24 16:22 ` [RFC v5 05/12] i386: move TCG accel files into tcg/ Claudio Fontana
2020-11-24 16:22 ` [RFC v5 06/12] i386: move cpu dump out of helper.c into cpu-dump.c Claudio Fontana
2020-11-24 16:22 ` [RFC v5 07/12] i386: move TCG cpu class initialization out of helper.c Claudio Fontana
2020-11-24 16:22 ` [RFC v5 08/12] accel: extend AccelState and AccelClass to user-mode Claudio Fontana
2020-11-24 17:56 ` Eduardo Habkost
2020-11-24 18:16 ` Claudio Fontana
2020-11-24 16:22 ` [RFC v5 09/12] module: introduce MODULE_INIT_ACCEL_CPU Claudio Fontana
2020-11-24 17:08 ` Eduardo Habkost
2020-11-24 18:29 ` Claudio Fontana
2020-11-24 19:08 ` Eduardo Habkost
2020-11-24 20:01 ` Paolo Bonzini
2020-11-25 9:21 ` Claudio Fontana
2020-11-25 9:30 ` Paolo Bonzini
2020-11-25 10:42 ` Claudio Fontana
2020-11-26 12:45 ` Claudio Fontana
2020-11-26 11:25 ` Philippe Mathieu-Daudé
2020-11-26 12:03 ` Claudio Fontana
2020-11-24 16:22 ` [RFC v5 10/12] i386: split cpu accelerators from cpu.c Claudio Fontana
2020-11-24 16:22 ` [RFC v5 11/12] i386: centralize initialization of cpu accel interfaces Claudio Fontana
2020-11-24 16:59 ` Eduardo Habkost
2020-11-24 18:38 ` Claudio Fontana
2020-11-24 20:13 ` Paolo Bonzini
2020-11-24 21:31 ` Eduardo Habkost
2020-11-25 9:26 ` Claudio Fontana
2020-11-26 10:57 ` Claudio Fontana
2020-11-26 13:44 ` Eduardo Habkost
2020-11-26 14:33 ` Claudio Fontana
2020-11-26 14:49 ` Eduardo Habkost
2020-11-26 14:55 ` Claudio Fontana
2020-11-26 15:14 ` Eduardo Habkost
2020-11-26 15:34 ` Claudio Fontana
2020-11-26 15:48 ` Eduardo Habkost
2020-11-26 15:49 ` Claudio Fontana
2020-11-26 15:14 ` Paolo Bonzini
2020-11-25 9:24 ` Claudio Fontana
2020-11-26 14:42 ` Claudio Fontana
2020-11-24 16:22 ` [RFC v5 12/12] accel: centralize initialization of CpusAccelOps Claudio Fontana
2020-11-24 17:48 ` Eduardo Habkost
2020-11-24 18:52 ` Claudio Fontana
2020-11-24 19:27 ` Eduardo Habkost
2020-11-24 19:39 ` Claudio Fontana
2020-11-24 20:34 ` Eduardo Habkost
2020-11-25 9:32 ` Claudio Fontana [this message]
2020-11-25 11:48 ` Claudio Fontana
2020-11-25 14:51 ` Eduardo Habkost
2020-11-24 20:14 ` [RFC v5 00/12] i386 cleanup Paolo Bonzini
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=60e9ff3e-8896-c9a1-302c-c1378a48a564@suse.de \
--to=cfontana@suse.de \
--cc=anthony.perard@citrix.com \
--cc=brogers@suse.com \
--cc=colin.xu@intel.com \
--cc=cota@braap.org \
--cc=dfaggioli@suse.com \
--cc=dirty@apple.com \
--cc=ehabkost@redhat.com \
--cc=haxm-team@intel.com \
--cc=jasowang@redhat.com \
--cc=lvivier@redhat.com \
--cc=mtosatti@redhat.com \
--cc=ohering@suse.de \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=r.bolshakov@yadro.com \
--cc=richard.henderson@linaro.org \
--cc=sstabellini@kernel.org \
--cc=sunilmut@microsoft.com \
--cc=thuth@redhat.com \
--cc=wenchao.wang@intel.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).