From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [Qemu-devel] [RFC] Next gen kvm api Date: Wed, 15 Feb 2012 22:21:35 +0000 Message-ID: <201202152221.36154.arnd@arndb.de> References: <4F2AB552.2070909@redhat.com> <1328597934.6802.6.camel@concordia> Mime-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Cc: Alexander Graf , michael@ellerman.id.au, KVM list , "linux-kernel" , Eric Northup , Scott Wood , Avi Kivity To: qemu-devel@nongnu.org Return-path: Received: from moutng.kundenserver.de ([212.227.126.186]:56820 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751388Ab2BOWYR (ORCPT ); Wed, 15 Feb 2012 17:24:17 -0500 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Tuesday 07 February 2012, Alexander Graf wrote: > On 07.02.2012, at 07:58, Michael Ellerman wrote: > > > On Mon, 2012-02-06 at 13:46 -0600, Scott Wood wrote: > >> You're exposing a large, complex kernel subsystem that does very > >> low-level things with the hardware. It's a potential source of exploits > >> (from bugs in KVM or in hardware). I can see people wanting to be > >> selective with access because of that. > > > > Exactly. > > > > In a perfect world I'd agree with Anthony, but in reality I think > > sysadmins are quite happy that they can prevent some users from using > > KVM. > > > > You could presumably achieve something similar with capabilities or > > whatever, but a node in /dev is much simpler. > > Well, you could still keep the /dev/kvm node and then have syscalls operate on the fd. > > But again, I don't see the problem with the ioctl interface. It's nice, extensible and works great for us. > ioctl is good for hardware devices and stuff that you want to enumerate and/or control permissions on. For something like KVM that is really a core kernel service, a syscall makes much more sense. I would certainly never mix the two concepts: If you use a chardev to get a file descriptor, use ioctl to do operations on it, and if you use a syscall to get the file descriptor then use other syscalls to do operations on it. I don't really have a good recommendation whether or not to change from an ioctl based interface to syscall for KVM now. On the one hand I believe it would be significantly cleaner, on the other hand we cannot remove the chardev interface any more since there are many existing users. Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:41342) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxnGp-0002Yb-28 for qemu-devel@nongnu.org; Wed, 15 Feb 2012 17:24:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RxnGn-0007wk-SJ for qemu-devel@nongnu.org; Wed, 15 Feb 2012 17:24:15 -0500 Received: from moutng.kundenserver.de ([212.227.126.186]:56995) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxnGn-0007wE-Fx for qemu-devel@nongnu.org; Wed, 15 Feb 2012 17:24:13 -0500 From: Arnd Bergmann Date: Wed, 15 Feb 2012 22:21:35 +0000 References: <4F2AB552.2070909@redhat.com> <1328597934.6802.6.camel@concordia> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201202152221.36154.arnd@arndb.de> Subject: Re: [Qemu-devel] [RFC] Next gen kvm api List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: KVM list , Alexander Graf , linux-kernel , michael@ellerman.id.au, Eric Northup , Scott Wood , Avi Kivity On Tuesday 07 February 2012, Alexander Graf wrote: > On 07.02.2012, at 07:58, Michael Ellerman wrote: > > > On Mon, 2012-02-06 at 13:46 -0600, Scott Wood wrote: > >> You're exposing a large, complex kernel subsystem that does very > >> low-level things with the hardware. It's a potential source of exploits > >> (from bugs in KVM or in hardware). I can see people wanting to be > >> selective with access because of that. > > > > Exactly. > > > > In a perfect world I'd agree with Anthony, but in reality I think > > sysadmins are quite happy that they can prevent some users from using > > KVM. > > > > You could presumably achieve something similar with capabilities or > > whatever, but a node in /dev is much simpler. > > Well, you could still keep the /dev/kvm node and then have syscalls operate on the fd. > > But again, I don't see the problem with the ioctl interface. It's nice, extensible and works great for us. > ioctl is good for hardware devices and stuff that you want to enumerate and/or control permissions on. For something like KVM that is really a core kernel service, a syscall makes much more sense. I would certainly never mix the two concepts: If you use a chardev to get a file descriptor, use ioctl to do operations on it, and if you use a syscall to get the file descriptor then use other syscalls to do operations on it. I don't really have a good recommendation whether or not to change from an ioctl based interface to syscall for KVM now. On the one hand I believe it would be significantly cleaner, on the other hand we cannot remove the chardev interface any more since there are many existing users. Arnd