qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Blue Swirl" <blauwirbel@gmail.com>
To: "risc@volumehost.com" <risc@volumehost.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Regression bug
Date: Tue, 29 May 2007 22:33:37 +0300	[thread overview]
Message-ID: <f43fc5580705291233m16aec5b2l62a2e002062a6b04@mail.gmail.com> (raw)
In-Reply-To: <20070529190411.GK4797@volumehost.com>

[-- Attachment #1: Type: text/plain, Size: 612 bytes --]

On 5/29/07, risc@volumehost.com <risc@volumehost.com> wrote:
> On Tue, May 29, 2007 at 09:44:39PM +0300, Blue Swirl wrote:
> > Hi,
> >
> > I found a bug in the subpage checking code. Could you try if the
> > attached patch fixes the problem?
>
> thats a negative. the exact same behavior as before.

Thanks.

The bug was actually that on PC, the very last addresses are mapped,
and the current code failed when the start_addr + size wrapped back to
0. That didn't happen on amd64, where I first tried to reproduce the
bug.

The attached patch fixes the problem for me, I'll commit it if there
are no objections.

[-- Attachment #2: fix_subpage.diff --]
[-- Type: text/x-diff, Size: 1389 bytes --]

Index: qemu/exec.c
===================================================================
--- qemu.orig/exec.c	2007-05-29 19:31:15.000000000 +0000
+++ qemu/exec.c	2007-05-29 19:31:24.000000000 +0000
@@ -1922,7 +1922,7 @@
                 need_subpage = 1;                                       \
         }                                                               \
                                                                         \
-        if (end_addr - addr > TARGET_PAGE_SIZE)                         \
+        if ((start_addr + orig_size) - addr >= TARGET_PAGE_SIZE)        \
             end_addr2 = TARGET_PAGE_SIZE - 1;                           \
         else {                                                          \
             end_addr2 = (start_addr + orig_size - 1) & ~TARGET_PAGE_MASK; \
@@ -1944,9 +1944,9 @@
     unsigned long orig_size = size;
     void *subpage;
 
-    end_addr = start_addr + (target_phys_addr_t)size;
     size = (size + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK;
-    for(addr = start_addr; addr < end_addr; addr += TARGET_PAGE_SIZE) {
+    end_addr = start_addr + (target_phys_addr_t)size;
+    for(addr = start_addr; addr != end_addr; addr += TARGET_PAGE_SIZE) {
         p = phys_page_find(addr >> TARGET_PAGE_BITS);
         if (p && p->phys_offset != IO_MEM_UNASSIGNED) {
             unsigned long orig_memory = p->phys_offset;

  reply	other threads:[~2007-05-29 19:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-29 13:08 [Qemu-devel] Regression bug Ben Taylor
2007-05-29 17:34 ` Blue Swirl
2007-05-29 18:44 ` Blue Swirl
2007-05-29 19:04   ` risc
2007-05-29 19:33     ` Blue Swirl [this message]
2007-05-29 20:01       ` risc
  -- strict thread matches above, loose matches on Subject: below --
2007-05-30 11:27 Ben Taylor
2007-05-29  5:10 Ben Taylor
2007-05-29  8:56 ` Xavier Gnata
2007-05-29 12:31 ` risc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f43fc5580705291233m16aec5b2l62a2e002062a6b04@mail.gmail.com \
    --to=blauwirbel@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=risc@volumehost.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).