From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=44126 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pb8E7-0000IN-3t for qemu-devel@nongnu.org; Fri, 07 Jan 2011 04:03:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pb8E5-0000y6-Ej for qemu-devel@nongnu.org; Fri, 07 Jan 2011 04:03:14 -0500 Received: from fmmailgate01.web.de ([217.72.192.221]:42532) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pb8E5-0000s4-3n for qemu-devel@nongnu.org; Fri, 07 Jan 2011 04:03:13 -0500 Message-ID: <4D26D6CF.5070405@web.de> Date: Fri, 07 Jan 2011 10:03:11 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <4D2616D6.4080309@linux.vnet.ibm.com> In-Reply-To: <4D2616D6.4080309@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig59F3A5E96D04DDACF8514437" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: [PATCH 26/35] kvm: Eliminate KVMState arguments List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Marcelo Tosatti , qemu-devel@nongnu.org, kvm@vger.kernel.org, Alexander Graf This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig59F3A5E96D04DDACF8514437 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Am 06.01.2011 20:24, Anthony Liguori wrote: > On 01/06/2011 11:56 AM, Marcelo Tosatti wrote: >> From: Jan Kiszka >> >> QEMU supports only one VM, so there is only one kvm_state per process,= >> and we gain nothing passing a reference to it around. Eliminate any ne= ed >> to refer to it outside of kvm-all.c. >> >> Signed-off-by: Jan Kiszka >> CC: Alexander Graf >> Signed-off-by: Marcelo Tosatti >> =20 >=20 > I think this is a big mistake. Obviously, I don't share your concerns. :) >=20 > Having to manage kvm_state keeps the abstraction lines well defined.=20 How does it help? > Otherwise, it's far too easy for portions of code to call into KVM > functions that really shouldn't. I can't imagine we gain anything from requiring kvm_check_extension callers to hold a kvm_state "capability". Yes, it's now much easier to call kvm_[vm_]ioctl, but that's the key point of this change: So far we primarily complicated the internal interface between generic and arch-dependent kvm parts by requiring kvm_state joggling. But external users already find interfaces without this restriction (kvm_log_*, kvm_ioeventfd_*, ...). That's because it's at least complicated to _cleanly_ pass kvm_state references to all users that need it - e.g. sysbus devices like kvmclock or upcoming in-kernel irqchip= s. Let's just stop this artificial abstraction that has no practical use and focus on detecting layering violations via code review. That's more reliable IMHO. Jan --------------enig59F3A5E96D04DDACF8514437 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/ iEYEARECAAYFAk0m1s8ACgkQitSsb3rl5xRO8QCeJ34W3lKQpkPeTxaJjKNthXK8 xkEAnjUlcOqujB/745u/ZJ/64CwF1KYZ =MI8+ -----END PGP SIGNATURE----- --------------enig59F3A5E96D04DDACF8514437--