All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
	Jan Beulich <JBeulich@suse.com>, Tim Deegan <tim@xen.org>
Cc: xen-devel@lists.xenproject.org
Subject: Re: [PATCH v5 2/4] xen/shadow: fix shadow_track_dirty_vram to work on hvm guests
Date: Mon, 11 May 2015 15:46:16 +0200	[thread overview]
Message-ID: <5550B2A8.30906@citrix.com> (raw)
In-Reply-To: <554CD79A.4060707@citrix.com>

El 08/05/15 a les 17.34, Andrew Cooper ha escrit:
> On 08/05/15 16:28, Jan Beulich wrote:
>>>>> On 08.05.15 at 16:34, <roger.pau@citrix.com> wrote:
>>> @@ -3668,21 +3671,19 @@ int shadow_track_dirty_vram(struct domain *d,
>>>          if ( map_sl1p )
>>>              sh_unmap_domain_page(map_sl1p);
>>>  
>>> -        rc = -EFAULT;
>>> -        if ( copy_to_guest(dirty_bitmap, dirty_vram->dirty_bitmap, dirty_size) == 0 ) {
>>> -            memset(dirty_vram->dirty_bitmap, 0, dirty_size);
>>> -            if (dirty_vram->last_dirty + SECONDS(2) < NOW())
>>> +        memcpy(dirty_bitmap, dirty_vram->dirty_bitmap, dirty_size);
>>> +        memset(dirty_vram->dirty_bitmap, 0, dirty_size);
>> This is certainly a behavioral change; I'm only uncertain whether it's
>> acceptable. Previously the memset() was done only when the copying
>> to guest memory succeeded, while now it happens unconditionally.
> 
> On the one hand, if the toolstack logdirty buffer suffers an EFAULT,
> most bets are probably off.
> 
> However, it would better if Xen didn't then clobber the dirty bitmap, in
> case the toolstack's kernel is doing some particularly funky memory
> management which would succeed on a retry.

A possible workaround to this would be to do acquire the paging_lock
again if copy_to_guest fails and set the dirty_bitmap to 0xff, although
it's not very elegant. Or do an OR of dirty_bitmap and
dirty_vram->dirty_bitmap.

Roger.

  reply	other threads:[~2015-05-11 13:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-08 14:34 [PATCH v5 0/4] xen/pvh: enable migration on PVH Dom0 Roger Pau Monne
2015-05-08 14:34 ` [PATCH v5 1/4] xen: introduce a helper to allocate non-contiguous memory Roger Pau Monne
2015-05-08 14:50   ` Andrew Cooper
2015-05-08 15:08     ` Jan Beulich
2015-05-08 15:25   ` Jan Beulich
2015-05-11  7:42   ` Jan Beulich
2015-05-11  9:52     ` Roger Pau Monné
2015-05-11 10:41       ` Jan Beulich
2015-05-11 12:11         ` Roger Pau Monné
2015-05-11 13:19           ` Jan Beulich
2015-05-08 14:34 ` [PATCH v5 2/4] xen/shadow: fix shadow_track_dirty_vram to work on hvm guests Roger Pau Monne
2015-05-08 15:28   ` Jan Beulich
2015-05-08 15:34     ` Andrew Cooper
2015-05-11 13:46       ` Roger Pau Monné [this message]
2015-05-11 13:51         ` Tim Deegan
2015-05-08 14:34 ` [PATCH v5 3/4] xen/hap: make hap_track_dirty_vram use non-contiguous memory for temporary map Roger Pau Monne
2015-05-08 14:34 ` [PATCH v5 4/4] xen: rework paging_log_dirty_op to work with hvm guests Roger Pau Monne

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=5550B2A8.30906@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /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.