From: "James Harper" <james.harper@bendigoit.com.au>
To: Keir Fraser <keir.xen@gmail.com>, Tim Deegan <Tim.Deegan@citrix.com>
Cc: xen-devel@lists.xensource.com
Subject: RE: slow xp hibernation revisited
Date: Sat, 4 Jun 2011 18:05:57 +1000 [thread overview]
Message-ID: <AEC6C66638C05B468B556EA548C1A77D01D57761@trantor> (raw)
In-Reply-To: <CA0FA2A9.1B9B2%keir.xen@gmail.com>
>
> On 04/06/2011 08:38, "James Harper" <james.harper@bendigoit.com.au>
wrote:
>
> > Looking past the test_bit call, the next statement does another test
and
> > sets last_address_index to 0 and returns NULL. Is this just to
ensure
> > that the next access isn't just trivially accepted?
>
> Yes, first test is on a potentially stale bucket. Second test is on a
fresh
> bucket.
>
How about the following patch? Is munmap the correct way to unmap or is
an IOCTL required too?
The exit condition is what would happen anyway after the remap is done
and the page is still invalid.
diff --git a/hw/xen_machine_fv.c b/hw/xen_machine_fv.c
index d02e23f..1ff80bb 100644
--- a/hw/xen_machine_fv.c
+++ b/hw/xen_machine_fv.c
@@ -151,6 +151,24 @@ uint8_t *qemu_map_cache(target_phys_addr_t
phys_addr, uint8_t lock)
pentry->next = entry;
qemu_remap_bucket(entry, address_index);
} else if (!entry->lock) {
+ if (entry->vaddr_base && entry->paddr_index == address_index &&
!test_bit(address_offset>>XC_PAGE_SHIFT, entry->valid_mapping))
+ {
+ /* The page was invalid previously. Test if it is valid now
and only remap if so */
+ xen_pfn_t pfn;
+ int err;
+ void *tmp_vaddr;
+
+ pfn = phys_addr >> XC_PAGE_SHIFT;
+ tmp_vaddr = xc_map_foreign_bulk(xc_handle, domid,
PROT_READ|PROT_WRITE, &pfn, &err, 1);
+ if (tmp_vaddr)
+ munmap(tmp_vaddr, PAGE_SIZE);
+
+ if (!tmp_vaddr || err)
+ {
+ last_address_index = ~0UL;
+ return NULL;
+ }
+ }
if (!entry->vaddr_base || entry->paddr_index != address_index
|| !test_bit(address_offset>>XC_PAGE_SHIFT, entry->valid_mapping))
qemu_remap_bucket(entry, address_index);
}
next prev parent reply other threads:[~2011-06-04 8:05 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-03 15:34 slow xp hibernation revisited James Harper
2011-06-03 15:43 ` Tim Deegan
2011-06-04 3:16 ` James Harper
2011-06-04 4:46 ` James Harper
2011-06-04 4:54 ` James Harper
2011-06-04 6:39 ` Keir Fraser
2011-06-04 7:38 ` James Harper
2011-06-04 7:51 ` Keir Fraser
2011-06-04 8:05 ` James Harper [this message]
2011-06-04 8:30 ` Keir Fraser
2011-06-06 13:58 ` Stefano Stabellini
2011-06-21 17:05 ` Ian Jackson
2011-06-21 18:00 ` Stefano Stabellini
2011-06-04 8:33 ` Keir Fraser
2011-06-06 13:09 ` Stefano Stabellini
2011-06-06 13:26 ` James Harper
2011-06-06 13:29 ` James Harper
2011-06-06 13:38 ` Stefano Stabellini
2011-06-06 13:35 ` Stefano Stabellini
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=AEC6C66638C05B468B556EA548C1A77D01D57761@trantor \
--to=james.harper@bendigoit.com.au \
--cc=Tim.Deegan@citrix.com \
--cc=keir.xen@gmail.com \
--cc=xen-devel@lists.xensource.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).