From: Glauber Costa Subject: Re: [PATCH] return default values for apic probe functions. Date: Fri, 17 Apr 2009 10:22:14 -0300 Message-ID: <5d6222a80904170622g1977ec37s8872800a12bfafbe@mail.gmail.com> References: <1239945321-3903-1-git-send-email-glommer@redhat.com> <49E82825.602@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Glauber Costa , kvm@vger.kernel.org, avi@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org To: Jan Kiszka Return-path: Received: from qw-out-2122.google.com ([74.125.92.27]:10730 "EHLO qw-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756208AbZDQNWV convert rfc822-to-8bit (ORCPT ); Fri, 17 Apr 2009 09:22:21 -0400 Received: by qw-out-2122.google.com with SMTP id 5so97468qwd.37 for ; Fri, 17 Apr 2009 06:22:20 -0700 (PDT) In-Reply-To: <49E82825.602@web.de> Sender: kvm-owner@vger.kernel.org List-ID: > Even on sunny days, this collides with QEMU commit #7048. :) > > Does Intel specify what non-existent MSRs should return, ie. is your > version still correct if !s->apicbase means that there is actually no > APIC? And does kvm depend on the default base? If so, I would say: > provide a patch against upstream. hummm, I missed this one going in. But sadly, your patch also breaks cpu hotplug. Not a segfault anymore, = but the VM will freeze instead of shutting down, if we ask too. It does not eve= n respond to ^C anymore. By leaving your patch as is, and changing the apic base return to return s ? s->apicbase : (0xfee00000 | MSR_IA32_APICBASE_ENABLE); fixes the issue. I'm not sure about what the manual says (will check now), but I believe if we ever try to read from apic, we should return a meaningful value. Can you verify if this also works for your test case? > >> >> =C2=A0void cpu_set_apic_tpr(CPUX86State *env, uint8_t val) >> @@ -314,7 +319,10 @@ void cpu_set_apic_tpr(CPUX86State *env, uint8_t= val) >> =C2=A0uint8_t cpu_get_apic_tpr(CPUX86State *env) >> =C2=A0{ >> =C2=A0 =C2=A0 =C2=A0APICState *s =3D env->apic_state; >> - =C2=A0 =C2=A0return s->tpr >> 4; >> + =C2=A0 =C2=A0if (s) >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0return s->tpr >> 4; >> + =C2=A0 =C2=A0else >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0; >> =C2=A0} >> >> =C2=A0/* return -1 if no bit is set */ > > This is already upstream. Yeah, and the rest of your patch is totally ok for me. --=20 Glauber Costa. "Free as in Freedom" http://glommer.net "The less confident you are, the more serious you have to act."