From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:40349) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUlIU-0005O8-QB for qemu-devel@nongnu.org; Thu, 09 Jun 2011 15:53:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QUlIT-0001Cb-29 for qemu-devel@nongnu.org; Thu, 09 Jun 2011 15:53:42 -0400 Received: from fmmailgate02.web.de ([217.72.192.227]:49108) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUlIS-0001CP-MO for qemu-devel@nongnu.org; Thu, 09 Jun 2011 15:53:41 -0400 Message-ID: <4DF124BE.7040600@web.de> Date: Thu, 09 Jun 2011 21:53:34 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <3c5277ff7e8ba99b17755e52e2d855a01dcefb87.1307542247.git.jan.kiszka@siemens.com> <20110609173317.GA5970@otherpad.lan.raisama.net> <4DF105AF.5010404@siemens.com> <20110609180829.GB5970@otherpad.lan.raisama.net> In-Reply-To: <20110609180829.GB5970@otherpad.lan.raisama.net> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigC0DB89B4A38AA0DA51CFFAFF" Sender: jan.kiszka@web.de Subject: Re: [Qemu-devel] [PATCH 11/12] kvm: x86: Pass KVMState to kvm_arch_get_supported_cpuid List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity , Marcelo Tosatti , qemu-devel@nongnu.org, kvm@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigC0DB89B4A38AA0DA51CFFAFF Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2011-06-09 20:08, Eduardo Habkost wrote: > On Thu, Jun 09, 2011 at 07:41:03PM +0200, Jan Kiszka wrote: > >>> I'm wondering if it wouldn't be simpler to keep the existing interfac= e >>> but just initialize CPUState->kvm_state earlier (today it is initiali= zed >>> only on kvm_init_vcpu(), although the kvm_state global is initialized= >>> much earlier). >> >> If there was more need for a slit up, I would agree. But I do not see = it. >=20 > I guess it won't hurt to make the functions require only what they > really need. Yes, so this patch has an independent value IMO. >=20 >>> >>> Even with this new KVMState-based interface, code that needs to use >>> these functions before kvm_init_vcpu() (e.g. >>> check_features_against_host()) will have to use the 'kvm_state' globa= l >>> (and I would like to avoid that). >> >> That is a different topic that needs to be resolved for other use case= s >> as well (e.g. for kvm devices). In many cases you should be able to fi= nd >> a way to pass kvm_state from functions that already holds a reference.= >> Is that not true for your use case? >=20 > My use case is cpu_x86_register()/check_features_against_host(), that > hold only a CPUState reference, and I wouldn't like to add a new > reference to the kvm_state global variable there. For me, this is like requiring kvm_state for kvm_check_extension, and I wouldn't hesitate using the global state until we solved that in a better way. But if you feel like it's not appropriate here, then let's go for early/late vcpu init. Jan --------------enigC0DB89B4A38AA0DA51CFFAFF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/ iEYEARECAAYFAk3xJMIACgkQitSsb3rl5xQeuwCglzrL6iDmobs62Fr1dX5tAnMr JogAn1kUG+e5vZGAFjFbRz56O0Jnuigw =bY7i -----END PGP SIGNATURE----- --------------enigC0DB89B4A38AA0DA51CFFAFF--