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@lists.xenproject.org, Keir Fraser <keir@xen.org>,
	Ian Campbell <ian.campbell@citrix.com>, Tim Deegan <tim@xen.org>
Subject: Re: [PATCHv2 3/5] evtchn: use a per-event channel lock for sending events
Date: Tue, 16 Jun 2015 10:57:40 +0100	[thread overview]
Message-ID: <557FF314.20305@citrix.com> (raw)
In-Reply-To: <55800DB70200007800085647@mail.emea.novell.com>

On 16/06/15 10:51, Jan Beulich wrote:
>>>> On 16.06.15 at 11:34, <david.vrabel@citrix.com> wrote:
>> On 16/06/15 10:18, Jan Beulich wrote:
>>>>>> On 15.06.15 at 17:48, <david.vrabel@citrix.com> wrote:
>>>> @@ -609,21 +662,18 @@ int evtchn_send(struct domain *ld, unsigned int lport)
>>>>      struct domain *rd;
>>>>      int            rport, ret = 0;
>>>>  
>>>> -    spin_lock(&ld->event_lock);
>>>> -
>>>> -    if ( unlikely(!port_is_valid(ld, lport)) )
>>>> -    {
>>>> -        spin_unlock(&ld->event_lock);
>>>> +    if ( unlikely(lport >= read_atomic(&ld->valid_evtchns)) )
>>>>          return -EINVAL;
>>>> -    }
>>>
>>> I don't think you really want to open code part of port_is_valid()
>>> (and avoid other parts of it) here? Or if really so, I think a comment
>>> should be added to explain it.
>>
>> The ld->valid_evtchns is the only field we can safely check without
>> ld->event_lock.
>>
>> We do check the channel state and the code that set this state uses the
>> full port_is_valid() call.  I'll add a comment.
> 
> Hmm, port_is_valid() also checks d->max_evtchns and d->evtchn.
> The latter is involved in evtchn_from_port(), so I can't see how
> you checking the channel's state _afterwards_ can leverage that
> whoever set this state did a full check.
> 
> Another question is whether with the ->valid_evtchns check the
> ->evtchn check is necessary at all anymore. (The check against
> ->max_evtchns isn't wrong with the lock not held, i.e. could only
> end up being too strict, and hence the open coding would then
> still be questionable.)

Ok.  I'll remove the d->evtchn check from port_is_valid() and use it.

David

  reply	other threads:[~2015-06-16  9:57 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-15 15:48 [PATCHv2 0/5] evtchn: Improve scalebility David Vrabel
2015-06-15 15:48 ` [PATCHv2 1/5] evtchn: factor out freeing an event channel David Vrabel
2015-06-15 15:48 ` [PATCHv2 2/5] evtchn: simplify port_is_valid() David Vrabel
2015-06-15 15:57   ` Ian Campbell
2015-06-15 15:59     ` David Vrabel
2015-06-15 16:09       ` Ian Campbell
2015-06-15 15:48 ` [PATCHv2 3/5] evtchn: use a per-event channel lock for sending events David Vrabel
2015-06-16  9:18   ` Jan Beulich
2015-06-16  9:34     ` David Vrabel
2015-06-16  9:51       ` Jan Beulich
2015-06-16  9:57         ` David Vrabel [this message]
2015-06-16 15:19     ` David Vrabel
2015-06-16 15:58       ` David Vrabel
2015-06-16 16:19         ` Jan Beulich
2015-06-16 16:39           ` David Vrabel
2015-06-17  7:05             ` Jan Beulich
2015-06-16 16:06       ` Jan Beulich
2015-06-15 15:48 ` [PATCHv2 4/5] evtchn: remove the locking when unmasking an event channel David Vrabel
2015-06-16  9:19   ` Jan Beulich
2015-06-16  9:40     ` David Vrabel
2015-06-15 15:48 ` [PATCHv2 5/5] evtchn: pad struct evtchn to 64 bytes David Vrabel
2015-06-16  9:22   ` Jan Beulich
2015-06-16 11:14   ` Julien Grall
2015-06-16 11:59     ` Jan Beulich
2015-06-16 12:57       ` Julien Grall
2015-06-16 13:13         ` David Vrabel
2015-06-16 13:27           ` Julien Grall

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=557FF314.20305@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=ian.campbell@citrix.com \
    --cc=keir@xen.org \
    --cc=tim@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.