xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: Keir Fraser <keir@xen.org>,
	David Vrabel <david.vrabel@citrix.com>,
	xen-devel@lists.xen.org
Subject: Re: [PATCH 8/8] evtchn: add FIFO-based event channel hypercalls and port ops
Date: Mon, 19 Aug 2013 11:32:29 +0100	[thread overview]
Message-ID: <5211F43D.8010800@citrix.com> (raw)
In-Reply-To: <20130816163322.GB12674@zion.uk.xensource.com>

Can you trim your replies?  There's no need to quote the whole patch.

On 16/08/13 17:33, Wei Liu wrote:
>> +    evtchn_fifo_destroy(d);
>> +
> 
> Don't need to put this inside event_lock critical region?

No, but it does need to be reordered to be after freeing all the event
channel buckets.

>> +static int setup_event_array(struct domain *d)
>> +{
>> +    if ( d->evtchn_fifo )
>> +        return 0;
>> +
>> +    d->evtchn_fifo = xzalloc(struct evtchn_fifo_domain);
> 
> struct evtchn_fifo_domain is very big because it contains event_array
> which has 1024 elements, however most domains will not use all 2^17
> ports. Could you add in dynamically allocation for event_array?

It has

   2^17 / (PAGE_SIZE / sizeof(event_word_t))
=  131072 / (4096 / 4)
=  128 entries.

So sizeof(struct evtchn_fifo_domain) == 2052 bytes (so 1 page).

Would realloc'ing this as the number of event channels grows actually
save a useful amount of memory?

>> +/*
>> + * Some ports may already be bound, bind them to the correct VCPU so
>> + * they have a valid queue.
>> + *
>> + * Note: any events that are currently pending will not be resent and
>> + * will be lost.
>> + */
> 
> Can this be fixed? I presume you can check the state of the port and set
> it to pending in the new ABI when necessary? As you've got hold of the
> event lock at this stage it should be easy to synchronize the state?

Why?  Guests should setup the ABI before binding any events if they
don't want to risk losing any.

>> +static void cleanup_event_array(struct domain *d)
>> +{
>> +    unsigned i;
>> +
>> +    if ( d->evtchn_fifo == NULL )
>> +        return;
>> +
>> +    for ( i = 0; i < EVTCHN_FIFO_MAX_EVENT_ARRAY_PAGES; i++ )
>> +    {
>> +        unmap_guest_page(d->evtchn_fifo->event_array[i].page,
>> +                         d->evtchn_fifo->event_array[i].virt);
> 
> Suggest reset page and virt to NULL / 0, just like you did for 
> cleanup_control_block.

Why? d->evtchn_fifo is about to be freed.

>> +    }
>> +    xfree(d->evtchn_fifo);
> 
> Same for evtchn_fifo.

Why? The domain is being destroyed.

David

  reply	other threads:[~2013-08-19 10:32 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-09 18:08 [RFC PATCH 0/8] Xen: FIFO-based event channel ABI David Vrabel
2013-08-09 18:08 ` [PATCH 1/8] debug: remove some event channel info from the 'i' and 'q' debug keys David Vrabel
2013-08-15 13:55   ` Jan Beulich
2013-08-09 18:08 ` [PATCH 2/8] evtchn: refactor low-level event channel port ops David Vrabel
2013-08-15 14:05   ` Jan Beulich
2013-09-06 14:25     ` David Vrabel
2013-09-06 14:55       ` Jan Beulich
2013-08-09 18:08 ` [PATCH 3/8] evtchn: add a hook to bind an event port to a VCPU David Vrabel
2013-08-09 18:08 ` [PATCH 4/8] evtchn: use a per-domain variable for the max number of event channels David Vrabel
2013-08-15 14:09   ` Jan Beulich
2013-08-09 18:08 ` [PATCH 5/8] evtchn: dynamically allocate d->evtchn David Vrabel
2013-08-15 14:10   ` Jan Beulich
2013-08-09 18:08 ` [PATCH 6/8] evtchn: alter internal object handling scheme David Vrabel
2013-08-15 14:21   ` Jan Beulich
2013-08-15 15:46     ` David Vrabel
2013-08-16  7:14       ` Jan Beulich
2013-08-16 16:55   ` Wei Liu
2013-08-09 18:08 ` [PATCH 7/8] evtchn: add FIFO-based event channel ABI David Vrabel
2013-08-15 14:25   ` Jan Beulich
2013-08-09 18:08 ` [PATCH 8/8] evtchn: add FIFO-based event channel hypercalls and port ops David Vrabel
2013-08-16 16:33   ` Wei Liu
2013-08-19 10:32     ` David Vrabel [this message]
2013-08-19 10:46       ` Wei Liu
2013-08-23 10:33   ` Jan Beulich
2013-08-23 11:00     ` David Vrabel
2013-08-12 13:06 ` [RFC PATCH 0/8] Xen: FIFO-based event channel ABI George Dunlap
2013-08-12 13:49   ` David Vrabel
2013-08-16 16:55 ` Wei Liu
  -- strict thread matches above, loose matches on Subject: below --
2013-03-19 21:00 [PATCH RFC " David Vrabel
2013-03-19 21:00 ` [PATCH 8/8] evtchn: add FIFO-based event channel hypercalls and port ops David Vrabel
2013-03-20 10:47   ` Jan Beulich
2013-03-20 13:42     ` David Vrabel
2013-03-20 13:55       ` Jan Beulich
2013-03-20 14:23         ` Tim Deegan
2013-03-20 14:38           ` David Vrabel
2013-03-20 15:34             ` Tim Deegan
2013-03-20 15:54               ` David Vrabel
2013-03-20 16:15                 ` Keir Fraser
2013-03-20 13:50   ` Wei Liu

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=5211F43D.8010800@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=keir@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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).