From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rusty Russell Subject: Re: [RFC 0/5] Making KVM_GET_ONE_REG/KVM_SET_ONE_REG generic. Date: Wed, 05 Sep 2012 16:13:47 +0930 Message-ID: <87ligpj7fg.fsf@rustcorp.com.au> References: <877gsia8rm.fsf@rustcorp.com.au> <87mx1dsfuc.fsf@rustcorp.com.au> <5041D3AE.6090804@redhat.com> <873931539z.fsf@rustcorp.com.au> <5044765A.30702@redhat.com> <87wr0b2smh.fsf@rustcorp.com.au> <5045EA77.5060407@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Rusty Russell , Peter Maydell , Christoffer Dall , Alexander Graf , kvmarm@lists.cs.columbia.edu, kvm-devel To: Avi Kivity Return-path: Received: from ozlabs.org ([203.10.76.45]:49057 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756792Ab2IEIVw (ORCPT ); Wed, 5 Sep 2012 04:21:52 -0400 In-Reply-To: <5045EA77.5060407@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Avi Kivity writes: > On 09/03/2012 03:33 PM, Rusty Russell wrote: >> Avi Kivity writes: >>> On 09/01/2012 03:35 PM, Rusty Russell wrote: >>>> Passing an address in a struct is pretty bad, since it involves >>>> compatibility wrappers. >>> >>> Right, some s390 thing. >> >> Err, no, i386 on x86-64, or ppc32 on ppc64, or arm on arm64.... >> >> Any time you put a pointer in a structure which is exposed to userspace, >> you have to deal with this. > > Not is you pack the pointer in a __u64, which is what we do to preserve > padding. Then it is only s390 which needs extra love. OK, yes. Or skip pointers altogether, like I do. > Another option is to use the size parameter from the ioctl. It just > sits there doing nothing. Not nothing, it defines the head struct size. It's redundant, but proven a useful sanity check over the years. Perhaps somewhere else does use these 14 bits to represent a variable size, but it would surprise me a bit to see it. We'd probably want some way to tell userspace the size then, so we have a different redundancy. We're being too clever, that's why I copied the x86 MSR discovery interface. Cheers, Rusty.