From: "Andreas Färber" <afaerber@suse.de>
To: Igor Mammedov <imammedo@redhat.com>
Cc: aliguori@us.ibm.com, ehabkost@redhat.com, gleb@redhat.com,
Don@CloudSwitch.com, qemu-devel@nongnu.org, jan.kiszka@web.de
Subject: Re: [Qemu-devel] [PATCH] target-i386: initialize APIC at CPU level
Date: Thu, 04 Oct 2012 18:47:07 +0200 [thread overview]
Message-ID: <506DBD8B.6040000@suse.de> (raw)
In-Reply-To: <20121004183117.4d51b0d2@nial.usersys.redhat.com>
Am 04.10.2012 18:31, schrieb Igor Mammedov:
> On Thu, 04 Oct 2012 18:15:48 +0200
> Andreas Färber <afaerber@suse.de> wrote:
>
>> Am 04.10.2012 16:43, schrieb Igor Mammedov:
>>> +static void x86_cpu_apic_init(X86CPU *cpu, Error **errp)
>>> +{
>>> +#ifndef CONFIG_USER_ONLY
>>> + static int apic_mapped;
>>> + CPUX86State *env = &cpu->env;
>>> + const char *apic_type = "apic";
>>> +
>>> + if (!(env->cpuid_features & CPUID_APIC || smp_cpus > 1)) {
>>> + return;
>>> + }
>>
>> I would prefer to keep the original logic at the call site
>> (x86_cpu_initfn)
> Could you explain it bit more?
>
>> rather than silently returning without setting errp.
> and this one too, pls.
Sorry. What I mean here is don't let the function return without setting
an error condition if it didn't do anything (I consider that dangerous
since it potentially hides errors). Therefore only call it when we
actually do want the APIC (condition seems trivial enough) and then
signal an error if something is wrong, so that it's detectable:
>>> @@ -1878,6 +1934,8 @@ void x86_cpu_realize(Object *obj, Error **errp)
>>> qemu_register_reset(x86_cpu_machine_reset_cb, cpu);
>>> #endif
>>>
if ((env->cpuid_features & CPUID_APIC) || smp_cpus > 1) {
>>> + x86_cpu_apic_init(cpu, errp);
>>
>> if (error_is_set(errp)) {
>> return;
>> }
}
If we now truely signal errors and not only try to follow the realizefn
convention, you should also check the callers of x86_cpu_realize() to
make sure errp is not NULL and is being checked and printed after the call.
Regards,
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
next prev parent reply other threads:[~2012-10-04 16:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-04 14:43 [Qemu-devel] [PATCH] target-i386: initialize APIC at CPU level Igor Mammedov
2012-10-04 16:15 ` Andreas Färber
2012-10-04 16:31 ` Igor Mammedov
2012-10-04 16:47 ` Andreas Färber [this message]
2012-10-05 15:32 ` Igor Mammedov
2012-10-04 16:44 ` Jan Kiszka
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=506DBD8B.6040000@suse.de \
--to=afaerber@suse.de \
--cc=Don@CloudSwitch.com \
--cc=aliguori@us.ibm.com \
--cc=ehabkost@redhat.com \
--cc=gleb@redhat.com \
--cc=imammedo@redhat.com \
--cc=jan.kiszka@web.de \
--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 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).