From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [patch 1/3] kvm: provide synchronous registers in kvm_run Date: Thu, 22 Dec 2011 14:28:19 +0200 Message-ID: <4EF32263.5050605@redhat.com> References: <20111222115646.248800653@de.ibm.com> <20111222120054.145183940@de.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Marcelo Tossati , Carsten Otte , Alexander Graf , Jens Freimann , Cornelia Huck , Heiko Carstens , Martin Schwidefsky , KVM To: Christian Borntraeger Return-path: Received: from mx1.redhat.com ([209.132.183.28]:28013 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752398Ab1LVM23 (ORCPT ); Thu, 22 Dec 2011 07:28:29 -0500 In-Reply-To: <20111222120054.145183940@de.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On 12/22/2011 01:56 PM, Christian Borntraeger wrote: > From: Christian Borntraeger > > On some cpus the overhead for virtualization instructions is in the same > range as a system call. Having to call multiple ioctls to get set registers > will make userspace handled exits more expensive than necessary. > Lets provide two sections in kvm_run to have a shared save area for > guest registers. > 1. the first section is read-only, to handle registers that have side-effects > 2. the second section is read/write, e.g. for general purpose registers. An alternative is to have a single section, with a bitmask set by userspace to indicate which registers have not been changed (a la svm's CleanBits). Is this worthwhile for s390? > }; > + /* Here are two fields that allow to access often used registers > + * directly, to avoid the overhead of the ioctl system call */ > + union { > + /* registers which can be only read */ > + struct sync_ro_regs sync_ro_regs; kvm_ > + char padding[1024]; > + }; > + union { > + /* read/write guest registers */ > + struct sync_rw_regs sync_rw_regs; kvm_ > + char padding[1024]; > + }; > }; blank line > +These fields allow userspace to access certain guest registers without > +having to call SET/GET_*REGS. Thus we can avoid some system call > +overhead if userspace has to handle the exit. (only available if > +KVM_CAP_SYNC_REGS is set). The ioctls will still work. > > -- error compiling committee.c: too many arguments to function