From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH v2 4/5] KVM: add KVM_USER_EXIT vcpu ioctl for userspace exit Date: Thu, 6 Aug 2015 15:52:03 +0200 Message-ID: <55C36683.9050703@redhat.com> References: <1438792381-19453-1-git-send-email-rkrcmar@redhat.com> <1438792381-19453-5-git-send-email-rkrcmar@redhat.com> <55C23B91.4010900@redhat.com> <20150806134415.GB31952@potion.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= Return-path: Received: from mx1.redhat.com ([209.132.183.28]:35345 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752741AbbHFOFr (ORCPT ); Thu, 6 Aug 2015 10:05:47 -0400 In-Reply-To: <20150806134415.GB31952@potion.brq.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 06/08/2015 15:44, Radim Kr=C4=8Dm=C3=A1=C5=99 wrote: >> > Can we just return EINVAL if the parameter is not NULL? > It complicates handling if we extend the ioctl, but removes the usele= ss > clearing/copying/checking now ... Yes. > The two obvious extensions are flags to skip kvm_make_request() or > kvm_vcpu_kick(), both of dubious use. Skipping kvm_make_request() would make some sense if you can set vcpu->run->request_interrupt_window asynchronously. So you could do vcpu->run->request_interrupt_window =3D 1; ioctl(vcpu_fd, KVM_USER_EXIT, KVM_USER_EXIT_LAZY); and only cause a lightweight vmexit if the interrupt window is currentl= y closed. I haven't thought of any races that could happen, but it looks like it could work. Skipping kvm_vcpu_kick() makes much less sense. > Another possibility is setting up > conditional exits, but that would be better as a separate control, li= ke > most other sophisticated extensions. >=20 > I think that u32 flags would be sufficient -- is casting the 'unsigne= d > long arg' (data pointer) to a value still an accepted solution? Yeah, that would work for me as well. Also because, for now, you'd return EINVAL if the unsigned long is not zero, which boils down to "return EINVAL if the parameter is not NULL". :) Paolo