From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45893) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UklPK-0000Vo-Ih for qemu-devel@nongnu.org; Thu, 06 Jun 2013 21:23:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UklPJ-0000Sw-BS for qemu-devel@nongnu.org; Thu, 06 Jun 2013 21:23:58 -0400 Received: from mail-pb0-x22d.google.com ([2607:f8b0:400e:c01::22d]:53765) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UklPJ-0000SO-4k for qemu-devel@nongnu.org; Thu, 06 Jun 2013 21:23:57 -0400 Received: by mail-pb0-f45.google.com with SMTP id mc8so4013239pbc.32 for ; Thu, 06 Jun 2013 18:23:55 -0700 (PDT) Message-ID: <51B13625.1070309@ozlabs.ru> Date: Fri, 07 Jun 2013 11:23:49 +1000 From: Alexey Kardashevskiy MIME-Version: 1.0 References: <1369948629-2833-1-git-send-email-pbonzini@redhat.com> <1369948629-2833-11-git-send-email-pbonzini@redhat.com> <51B04A17.7080106@ozlabs.ru> <51B132C1.8010406@redhat.com> In-Reply-To: <51B132C1.8010406@redhat.com> Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 10/21] memory: make section size a 128-bit integer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Alex Williamson , qemu-devel@nongnu.org, David Gibson On 06/07/2013 11:09 AM, Paolo Bonzini wrote: > Il 06/06/2013 04:36, Alexey Kardashevskiy ha scritto: >>>> diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c >>>> index 693a9ff..c89676b 100644 >>>> --- a/hw/misc/vfio.c >>>> +++ b/hw/misc/vfio.c >>>> @@ -1953,7 +1953,7 @@ static void vfio_listener_region_add(MemoryListener *listener, >>>> } >>>> >>>> iova = TARGET_PAGE_ALIGN(section->offset_within_address_space); >>>> - end = (section->offset_within_address_space + section->size) & >>>> + end = (section->offset_within_address_space + int128_get64(section->size)) & >>>> TARGET_PAGE_MASK; >> >> >> Another problem with this patch. Here is some more context (***): > > By the time you get here, this should have already crashed at this > code that patch 13 adds: > > diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c > index c89676b..52fb036 100644 > --- a/hw/misc/vfio.c > +++ b/hw/misc/vfio.c > @@ -1939,6 +1939,8 @@ static void vfio_listener_region_add(MemoryListener *listener, > void *vaddr; > int ret; > > + assert(!memory_region_is_iommu(section->mr)); > + > > so it seems like a bug in your VFIO patches. No, I have David's patches which fix all of this, I'm planning to post them soon. My question is rather what is the whole point of calling memory_region_init_iommu with size==UINT64_MAX? mem_add() tries to do register_subpage() when size is not aligned (UINT64_MAX is not) and fails. So if we want to init memory region with the size as big as possible on 64bit systems, we either have to replace all 64bit sizes with 64bit end addresses (and then use 0-ffffffffffffffff) or support int128 sizes everywhere (even if it is just hi=1, lo=0) or stop initializing memory regions with sizes way bigger than we really need in next 5 years. Am I missing a bigger picture? -- Alexey