From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUwyu-0002f4-ER for qemu-devel@nongnu.org; Thu, 27 Aug 2015 09:12:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUwyr-0002Jq-3H for qemu-devel@nongnu.org; Thu, 27 Aug 2015 09:12:40 -0400 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:48692) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUwyq-0002If-Rj for qemu-devel@nongnu.org; Thu, 27 Aug 2015 09:12:37 -0400 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 27 Aug 2015 14:12:32 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 36E8B2190160 for ; Thu, 27 Aug 2015 14:10:31 +0100 (BST) Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t7RDAt3r9175242 for ; Thu, 27 Aug 2015 13:10:58 GMT Received: from d06av11.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t7RDAjKp005904 for ; Thu, 27 Aug 2015 07:10:45 -0600 Date: Thu, 27 Aug 2015 15:10:32 +0200 From: Greg Kurz Message-ID: <20150827151032.3daebb92@bahia.local> In-Reply-To: <20150827152902-mutt-send-email-mst@redhat.com> References: <55DE970B.6040807@redhat.com> <20150827135126-mutt-send-email-mst@redhat.com> <20150827140715-mutt-send-email-mst@redhat.com> <20150827151601-mutt-send-email-mst@redhat.com> <20150827152348-mutt-send-email-mst@redhat.com> <20150827152902-mutt-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/2] memory: allow zero size for adjust_endianness() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Peter Maydell , Jason Wang , QEMU Developers , Paolo Bonzini On Thu, 27 Aug 2015 15:30:55 +0300 "Michael S. Tsirkin" wrote: > On Thu, Aug 27, 2015 at 01:27:54PM +0100, Peter Maydell wrote: > > On 27 August 2015 at 13:25, Michael S. Tsirkin wrote: > > > On Thu, Aug 27, 2015 at 01:20:52PM +0100, Peter Maydell wrote: > > >> On 27 August 2015 at 13:17, Michael S. Tsirkin wrote: > > >> > Basically the point is that ABI is extended to make > > >> > ioeventfd with len = 0 mean "any length". > > >> > 0 is thus not meaningless anymore. > > >> > > >> But how can you do adjustment for incorrect endianness > > >> if you don't know the size of the data that you're > > >> trying to work with? That's why this switch insists > > >> that the size is 1, 2, 4 or 8. > > > > > For kvm at least, "any length" implies "any data". > > > So data is eventually discarded, we don't really need > > > to adjust it for endian-ness. > > > > I'm still confused. If you have data it needs to be > > adjusted. If we're not actually doing anything with > > the data why are we calling this function in the first > > place? > > > > -- PMM > > I guess you could skip calls to adjust_endianness when len == 0, > that should work just as well. > adjust_endianness() is called from 4 different locations: - memory_region_dispatch_read() - memory_region_dispatch_write() - memory_region_add_eventfd() - memory_region_del_eventfd() Since the issue was raised for the eventfd ones, it makes more sense to check in the caller indeed... and to preserve other paths. Cheers. -- Greg