xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: Tamas K Lengyel <tlengyel@novetta.com>,
	xen-devel@lists.xenproject.org,
	Razvan Cojocaru <rcojocaru@bitdefender.com>
Cc: Wei Liu <wei.liu2@citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: Re: [PATCH] vm_event: Fix regression caused by b701ccc8
Date: Mon, 8 Feb 2016 09:39:57 +0000	[thread overview]
Message-ID: <1454924397.8672.110.camel@citrix.com> (raw)
In-Reply-To: <1454707216-13471-1-git-send-email-tlengyel@novetta.com>

On Fri, 2016-02-05 at 14:20 -0700, Tamas K Lengyel wrote:
> When xc_map_foreign_batch got deprecated reinitializing vm_event on a domain
> where an event listener was previously active broke as it relied on the flag
> XEN_DOMCTL_PFINFO_XTAB to indicate that the magic page is not in the physmap.
> Manually check the gpfn type, add it to the physmap if needed, and only then
> try to map it.
> 
> Signed-off-by: Tamas K Lengyel <tlengyel@novetta.com>
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> Cc: Wei Liu <wei.liu2@citrix.com>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>

Sorry for the breakage!

Acked-by: Ian Campbell <ian.campbell@citrix.com>

> ---
>  tools/libxc/xc_vm_event.c | 21 ++++++++++-----------
>  1 file changed, 10 insertions(+), 11 deletions(-)
> 
> diff --git a/tools/libxc/xc_vm_event.c b/tools/libxc/xc_vm_event.c
> index 57abce0..443c73b 100644
> --- a/tools/libxc/xc_vm_event.c
> +++ b/tools/libxc/xc_vm_event.c
> @@ -72,11 +72,10 @@ void *xc_vm_event_enable(xc_interface *xch, domid_t
> domain_id, int param,
>  
>      ring_pfn = pfn;
>      mmap_pfn = pfn;
> -    ring_page = xc_map_foreign_pages(xch, domain_id, PROT_READ |
> PROT_WRITE,
> -                                     &mmap_pfn, 1);
> -    if ( !ring_page )
> +    rc1 = xc_get_pfn_type_batch(xch, domain_id, 1, &mmap_pfn);
> +    if ( rc1 || mmap_pfn & XEN_DOMCTL_PFINFO_XTAB )
>      {
> -        /* Map failed, populate ring page */
> +        /* Page not in the physmap, try to populate it */
>          rc1 = xc_domain_populate_physmap_exact(xch, domain_id, 1, 0, 0,
>                                                &ring_pfn);
>          if ( rc1 != 0 )
> @@ -84,15 +83,15 @@ void *xc_vm_event_enable(xc_interface *xch, domid_t
> domain_id, int param,
>              PERROR("Failed to populate ring pfn\n");
>              goto out;
>          }
> +    }
>  
> -        mmap_pfn = ring_pfn;
> -        ring_page = xc_map_foreign_pages(xch, domain_id, PROT_READ |
> PROT_WRITE,
> +    mmap_pfn = ring_pfn;
> +    ring_page = xc_map_foreign_pages(xch, domain_id, PROT_READ |
> PROT_WRITE,
>                                           &mmap_pfn, 1);
> -        if ( !ring_page )
> -        {
> -            PERROR("Could not map the ring page\n");
> -            goto out;
> -        }
> +    if ( !ring_page )
> +    {
> +        PERROR("Could not map the ring page\n");
> +        goto out;
>      }
>  
>      switch ( param )
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-02-08  9:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-05 21:20 [PATCH] vm_event: Fix regression caused by b701ccc8 Tamas K Lengyel
2016-02-08  9:39 ` Ian Campbell [this message]
2016-02-08 15:46   ` Ian Campbell

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=1454924397.8672.110.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=rcojocaru@bitdefender.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tlengyel@novetta.com \
    --cc=wei.liu2@citrix.com \
    --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 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).