From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48663) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X04XW-0004uM-HR for qemu-devel@nongnu.org; Thu, 26 Jun 2014 03:56:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X04XO-000636-N6 for qemu-devel@nongnu.org; Thu, 26 Jun 2014 03:56:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12685) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X04XO-00062w-Eu for qemu-devel@nongnu.org; Thu, 26 Jun 2014 03:56:06 -0400 Date: Thu, 26 Jun 2014 10:56:30 +0300 From: "Michael S. Tsirkin" Message-ID: <20140626075630.GD21823@redhat.com> References: <20140625142704.GC15277@redhat.com> <7B7FFD16-82ED-4D0E-8B83-A6448DC9A344@cisco.com> <20140625152936.GB15720@redhat.com> <20140625155038.GG15720@redhat.com> <7760835F-C1F1-4023-960D-A70096465EBD@cisco.com> <122055914.32517283.1403714698790.JavaMail.zimbra@redhat.com> <539537F4-A2DD-416A-9245-C31905138EFD@cisco.com> <20140626071340.GB21685@redhat.com> <1E65566B-BB6B-4B55-997D-13A63162AD5B@cisco.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1E65566B-BB6B-4B55-997D-13A63162AD5B@cisco.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] vhost-user: broken mem regions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Damjan Marion (damarion)" Cc: Paolo Bonzini , "qemu-devel@nongnu.org" , Nikolay Nikolaev On Thu, Jun 26, 2014 at 07:44:24AM +0000, Damjan Marion (damarion) wrote: >=20 > On 26 Jun 2014, at 09:13, Michael S. Tsirkin wrote: >=20 > > On Wed, Jun 25, 2014 at 09:52:09PM +0000, Damjan Marion (damarion) wr= ote: > >>=20 > >> On 25 Jun 2014, at 18:44, Paolo Bonzini wrote: > >>=20 > >>>> nregions: 4 > >>>> region: > >>>> gpa =3D 0x100000000 > >>>> size =3D 3221225472 > >>>> ua =3D 0x2aab6ac00000 > >>>=20 > >>> High memory, above 3 gigabytes. > >>>=20 > >>>> region: > >>>> gpa =3D 0xFFFC0000 > >>>> size =3D 262144 > >>>> ua =3D 0x7fc13d200000 > >>>=20 > >>> This is the BIOS. There shouldn't be any FD for this one, it > >>> is not allocated in hugetlbfs. > >>>=20 > >>>> region: > >>>> gpa =3D 0x0 > >>>> size =3D 655360 > >>>> ua =3D 0x2aaaaac00000 > >>>> region: > >>>> gpa =3D 0xC0000 > >>>> size =3D 3220439040 > >>>> ua =3D 0x2aaaaacc0000 > >>>=20 > >>> Together, it's the first 3 GB of memory. > >>>=20 > >>> I understand now what you mean. Yeah, the format should be changed > >>> to include the offset (why does vhost-user need the ua at all? > >>> perhaps the offset can replace the ua). > >>>=20 > >>>> BTW Any idea what to do with region 2, it doesn=E2=80=99t look lik= e the one belonging > >>>> to the same place, but qemu_get_ram_fd() returns same FD for it. > >>>=20 > >>> This must be a bug. I would have expected qemu_get_ram_fd to retur= n -1 > >>> here, so no descriptor should be passed to vhost-user. > >>=20 > >> Problem is inside qemu_get_ram_block(): > >>=20 > >>=20 > >> if (block && addr - block->offset < block->length) { > >> goto found; > >> } > >>=20 > >> this is true if we have > 4G of RAM allocated. > >=20 > > Hmm I don't get it. Why is it always true for >4G RAM? >=20 > This check assumes that guest memory is mapped to RAM block=20 > without gaps. as BIOS is mapped to guest address space > near 4G this check will return true if block size is bigger than > BIOS address. But then offset is > addr so addr - offset is a huge value no? > >=20 > >>=20 > >> Any advice how to fix this? > >>=20 > >>=20