From patchwork Mon Oct 29 15:17:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 195029 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BF8DF2C008B for ; Tue, 30 Oct 2012 02:17:34 +1100 (EST) Received: from localhost ([::1]:34684 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TSr5o-00021S-Rr for incoming@patchwork.ozlabs.org; Mon, 29 Oct 2012 11:17:32 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57574) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TSr5d-0001yQ-2d for qemu-devel@nongnu.org; Mon, 29 Oct 2012 11:17:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TSr5Y-0003Uw-MS for qemu-devel@nongnu.org; Mon, 29 Oct 2012 11:17:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44335) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TSr5Y-0003Ud-Dz for qemu-devel@nongnu.org; Mon, 29 Oct 2012 11:17:16 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9TFHApn011339 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 29 Oct 2012 11:17:10 -0400 Received: from balrog.usersys.tlv.redhat.com (dhcp-4-121.tlv.redhat.com [10.35.4.121]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q9TFH6fd026740; Mon, 29 Oct 2012 11:17:07 -0400 Message-ID: <508E9DF1.3060205@redhat.com> Date: Mon, 29 Oct 2012 17:17:05 +0200 From: Avi Kivity User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121016 Thunderbird/16.0.1 MIME-Version: 1.0 To: Aurelien Jarno References: <50872514.1090207@twiddle.net> <20121024140015.GA14279@hall.aurel32.net> <508942F6.5050001@redhat.com> <20121025143937.GH5261@ohm.aurel32.net> <508964D6.8080607@redhat.com> <20121029075453.GA1632@ohm.aurel32.net> In-Reply-To: <20121029075453.GA1632@ohm.aurel32.net> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org, Richard Henderson Subject: Re: [Qemu-devel] [memory] abort with head a8170e5 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On 10/29/2012 09:54 AM, Aurelien Jarno wrote: > On Thu, Oct 25, 2012 at 06:12:06PM +0200, Avi Kivity wrote: >> On 10/25/2012 04:39 PM, Aurelien Jarno wrote: >> > On Thu, Oct 25, 2012 at 03:47:34PM +0200, Avi Kivity wrote: >> >> On 10/24/2012 04:00 PM, Aurelien Jarno wrote: >> >> > >> >> > mips is also broken but by commit 1c380f9460522f32c8dd2577b2a53d518ec91c6d: >> >> > >> >> > | [ 0.436000] PCI: Enabling device 0000:00:0a.1 (0000 -> 0001) >> >> > | Segmentation fault (core dumped) >> >> > >> >> >> >> How do you reproduce it? >> > >> > You can use the mips kernel version 2.6.32 from: >> > http://people.debian.org/~aurel32/qemu/mips/ >> > >> > Then just run it with the following command: >> > qemu-system-mips -M malta -kernel vmlinux-2.6.32-5-4kc-malta -append "console=tty0" >> > >> > (You can also get the README command line if you don't care about >> > downloading the disk image). >> >> Doesn't reproduce here with this command line (upstream + the bridge patch). >> >> [ 0.568000] PCI: Enabling device 0000:00:12.0 (0000 -> 0002) >> [ 0.572000] cirrusfb 0000:00:12.0: Cirrus Logic chipset on PCI bus, >> RAM (4096 kB) at 0x10000000 >> >> ... >> >> [ 1.172000] PCI: Enabling device 0000:00:0a.1 (0000 -> 0001) >> [ 1.188000] scsi0 : ata_piix >> >> (with console=ttyS0) > > Ok, looks like I didn't provide the right command line. I am only able > to reproduce it when using -nographic, and only with -vga cirrus (yes it > starts to be quite strange). In that case it's better to pass > console=ttyS0, even if you can reproduce it with console=tty0. > > In short it seems heavily related to the cirrus VGA card. I was able to reproduce it, and in fact it's unrelated to VGA, it's deep in the memory core. Please try this patch: From: Avi Kivity Date: Mon, 29 Oct 2012 17:07:09 +0200 Subject: [PATCH] memory: fix rendering of a region obscured by another The memory core drops regions that are hidden by another region (for example, during BAR sizing), but it doesn't do so correctly if the lower address of the existing range is below the lower address of the new range. Example (qemu-system-mips -M malta -kernel vmlinux-2.6.32-5-4kc-malta -append "console=ttyS0" -nographic -vga cirrus): Existing range: 10000000-107fffff New range: 100a0000-100bffff Correct behaviour: drop new range Incorrect behaviour: add new range Fix by taking this case into account (previously we only considered equal lower boundaries). Signed-off-by: Avi Kivity Tested-by: Aurelien Jarno diff --git a/memory.c b/memory.c index 36bb9a5..243cb23 100644 --- a/memory.c +++ b/memory.c @@ -539,12 +539,12 @@ static void render_memory_region(FlatView *view, offset_in_region += int128_get64(now); int128_subfrom(&remain, now); } - if (int128_eq(base, view->ranges[i].addr.start)) { - now = int128_min(remain, view->ranges[i].addr.size); - int128_addto(&base, now); - offset_in_region += int128_get64(now); - int128_subfrom(&remain, now); - } + now = int128_sub(int128_min(int128_add(base, remain), + addrrange_end(view->ranges[i].addr)), + base); + int128_addto(&base, now); + offset_in_region += int128_get64(now); + int128_subfrom(&remain, now); } if (int128_nz(remain)) { fr.mr = mr;