xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Olaf Hering <olaf@aepfle.de>
To: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Cc: andres@gridcentric.ca, xen-devel@lists.xensource.com,
	tim@xen.org, adin@gridcentric.ca
Subject: Re: [PATCH] x86/mm: Improve ring management for memory events. Do not lose guest events
Date: Fri, 13 Jan 2012 10:50:22 +0100	[thread overview]
Message-ID: <20120113095022.GA18130@aepfle.de> (raw)
In-Reply-To: <a85e7d46401b1d419629.1326306504@xdev.gridcentric.ca>

On Wed, Jan 11, Andres Lagar-Cavilla wrote:

A few comments:

> -static int mem_event_disable(struct mem_event_domain *med)
> +static int mem_event_ring_available(struct mem_event_domain *med)
>  {
> -    unmap_domain_page(med->ring_page);
> -    med->ring_page = NULL;
> +    int avail_req = RING_FREE_REQUESTS(&med->front_ring);
> +    avail_req -= med->target_producers;
> +    avail_req -= med->foreign_producers;
>  
> -    unmap_domain_page(med->shared_page);
> -    med->shared_page = NULL;
> +    BUG_ON(avail_req < 0);
> +
> +    return avail_req;
> +}
> +

mem_event_ring_available() should return unsigned since the values it
provides can only be positive. The function itself enforces this.

> -void p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn)
> +int p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn)
>  {
> -    struct vcpu *v = current;
>      mem_event_request_t req;
>  
> -    /* Check that there's space on the ring for this request */
> -    if ( mem_event_check_ring(d, &d->mem_event->paging) == 0)
> -    {
> -        /* Send release notification to pager */
> -        memset(&req, 0, sizeof(req));
> -        req.flags |= MEM_EVENT_FLAG_DROP_PAGE;
> -        req.gfn = gfn;
> -        req.vcpu_id = v->vcpu_id;
> +    /* We allow no ring in this unique case, because it won't affect
> +     * correctness of the guest execution at this point.  If this is the only
> +     * page that happens to be paged-out, we'll be okay..  but it's likely the
> +     * guest will crash shortly anyways. */
> +    int rc = mem_event_claim_slot(d, &d->mem_event->paging);
> +    if ( rc < 0 )
> +        return rc;
>  
> -        mem_event_put_request(d, &d->mem_event->paging, &req);
> -    }
> +    /* Send release notification to pager */
> +    memset(&req, 0, sizeof(req));
> +    req.type = MEM_EVENT_TYPE_PAGING;
> +    req.gfn = gfn;
> +    req.flags = MEM_EVENT_FLAG_DROP_PAGE;
> +
> +    mem_event_put_request(d, &d->mem_event->paging, &req);
> +    return 0;
>  }

p2m_mem_paging_drop_page() should remain void because the caller has
already done its work, making it not restartable. Also it is only called
when a gfn is in paging state, which I'm sure can not happen without a
ring.

And quilt says:
Warning: trailing whitespace in lines 167,254 of xen/arch/x86/mm/mem_event.c
Warning: trailing whitespace in line 168 of xen/common/memory.c
Warning: trailing whitespace in line 1127 of xen/arch/x86/mm/p2m.c


Olaf

  parent reply	other threads:[~2012-01-13  9:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-11 18:28 [PATCH] x86/mm: Improve ring management for memory events. Do not lose guest events Andres Lagar-Cavilla
2012-01-12 11:56 ` Tim Deegan
2012-01-12 16:05   ` Andres Lagar-Cavilla
2012-01-13  9:50 ` Olaf Hering [this message]
2012-01-13 15:14   ` Andres Lagar-Cavilla
2012-01-13 19:57     ` Olaf Hering
2012-01-13 20:05       ` Andres Lagar-Cavilla
2012-01-16 15:08         ` Olaf Hering
2012-01-16 16:22           ` Olaf Hering
2012-01-16 15:04 ` Olaf Hering
2012-01-16 15:08   ` Andres Lagar-Cavilla
2012-01-16 15:10 ` Olaf Hering
2012-01-16 15:22 ` Olaf Hering
  -- strict thread matches above, loose matches on Subject: below --
2012-01-16 15:39 Andres Lagar-Cavilla
2012-01-16 15:41 ` Olaf Hering
2012-01-19 10:39 ` Tim Deegan

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=20120113095022.GA18130@aepfle.de \
    --to=olaf@aepfle.de \
    --cc=adin@gridcentric.ca \
    --cc=andres@gridcentric.ca \
    --cc=andres@lagarcavilla.org \
    --cc=tim@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 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).