From: Avi Kivity <avi@redhat.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
Stefan Berger <stefanb@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH] exec-obsolete: fix length handling
Date: Sun, 29 Jan 2012 15:20:06 +0200 [thread overview]
Message-ID: <4F254786.6070903@redhat.com> (raw)
In-Reply-To: <CAAu8pHsUA4rrEX1Cm9=KbouA_hAHhCYteJMoANNXY-3DSUXmQQ@mail.gmail.com>
On 01/29/2012 03:16 PM, Blue Swirl wrote:
> On Sun, Jan 29, 2012 at 12:08, Avi Kivity <avi@redhat.com> wrote:
> > On 01/28/2012 08:13 PM, Blue Swirl wrote:
> >> Fix suspend/resume broken by off-by-one error in
> >> 59abb06198ee9471e29c970f294eae80c0b39be1.
> >>
> >> Adjust the loop so that it handles correctly the case
> >> start = (ram_addr_t)-TARGET_PAGE_SIZE, length = TARGET_PAGE_SIZE.
> >>
> >> Reported-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> >> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
> >> ---
> >> exec-obsolete.h | 10 ++++------
> >> 1 files changed, 4 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/exec-obsolete.h b/exec-obsolete.h
> >> index 03cf35e..1bba970 100644
> >> --- a/exec-obsolete.h
> >> +++ b/exec-obsolete.h
> >> @@ -81,11 +81,10 @@ static inline void
> >> cpu_physical_memory_set_dirty_range(ram_addr_t start,
> >> int dirty_flags)
> >> {
> >> uint8_t *p;
> >> - ram_addr_t addr, end;
> >> + ram_addr_t cur;
> >>
> >> - end = start + length;
> >> p = ram_list.phys_dirty + (start >> TARGET_PAGE_BITS);
> >> - for (addr = start; addr <= end; addr += TARGET_PAGE_SIZE) {
> >> + for (cur = 0; cur < length; cur += TARGET_PAGE_SIZE) {
> >> *p++ |= dirty_flags;
> >> }
> >
> > I think this is still wrong - if length == 2 it will iterate once, but
> > we need two iterations if start == 0xfff.
>
> Yes, tricky. We could do something like
> for (cur = start & TARGET_PAGE_MASK; cur < length; cur += TARGET_PAGE_SIZE) {
> but I'll send a new patch with just s/<=/</.
That's broken too.
I have:
uint8_t *p;
ram_addr_t addr, end;
- end = start + length;
+ end = (start + length - 1) | (TARGET_PAGE_SIZE - 1);
+ start &= TARGET_PAGE_MASK;
p = ram_list.phys_dirty + (start >> TARGET_PAGE_BITS);
for (addr = start; addr <= end; addr += TARGET_PAGE_SIZE) {
*p++ |= dirty_flags;
@@ -98,7 +99,8 @@ static inline void
cpu_physical_memory_mask_dirty_range(ram_addr_t start,
uint8_t *p;
ram_addr_t addr, end;
- end = start + length;
+ end = (start + length - 1) | (TARGET_PAGE_SIZE - 1);
+ start &= TARGET_PAGE_MASK;
mask = ~dirty_flags;
p = ram_list.phys_dirty + (start >> TARGET_PAGE_BITS);
for (addr = start; addr <= end; addr += TARGET_PAGE_SIZE) {
And a non-terminating migration - not sure if this is the cause.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2012-01-29 13:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-28 18:13 [Qemu-devel] [PATCH] exec-obsolete: fix length handling Blue Swirl
2012-01-29 10:22 ` Avi Kivity
2012-01-29 11:37 ` Blue Swirl
2012-01-29 11:53 ` Avi Kivity
2012-01-29 12:08 ` Avi Kivity
2012-01-29 13:16 ` Blue Swirl
2012-01-29 13:20 ` Avi Kivity [this message]
2012-01-29 13:39 ` Blue Swirl
2012-01-29 14:21 ` Avi Kivity
-- strict thread matches above, loose matches on Subject: below --
2012-01-29 13:17 Blue Swirl
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=4F254786.6070903@redhat.com \
--to=avi@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanb@linux.vnet.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.