From: "Jan Beulich" <JBeulich@novell.com>
To: Olaf Hering <olaf@aepfle.de>
Cc: xen-devel@lists.xensource.com
Subject: Re: [PATCH 12/17] xenpaging: handle HVMCOPY_gfn_paged_out in copy_from/to_user
Date: Tue, 07 Dec 2010 09:27:05 +0000 [thread overview]
Message-ID: <4CFE0BF90200007800026536@vpn.id2.novell.com> (raw)
In-Reply-To: <20101206205912.343173055@aepfle.de>
>>> On 06.12.10 at 21:59, Olaf Hering <olaf@aepfle.de> wrote:
> --- xen-unstable.hg-4.1.22459.orig/xen/arch/x86/mm/guest_walk.c
> +++ xen-unstable.hg-4.1.22459/xen/arch/x86/mm/guest_walk.c
> @@ -93,11 +93,12 @@ static inline void *map_domain_gfn(struc
> uint32_t *rc)
> {
> /* Translate the gfn, unsharing if shared */
> +retry:
> *mfn = gfn_to_mfn_unshare(p2m, gfn_x(gfn), p2mt, 0);
> if ( p2m_is_paging(*p2mt) )
> {
> - p2m_mem_paging_populate(p2m, gfn_x(gfn));
> -
> + if ( p2m_mem_paging_populate(p2m, gfn_x(gfn)) )
> + goto retry;
> *rc = _PAGE_PAGED;
> return NULL;
> }
Is this retry loop (and similar ones later in the patch) guaranteed
to be bounded in some way?
> --- xen-unstable.hg-4.1.22459.orig/xen/arch/x86/mm/p2m.c
> +++ xen-unstable.hg-4.1.22459/xen/arch/x86/mm/p2m.c
> @@ -2805,13 +2806,13 @@ void p2m_mem_paging_populate(struct p2m_
> /* Pause domain */
> if ( v->domain->domain_id == d->domain_id )
> {
> - vcpu_pause_nosync(v);
> req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED;
> + ret = 1;
> }
> else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged )
> {
> /* gfn is already on its way back and vcpu is not paused */
> - return;
> + goto populate_out;
Do you really need a goto here (i.e. are you foreseeing to get stuff
added between the label and the return below)?
> }
>
> /* Send request to pager */
> @@ -2820,6 +2821,14 @@ void p2m_mem_paging_populate(struct p2m_
> req.vcpu_id = v->vcpu_id;
>
> mem_event_put_request(d, &req);
> +
> + if ( req.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
> + {
> + wait_event(d->wq, mfn_valid(gfn_to_mfn(p2m, gfn, &p2mt)) && !p2m_is_paging(p2mt));
> + }
> +
> +populate_out:
> + return ret;
> }
>
> int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn)
> --- xen-unstable.hg-4.1.22459.orig/xen/include/asm-x86/p2m.h
> +++ xen-unstable.hg-4.1.22459/xen/include/asm-x86/p2m.h
> @@ -474,7 +474,8 @@ int p2m_mem_paging_evict(struct p2m_doma
> /* Tell xenpaging to drop a paged out frame */
> void p2m_mem_paging_drop_page(struct p2m_domain *p2m, unsigned long gfn);
> /* Start populating a paged out frame */
> -void p2m_mem_paging_populate(struct p2m_domain *p2m, unsigned long gfn);
> +/* retval 1 means the page is present on return */
> +int p2m_mem_paging_populate(struct p2m_domain *p2m, unsigned long gfn);
Isn't this a case where you absolutely need the return value checked?
If so, you will want to add __must_check here.
Jan
next prev parent reply other threads:[~2010-12-07 9:27 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-06 20:59 [PATCH 00/17] xenpaging changes for xen-unstable Olaf Hering
2010-12-06 20:59 ` [PATCH 01/17] xenpaging: close xch handle in xenpaging_init error path Olaf Hering
2010-12-14 18:52 ` Ian Jackson
2010-12-06 20:59 ` [PATCH 02/17] xenpaging: remove perror usage " Olaf Hering
2010-12-06 20:59 ` [PATCH 03/17] xenpaging: print DPRINTF ouput if XENPAGING_DEBUG is in environment Olaf Hering
2010-12-06 20:59 ` [PATCH 04/17] xenpaging: print number of evicted pages Olaf Hering
2010-12-06 20:59 ` [PATCH 05/17] xenpaging: remove duplicate xc_interface_close call Olaf Hering
2010-12-06 20:59 ` [PATCH 06/17] xenpaging: do not use DPRINTF/ERROR if xch handle is unavailable Olaf Hering
2010-12-06 20:59 ` [PATCH 07/17] xenpaging: update xch usage Olaf Hering
2010-12-06 20:59 ` [PATCH 08/17] xenpaging: make vcpu_sleep_nosync() optional in mem_event_check_ring() Olaf Hering
2010-12-06 20:59 ` [PATCH 09/17] xenpaging: update machine_to_phys_mapping[] during page deallocation Olaf Hering
2010-12-06 20:59 ` [PATCH 10/17] xenpaging: update machine_to_phys_mapping[] during page-in Olaf Hering
2010-12-14 22:58 ` Olaf Hering
2010-12-15 10:47 ` Tim Deegan
2010-12-06 20:59 ` [PATCH 11/17] xenpaging: drop paged pages in guest_remove_page Olaf Hering
2010-12-06 20:59 ` [PATCH 12/17] xenpaging: handle HVMCOPY_gfn_paged_out in copy_from/to_user Olaf Hering
2010-12-07 9:27 ` Jan Beulich [this message]
2010-12-07 9:45 ` Olaf Hering
2010-12-15 11:35 ` Keir Fraser
2010-12-15 13:51 ` Olaf Hering
2010-12-15 14:08 ` Keir Fraser
2010-12-06 20:59 ` [PATCH 13/17] xenpaging: page only pagetables for debugging Olaf Hering
2010-12-06 20:59 ` [PATCH 14/17] xenpaging: prevent page-out of first 16MB Olaf Hering
2010-12-06 20:59 ` [PATCH 15/17] xenpaging: start xenpaging via config option Olaf Hering
2010-12-06 20:59 ` [PATCH 16/17] xenpaging: add dynamic startup delay for xenpaging Olaf Hering
2010-12-06 20:59 ` [PATCH 17/17] xenpaging: (sparse) documenation Olaf Hering
2010-12-06 21:16 ` [PATCH 00/17] xenpaging changes for xen-unstable Olaf Hering
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=4CFE0BF90200007800026536@vpn.id2.novell.com \
--to=jbeulich@novell.com \
--cc=olaf@aepfle.de \
--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).