From: Olaf Hering <olaf@aepfle.de>
To: Keir Fraser <keir@xen.org>
Cc: xen-devel@lists.xensource.com, Jan Beulich <JBeulich@novell.com>
Subject: Re: Re: how to handle paged hypercall args?
Date: Thu, 2 Dec 2010 11:11:22 +0100 [thread overview]
Message-ID: <20101202101122.GA30374@aepfle.de> (raw)
In-Reply-To: <C90ACD8F.A6E9%keir@xen.org>
On Thu, Nov 18, Keir Fraser wrote:
> I've done something along these lines now as xen-unstable:22402. It actually
> seems to work okay! So you can go ahead and use waitqueues in __hvm_copy()
> now.
This is my first attempt to do it.
It crashed Xen on the very first try in a spectacular way. But it
happend only once for some reason.
See my other mail.
Olaf
--- xen-unstable.hg-4.1.22447.orig/xen/arch/x86/hvm/hvm.c
+++ xen-unstable.hg-4.1.22447/xen/arch/x86/hvm/hvm.c
@@ -1986,69 +1986,117 @@ static enum hvm_copy_result __hvm_copy(
enum hvm_copy_result hvm_copy_to_guest_phys(
paddr_t paddr, void *buf, int size)
{
- return __hvm_copy(buf, paddr, size,
+ enum hvm_copy_result res;
+ struct waitqueue_head wq;
+ init_waitqueue_head(&wq);
+
+ wait_event(wq, (
+ res = __hvm_copy(buf, paddr, size,
HVMCOPY_to_guest | HVMCOPY_fault | HVMCOPY_phys,
- 0);
+ 0)) != HVMCOPY_gfn_paged_out);
+ return res;
}
enum hvm_copy_result hvm_copy_from_guest_phys(
void *buf, paddr_t paddr, int size)
{
- return __hvm_copy(buf, paddr, size,
+ enum hvm_copy_result res;
+ struct waitqueue_head wq;
+ init_waitqueue_head(&wq);
+
+ wait_event(wq, (
+ res = __hvm_copy(buf, paddr, size,
HVMCOPY_from_guest | HVMCOPY_fault | HVMCOPY_phys,
- 0);
+ 0)) != HVMCOPY_gfn_paged_out);
+ return res;
}
enum hvm_copy_result hvm_copy_to_guest_virt(
unsigned long vaddr, void *buf, int size, uint32_t pfec)
{
- return __hvm_copy(buf, vaddr, size,
+ enum hvm_copy_result res;
+ struct waitqueue_head wq;
+ init_waitqueue_head(&wq);
+
+ wait_event(wq, (
+ res = __hvm_copy(buf, vaddr, size,
HVMCOPY_to_guest | HVMCOPY_fault | HVMCOPY_virt,
- PFEC_page_present | PFEC_write_access | pfec);
+ PFEC_page_present | PFEC_write_access | pfec)) != HVMCOPY_gfn_paged_out);
+ return res;
}
enum hvm_copy_result hvm_copy_from_guest_virt(
void *buf, unsigned long vaddr, int size, uint32_t pfec)
{
- return __hvm_copy(buf, vaddr, size,
+ enum hvm_copy_result res;
+ struct waitqueue_head wq;
+ init_waitqueue_head(&wq);
+
+ wait_event(wq, (
+ res = __hvm_copy(buf, vaddr, size,
HVMCOPY_from_guest | HVMCOPY_fault | HVMCOPY_virt,
- PFEC_page_present | pfec);
+ PFEC_page_present | pfec)) != HVMCOPY_gfn_paged_out);
+ return res;
}
enum hvm_copy_result hvm_fetch_from_guest_virt(
void *buf, unsigned long vaddr, int size, uint32_t pfec)
{
+ enum hvm_copy_result res;
+ struct waitqueue_head wq;
if ( hvm_nx_enabled(current) )
pfec |= PFEC_insn_fetch;
- return __hvm_copy(buf, vaddr, size,
+ init_waitqueue_head(&wq);
+
+ wait_event(wq, (
+ res = __hvm_copy(buf, vaddr, size,
HVMCOPY_from_guest | HVMCOPY_fault | HVMCOPY_virt,
- PFEC_page_present | pfec);
+ PFEC_page_present | pfec)) != HVMCOPY_gfn_paged_out);
+ return res;
}
enum hvm_copy_result hvm_copy_to_guest_virt_nofault(
unsigned long vaddr, void *buf, int size, uint32_t pfec)
{
- return __hvm_copy(buf, vaddr, size,
+ enum hvm_copy_result res;
+ struct waitqueue_head wq;
+ init_waitqueue_head(&wq);
+
+ wait_event(wq, (
+ res = __hvm_copy(buf, vaddr, size,
HVMCOPY_to_guest | HVMCOPY_no_fault | HVMCOPY_virt,
- PFEC_page_present | PFEC_write_access | pfec);
+ PFEC_page_present | PFEC_write_access | pfec)) != HVMCOPY_gfn_paged_out);
+ return res;
}
enum hvm_copy_result hvm_copy_from_guest_virt_nofault(
void *buf, unsigned long vaddr, int size, uint32_t pfec)
{
- return __hvm_copy(buf, vaddr, size,
+ enum hvm_copy_result res;
+ struct waitqueue_head wq;
+ init_waitqueue_head(&wq);
+
+ wait_event(wq, (
+ res = __hvm_copy(buf, vaddr, size,
HVMCOPY_from_guest | HVMCOPY_no_fault | HVMCOPY_virt,
- PFEC_page_present | pfec);
+ PFEC_page_present | pfec)) != HVMCOPY_gfn_paged_out);
+ return res;
}
enum hvm_copy_result hvm_fetch_from_guest_virt_nofault(
void *buf, unsigned long vaddr, int size, uint32_t pfec)
{
+ enum hvm_copy_result res;
+ struct waitqueue_head wq;
if ( hvm_nx_enabled(current) )
pfec |= PFEC_insn_fetch;
- return __hvm_copy(buf, vaddr, size,
+ init_waitqueue_head(&wq);
+
+ wait_event(wq, (
+ res = __hvm_copy(buf, vaddr, size,
HVMCOPY_from_guest | HVMCOPY_no_fault | HVMCOPY_virt,
- PFEC_page_present | pfec);
+ PFEC_page_present | pfec)) != HVMCOPY_gfn_paged_out);
+ return res;
}
unsigned long copy_to_user_hvm(void *to, const void *from, unsigned int len)
next prev parent reply other threads:[~2010-12-02 10:11 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-10 8:58 how to handle paged hypercall args? Olaf Hering
2010-11-11 14:33 ` Olaf Hering
2010-11-11 20:08 ` Keir Fraser
2010-11-11 20:34 ` Olaf Hering
2010-11-11 21:00 ` Keir Fraser
2010-11-12 9:45 ` Jan Beulich
2010-11-12 10:22 ` Keir Fraser
2010-11-12 10:47 ` Jan Beulich
2010-11-12 14:32 ` Keir Fraser
2010-11-15 13:12 ` Olaf Hering
2010-11-17 16:52 ` Keir Fraser
2010-11-18 12:33 ` Keir Fraser
2010-11-18 13:51 ` Olaf Hering
2010-12-02 10:11 ` Olaf Hering [this message]
2010-12-02 10:22 ` Keir Fraser
2010-12-02 10:30 ` Keir Fraser
2010-12-03 9:14 ` Olaf Hering
2010-12-03 14:37 ` Keir Fraser
2010-12-02 10:25 ` Jan Beulich
2010-12-03 9:06 ` Olaf Hering
2010-12-03 14:18 ` Keir Fraser
2010-12-02 10:18 ` Olaf Hering
2010-12-02 10:25 ` Keir Fraser
2010-12-07 9:25 ` Olaf Hering
2010-12-07 16:45 ` Keir Fraser
2010-12-07 17:16 ` Olaf Hering
2010-12-07 18:08 ` Keir Fraser
2010-12-07 18:50 ` Olaf Hering
2010-11-15 9:37 ` Tim Deegan
2010-11-15 9:53 ` Jan Beulich
2010-11-15 10:09 ` Keir Fraser
2010-11-15 10:20 ` Tim Deegan
2010-11-15 10:33 ` Keir Fraser
2010-11-15 10:49 ` Tim Deegan
2010-11-15 11:55 ` Keir Fraser
2010-11-15 12:04 ` Tim Deegan
2010-11-15 12:17 ` Keir Fraser
2010-12-03 9:03 ` Olaf Hering
2010-12-03 14:13 ` Keir Fraser
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=20101202101122.GA30374@aepfle.de \
--to=olaf@aepfle.de \
--cc=JBeulich@novell.com \
--cc=keir@xen.org \
--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 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.