All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
	Daniel De Graaf <dgdegra@tycho.nsa.gov>,
	Keir Fraser <keir@xen.org>
Subject: Re: [PATCH 09/11] evtchn: implement EVTCHNOP_set_limit
Date: Mon, 16 Sep 2013 11:57:19 +0100	[thread overview]
Message-ID: <5236E40F.7010909@citrix.com> (raw)
In-Reply-To: <5236FA8602000078000F3902@nat28.tlf.novell.com>

On 16/09/13 11:33, Jan Beulich wrote:
>>>> On 16.09.13 at 12:00, David Vrabel <david.vrabel@citrix.com> wrote:
>> On 16/09/13 08:07, Jan Beulich wrote:
>>>>>> On 13.09.13 at 18:56, David Vrabel <david.vrabel@citrix.com> wrote:
>>>> +static long evtchn_set_limit(const struct evtchn_set_limit *set_limit)
>>>> +{
>>>> +    struct domain *d;
>>>> +    unsigned max_port = set_limit->max_port;
>>>> +    long ret;
>>>> +
>>>> +    if ( max_port > EVTCHN_MAX_PORT_UNLIMITED )
>>>> +        return -EINVAL;
>>>> +
>>>> +    d = rcu_lock_domain_by_id(set_limit->domid);
>>>> +    if ( !d )
>>>> +        return -ESRCH;
>>>> +
>>>> +    ret = xsm_evtchn_set_limit(XSM_DM_PRIV, d);
>>>> +    if ( ret )
>>>> +        goto out;
>>>> +
>>>> +    spin_lock(&d->event_lock);
>>>> +
>>>> +    d->max_evtchn_port = max_port;
>>>
>>> So you allow this to be set even if the L2 ABI is in use. Does this
>>> make sense? Is this consistent?
>>
>> I think it would be confusing if guests could subvert the limit by using
>> a different ABI, even if it doesn't really make much difference from a
>> resource usage point of view.
> 
> Somehow I'm getting the impression we're no understanding one
> another. My questions were:
> - What's the point of permitting use of this function for a guest
>   using the 2-level ABI?

So any administrator set limit is consistently applied regardless of
which ABI a guest uses.

> - If you consider it valid to be used by a 2-level guest, will the
>   result be consistent (will the guest see the limit enforced, and is
>   there no implicit assumption somewhere that 2-level guests can
>   always use the so far statically limited number of event channels)?

The limit is enforced (see the checks in get_free_port()) for all ABIs:

     for ( port = 0; port_is_valid(d, port); port++ )
     {
         if (port > d->max_evtchn_port )
             return -ENOSPC;
         if ( evtchn_from_port(d, port)->state == ECS_FREE )
             return port;
     }

     if ( port == d->max_evtchns || port > d->max_evtchn_port )
         return -ENOSPC;

>>>> @@ -1189,6 +1229,11 @@ void evtchn_check_pollers(struct domain *d, unsigned port)
>>>>  
>>>>  int evtchn_init(struct domain *d)
>>>>  {
>>>> +    if ( is_control_domain(d) )
>>>> +        d->max_evtchn_port = EVTCHN_MAX_PORT_UNLIMITED;
>>>> +    else
>>>> +        d->max_evtchn_port = EVTCHN_MAX_PORT_DEFAULT;
>>>> +
>>>>      /* Default to N-level ABI. */
>>>>      evtchn_2l_init(d);
>>>
>>> Similarly here - you set limits that are not consistent with the default
>>> L2 ABI.
>>
>> I'm not sure why you think they are inconsistent, the limits set here
>> are such that there is no regression in the number of usable event
>> channels.  A guest is still limited by the maximum supported by any ABI.
>> i.e., the limit is min(d->max_evtchn_port, d->max_evtchns-1).
> 
> I asked because the limit for a 2-level Dom0 is now wrong. But you
> ought to read this in the context of the questions above, i.e. if all's
> consistent (and the max() you point out is indeed consistently
> enforced), then there is no issue.

The maximum supported by the ABI and the administratively set limit are
independent constraints.  get_free_port() makes sure neither constraint
is exceeded.

David

  reply	other threads:[~2013-09-16 10:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-13 16:56 [PATCHv3 0/11] Xen: FIFO-based event channel ABI David Vrabel
2013-09-13 16:56 ` [PATCH 01/11] debug: remove some event channel info from the 'i' and 'q' debug keys David Vrabel
2013-09-13 16:56 ` [PATCH 02/11] evtchn: refactor low-level event channel port ops David Vrabel
2013-09-15 13:06   ` Stefano Stabellini
2013-09-15 13:11     ` Stefano Stabellini
2013-09-16 10:08       ` David Vrabel
2013-09-15 13:20     ` Ian Campbell
2013-09-13 16:56 ` [PATCH 03/11] evtchn: print ABI specific state with the 'e' debug key David Vrabel
2013-09-13 16:56 ` [PATCH 04/11] evtchn: use a per-domain variable for the max number of event channels David Vrabel
2013-09-13 16:56 ` [PATCH 05/11] evtchn: dynamically allocate d->evtchn David Vrabel
2013-09-13 16:56 ` [PATCH 06/11] evtchn: alter internal object handling scheme David Vrabel
2013-09-13 16:56 ` [PATCH 07/11] evtchn: add FIFO-based event channel ABI David Vrabel
2013-09-16  6:59   ` Jan Beulich
2013-09-13 16:56 ` [PATCH 08/11] evtchn: implement EVTCHNOP_set_priority and add the set_priority hook David Vrabel
2013-09-13 16:56 ` [PATCH 09/11] evtchn: implement EVTCHNOP_set_limit David Vrabel
2013-09-13 18:32   ` Daniel De Graaf
2013-09-16  7:07   ` Jan Beulich
2013-09-16 10:00     ` David Vrabel
2013-09-16 10:33       ` Jan Beulich
2013-09-16 10:57         ` David Vrabel [this message]
2013-09-13 16:56 ` [PATCH 10/11] libxc: add xc_evtchn_set_limit() David Vrabel
2013-09-13 16:56 ` [PATCH 11/11] evtchn: add FIFO-based event channel hypercalls and port ops David Vrabel

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=5236E40F.7010909@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=keir@xen.org \
    --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 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.