From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [RFC 0/5] Making KVM_GET_ONE_REG/KVM_SET_ONE_REG generic. Date: Mon, 03 Sep 2012 12:20:26 +0300 Message-ID: <5044765A.30702@redhat.com> References: <877gsia8rm.fsf@rustcorp.com.au> <87mx1dsfuc.fsf@rustcorp.com.au> <5041D3AE.6090804@redhat.com> <873931539z.fsf@rustcorp.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Rusty Russell , Peter Maydell , Christoffer Dall , Alexander Graf , kvmarm@lists.cs.columbia.edu, kvm-devel To: Rusty Russell Return-path: Received: from mx1.redhat.com ([209.132.183.28]:15929 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756189Ab2ICJUq (ORCPT ); Mon, 3 Sep 2012 05:20:46 -0400 In-Reply-To: <873931539z.fsf@rustcorp.com.au> Sender: kvm-owner@vger.kernel.org List-ID: On 09/01/2012 03:35 PM, Rusty Russell wrote: > Avi Kivity writes: >>> -Capability: basic >>> +Capability: KVM_CAP_REG_LIST >>> Architectures: arm >> >> all > > OK, I guess that's to be true in future. Fixed. > >>> Type: vcpu ioctl >>> -Parameters: struct kvm_msr_list (in/out) >>> +Parameters: struct kvm_reg_list (in/out) >>> Returns: 0 on success; -1 on error >>> Errors: >>> - E2BIG: the msr index list is too big to fit in the array specified by >>> - the user. >>> + E2BIG: the reg index list is too big to fit in the array specified by >>> + the user (the number required will be written into n). >>> >>> struct kvm_msr_list { >>> - __u32 nmsrs; /* number of msrs in entries */ >>> - __u32 indices[0]; >>> + __u64 n; /* number of registers in reg[] */ >>> + __u64 reg[0]; >>> }; >>> >> >> People complain that this interface is hard to use. >> >> How about supplying the address of the array (in addition to n) so you >> don't have to deal with variable sized arrays, and dropping E2BIG in >> favour of always updating n (n changed to something bigger than you had >> -> reallocate and rerun) > > We re-write n anyway, *and* return -E2BIG. Not returning an error is > asking for trouble. > > Passing an address in a struct is pretty bad, since it involves > compatibility wrappers. Right, some s390 thing. > I don't think that is what makes the API hard > to use. What is it then? I forgot what the original complaints/complainers were. -- error compiling committee.c: too many arguments to function