From: Olaf Hering <olaf@aepfle.de>
To: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Cc: xen-devel@lists.xensource.com, ian.campbell@citrix.com,
andres@gridcentric.ca, tim@xen.org, keir.xen@gmail.com,
JBeulich@suse.com, ian.jackson@citrix.com, adin@gridcentric.ca
Subject: Re: [PATCH 2 of 5] Improve ring management for memory events. Do not lose guest events
Date: Thu, 1 Dec 2011 15:51:03 +0100 [thread overview]
Message-ID: <20111201145103.GA13045@aepfle.de> (raw)
In-Reply-To: <43dc614d543cdf84189d.1322603711@xdev.gridcentric.ca>
On Tue, Nov 29, Andres Lagar-Cavilla wrote:
> @@ -133,31 +185,95 @@ static int mem_event_disable(struct mem_
> return 0;
> }
>
> -void mem_event_put_request(struct domain *d, struct mem_event_domain *med, mem_event_request_t *req)
> +static inline int mem_event_ring_free(struct domain *d, struct mem_event_domain *med)
> {
> + int free_requests;
> +
> + free_requests = RING_FREE_REQUESTS(&med->front_ring);
> + if ( unlikely(free_requests < d->max_vcpus) )
> + {
> + /* This may happen during normal operation (hopefully not often). */
> + gdprintk(XENLOG_INFO, "mem_event request slots for domain %d: %d\n",
> + d->domain_id, free_requests);
> + }
> +
> + return free_requests;
> +}
> +
> +/* Return values
> + * zero: success
> + * -ENOSYS: no ring
> + * -EAGAIN: ring is full and the event has not been transmitted.
> + * Only foreign vcpu's get EAGAIN
> + * -EBUSY: guest vcpu has been paused due to ring congestion
> + */
> +int mem_event_put_request(struct domain *d, struct mem_event_domain *med, mem_event_request_t *req)
> +{
> + int ret = 0;
> + int foreign = (d != current->domain);
> + /*
> + * We ensure that each vcpu can put at least *one* event -- because some
> + * events are not repeatable, such as dropping a page. This will ensure no
> + * vCPU is left with an event that they must place on the ring, but cannot.
> + * They will be paused after the event is placed.
> + * See large comment below in mem_event_unpause_vcpus().
> + */
> + if ( !foreign && mem_event_ring_free(d, med) < d->max_vcpus )
> + {
> + mem_event_mark_and_pause(current, med);
> + ret = -EBUSY;
> + }
>
> mem_event_ring_unlock(med);
>
> notify_via_xen_event_channel(d, med->xen_port);
> +
> + return ret;
What will happen if the guest has more vcpus than r->nr_ents in the ring
buffer? To me it looks like no event can be placed into the ring and
-EBUSY is returned instead.
Olaf
next prev parent reply other threads:[~2011-12-01 14:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-29 21:55 [PATCH 0 of 5] Memory event interface improvements Andres Lagar-Cavilla
2011-11-29 21:55 ` [PATCH 1 of 5] Allow decrease_reservation to be preempted if remove_page returns negative Andres Lagar-Cavilla
2011-11-29 21:55 ` [PATCH 2 of 5] Improve ring management for memory events. Do not lose guest events Andres Lagar-Cavilla
2011-11-30 12:58 ` Olaf Hering
2011-11-30 15:11 ` Andres Lagar-Cavilla
2011-12-01 15:36 ` Olaf Hering
2011-12-01 14:51 ` Olaf Hering [this message]
2011-12-01 15:25 ` Andres Lagar-Cavilla
2011-12-05 11:23 ` Olaf Hering
2011-12-05 15:27 ` Andres Lagar-Cavilla
2011-12-01 18:10 ` Tim Deegan
2011-12-01 10:19 ` Keir Fraser
2011-12-01 18:27 ` Andres Lagar-Cavilla
2011-12-01 18:23 ` Andres Lagar-Cavilla
2011-11-29 21:55 ` [PATCH 3 of 5] Create a generic callback mechanism for Xen-bound event channels Andres Lagar-Cavilla
2011-11-29 21:55 ` [PATCH 4 of 5] Make the prototype of p2m_mem_access_resume consistent Andres Lagar-Cavilla
2011-12-01 18:01 ` Tim Deegan
2011-12-01 18:05 ` Andres Lagar-Cavilla
2011-11-29 21:55 ` [PATCH 5 of 5] Allow memevent responses to be signaled via the event channel Andres Lagar-Cavilla
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=20111201145103.GA13045@aepfle.de \
--to=olaf@aepfle.de \
--cc=JBeulich@suse.com \
--cc=adin@gridcentric.ca \
--cc=andres@gridcentric.ca \
--cc=andres@lagarcavilla.org \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@citrix.com \
--cc=keir.xen@gmail.com \
--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 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.