From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UL9fq-000508-LK for qemu-devel@nongnu.org; Thu, 28 Mar 2013 06:03:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UL9fp-0006gF-0h for qemu-devel@nongnu.org; Thu, 28 Mar 2013 06:03:10 -0400 Received: from mail-qa0-f53.google.com ([209.85.216.53]:36030) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UL9fo-0006g2-SR for qemu-devel@nongnu.org; Thu, 28 Mar 2013 06:03:08 -0400 Received: by mail-qa0-f53.google.com with SMTP id k4so1425165qaq.5 for ; Thu, 28 Mar 2013 03:03:08 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <51541556.2040907@redhat.com> Date: Thu, 28 Mar 2013 11:03:02 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1363653285-23776-1-git-send-email-asias@redhat.com> <1363653285-23776-4-git-send-email-asias@redhat.com> <20130319084057.GB24393@stefanha-thinkpad.redhat.com> <1363744628.13070.28.camel@haakon2.linux-iscsi.org> <20130320095140.GA16615@redhat.com> <1364419887.17698.19.camel@haakon2.linux-iscsi.org> <20130327215625.GC10678@redhat.com> <1364423629.17698.25.camel@haakon2.linux-iscsi.org> <1364453115.17698.106.camel@haakon2.linux-iscsi.org> <1364456142.10253.6.camel@haakon2.linux-iscsi.org> <20130328090416.GA18482@redhat.com> In-Reply-To: <20130328090416.GA18482@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V3 WIP 3/3] disable vhost_verify_ring_mappings check List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: target-devel@vger.kernel.org, kvm@vger.kernel.org, seabios-devel , qemu-devel@nongnu.org, "Nicholas A. Bellinger" , virtualization@lists.linux-foundation.org, Kevin O'Connor , Stefan Hajnoczi Il 28/03/2013 10:04, Michael S. Tsirkin ha scritto: >>> > > Got ranges_overlap for vq: 0 ring_phys: 0 ring_size: 1028 >>> > > Checking vq: 1 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>. >>> > > Got ranges_overlap for vq: 1 ring_phys: 0 ring_size: 1028 >>> > > Checking vq: 2 ring_phys: ed000 ring_size: 5124 >>>>>>>>>>>>>>>>>>. >>> > > Calling l: 5124 for start_addr: c0000 for vq 2 >>> > > Unable to map ring buffer for ring 2 >>> > > l: 4096 ring_size: 5124 > okay so the ring address is within ROM. > Unsurprisingly it fails. > bios should stop device before write protect. > The above log is very early, when everything is RAM: vhost_set_memory: section: 0x7fe2801f2b60 section->size: 2146697216 add: 0 Before vhost_verify_ring_mappings: start_addr: c0000 size: 2146697216 The rings are not within ROM. ROM is at 0xc0000-0xcc000 according to the PAM registers. The way I followed the debug output, "Got ranges_overlap" means actually "bailing out because ranges do not overlap". In particular, here all three virtqueues fail the test, because this is the ROM area 0xc0000..0xc7fff: vhost_set_memory: section: 0x7fe2801f2aa0 section->size: 32768 add: 1 Before vhost_verify_ring_mappings: start_addr: c0000 size: 32768 Checking vq: 0 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>. Got ranges_overlap for vq: 0 ring_phys: 0 ring_size: 1028 Checking vq: 1 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>. Got ranges_overlap for vq: 1 ring_phys: 0 ring_size: 1028 Checking vq: 2 ring_phys: ed000 ring_size: 5124 >>>>>>>>>>>>>>>>>>. Got ranges_overlap for vq: 2 ring_phys: ed000 ring_size: 5124 Just below, vhost looks at the large RAM area starting at 0xc8000 (it's large because 0xf0000..0xfffff is still RAM): vhost_set_memory: section: 0x7fe2801f2aa0 section->size: 2146664448 add: 1 Before vhost_verify_ring_mappings: start_addr: c8000 size: 2146664448 Checking vq: 0 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>. Got ranges_overlap for vq: 0 ring_phys: 0 ring_size: 1028 Checking vq: 1 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>. Got ranges_overlap for vq: 1 ring_phys: 0 ring_size: 1028 Checking vq: 2 ring_phys: ed000 ring_size: 5124 >>>>>>>>>>>>>>>>>>. Calling l: 5124 for start_addr: c8000 for vq 2 Here vq 0 and 1 fail the test because they are in low RAM, vq 2 passes. After 0xf0000..0xfffff is marked readonly, vhost looks at the RAM between 0xc9000 and 0xf0000: vhost_set_memory: section: 0x7fe2801f2aa0 section->size: 159744 add: 1 Before vhost_verify_ring_mappings: start_addr: c9000 size: 159744 Checking vq: 0 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>. Got ranges_overlap for vq: 0 ring_phys: 0 ring_size: 1028 Checking vq: 1 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>. Got ranges_overlap for vq: 1 ring_phys: 0 ring_size: 1028 Checking vq: 2 ring_phys: ed000 ring_size: 5124 >>>>>>>>>>>>>>>>>>. Calling l: 5124 for start_addr: c9000 for vq 2 and the ROM between 0xf0000 and 0xfffff, which no ring overlaps with: vhost_set_memory: section: 0x7fe2801f2aa0 section->size: 65536 add: 1 Before vhost_verify_ring_mappings: start_addr: f0000 size: 65536 Checking vq: 0 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>. Got ranges_overlap for vq: 0 ring_phys: 0 ring_size: 1028 Checking vq: 1 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>. Got ranges_overlap for vq: 1 ring_phys: 0 ring_size: 1028 Checking vq: 2 ring_phys: ed000 ring_size: 5124 >>>>>>>>>>>>>>>>>>. Got ranges_overlap for vq: 2 ring_phys: ed000 ring_size: 5124 SeaBIOS is indeed not initializing vqs 0/1 (the control and event queues), so their ring_phys is 0. But the one that is failing is vq 2, the first request queue. Your patch seems good, but shouldn't fix this problem. Paolo