All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PULL 04/11] target-i386: Rename cpu_x86_init() to cpu_x86_init_user()
Date: Fri, 27 Feb 2015 20:10:40 +0100	[thread overview]
Message-ID: <54F0C130.8040106@suse.de> (raw)
In-Reply-To: <20150227190115.GB15482@thinpad.lan.raisama.net>

Am 27.02.2015 um 20:01 schrieb Eduardo Habkost:
> On Fri, Feb 27, 2015 at 03:10:27PM +0100, Andreas Färber wrote:
>> Am 26.02.2015 um 16:59 schrieb Eduardo Habkost:
>>> On Wed, Feb 25, 2015 at 11:06:55PM +0100, Andreas Färber wrote:
>>>> Am 25.02.2015 um 20:58 schrieb Eduardo Habkost:
>>>>> The function is used only for CONFIG_USER, so make its purpose clear.
>>>>>
>>>>> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
>>>>> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
>>>>> ---
>>>>>  target-i386/cpu.c | 2 +-
>>>>>  target-i386/cpu.h | 4 ++--
>>>>>  2 files changed, 3 insertions(+), 3 deletions(-)
>>>>
>>>> Please don't. I happily got all architectures aligned that it's at least
>>>> cpu_something_init, and it only happens to be user-only for x86. It is
>>>> rather the legacy function that was used in both system and user.
>>>
>>> If that's a legacy function, what are the steps you plan to follow to
>>> eliminate it? I would be glad to help eliminating legacy code.
>>>
>>> Initialization of CPUs in *-user and *-softmmu is different in i386, so
>>> we are going to have different code for both. How do you think I should
>>> name the *-user-specific CPU init function in target-i386, then?
>>
>> I would prefer to leave its name as it is (unless we are renaming all,
>> which would probably be a waste of effort giving the next steps) and
>> simply not use it in PC code. If you want to enforce this, you could
>> #ifdef CONFIG_USER_ONLY it.
>>
>> For some targets - as can be seen in your uc32 patch - there is already
>> a cpu_generic_init() that calls into the CPUClass hooks of the given CPU
>> type. I would like to call that from linux-user directly (or from a
>> lightweight wrapper to be shared between linux-user and bsd-user, I
>> assume we're going need some target-specific #ifdefs) and drop
>> cpu_init() in its current form. In particular I want to somehow move the
>> realized=true part out of it, which means either inlining it into dozens
>> of machines or finishing the recursive realization work so that we only
>> need one central realized=true for /machine.
> 
> Moving realized=true outside cpu_generic_init() would make lots of sense
> for PC, as we already need to perform additional steps in the PC init
> code before realizing the CPU (and I expect the list of PC-specific CPU
> initialization steps to grow). And when we do this, cpu_x86_init()
> (used by CONFIG_USER) and cpu_x86_create() (used by PC) can become the
> same function.
> 
> But I don't see how to implement this without requiring changing machine
> code case-by-case, as existing machine code may expect realized=true to
> be set very early and break if you don't set it immediately after
> cpu_*_init(). In other words, even if we implement recursive
> realization, we may need to inline realize=true on all machines as an
> intermediate (and automated) step, and then change machines to just rely
> on recursive realization, one by one.

Yes, that's why it's not done yet, it takes a lot of review and testing.
It is not going to be a pure Coccinelle patch. :) Doing that for the
inlining is an idea I had not yet considered, thanks.

On my qom-cpu-x86 branch I have already moved realized=true for the PC,
in order to make a CPU core object its parent.

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG Nürnberg)

  reply	other threads:[~2015-02-27 19:10 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-25 19:58 [Qemu-devel] [PULL 00/11] X86 patches Eduardo Habkost
2015-02-25 19:58 ` [Qemu-devel] [PULL 01/11] target-i386: Simplify listflags() function Eduardo Habkost
2015-02-25 19:58 ` [Qemu-devel] [PULL 02/11] target-i386: Eliminate unnecessary get_cpuid_vendor() function Eduardo Habkost
2015-02-25 19:58 ` [Qemu-devel] [PULL 03/11] target-i386: Move topology.h to include/hw/i386 Eduardo Habkost
2015-02-25 19:58 ` [Qemu-devel] [PULL 04/11] target-i386: Rename cpu_x86_init() to cpu_x86_init_user() Eduardo Habkost
2015-02-25 22:06   ` Andreas Färber
2015-02-26 15:59     ` Eduardo Habkost
2015-02-27 14:10       ` Andreas Färber
2015-02-27 19:01         ` Eduardo Habkost
2015-02-27 19:10           ` Andreas Färber [this message]
2015-02-25 19:58 ` [Qemu-devel] [PULL 05/11] target-i386: Eliminate cpu_init() function Eduardo Habkost
2015-02-25 22:08   ` Andreas Färber
2015-02-26 16:03     ` Eduardo Habkost
2015-02-27 14:19       ` Andreas Färber
2015-02-25 19:58 ` [Qemu-devel] [PULL 06/11] target-i386: Simplify error handling on cpu_x86_init_user() Eduardo Habkost
2015-02-25 19:58 ` [Qemu-devel] [PULL 07/11] target-i386: Move CPUX86State.cpuid_apic_id to X86CPU.apic_id Eduardo Habkost
2015-02-25 19:58 ` [Qemu-devel] [PULL 08/11] linux-user: Check for cpu_init() errors Eduardo Habkost
2015-02-25 22:23   ` Andreas Färber
2015-02-25 23:27   ` Peter Maydell
2015-02-26 16:06     ` Eduardo Habkost
2015-02-26 22:44       ` Peter Maydell
2015-02-26 22:51         ` Eduardo Habkost
2015-02-26 23:00           ` Peter Maydell
2015-02-26 23:11             ` Eduardo Habkost
2015-02-26 23:23               ` Peter Maydell
2015-02-27 17:38                 ` Eduardo Habkost
2015-02-25 19:58 ` [Qemu-devel] [PULL 09/11] target-i386: Set APIC ID using cpu_index on CONFIG_USER Eduardo Habkost
2015-02-25 19:58 ` [Qemu-devel] [PULL 10/11] target-i386: Require APIC ID to be explicitly set before CPU realize Eduardo Habkost
2015-02-25 19:58 ` [Qemu-devel] [PULL 11/11] target-i386: Move APIC ID compatibility code to pc.c Eduardo Habkost
2015-03-02 15:19 ` [Qemu-devel] [PULL 00/11] X86 patches Peter Maydell
2015-03-02 15:26   ` Andreas Färber
2015-03-02 15:30     ` Peter Maydell
2015-03-02 16:18       ` Andreas Färber
2015-03-02 16:22         ` Peter Maydell
2015-03-02 17:10           ` Andreas Färber
2015-03-03  1:28             ` Peter Maydell
2015-03-02 18:38         ` Eduardo Habkost

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=54F0C130.8040106@suse.de \
    --to=afaerber@suse.de \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.