All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: David Vrabel <david.vrabel@citrix.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: Wed, 17 Jun 2015 08:05:54 +0100	[thread overview]
Message-ID: <558138720200007800085D74@mail.emea.novell.com> (raw)
In-Reply-To: <5580514A.5000702@citrix.com>

>>> On 16.06.15 at 18:39, <david.vrabel@citrix.com> wrote:
> On 16/06/15 17:19, Jan Beulich wrote:
>>>>> On 16.06.15 at 17:58, <david.vrabel@citrix.com> wrote:
>>> On 16/06/15 16:19, David Vrabel wrote:
>>>>>> @@ -1221,6 +1277,8 @@ void notify_via_xen_event_channel(struct domain *ld, 
>>> int lport)
>>>>>>          evtchn_port_set_pending(rd, rchn->notify_vcpu_id, rchn);
>>>>>>      }
>>>>>>  
>>>>>> +    spin_unlock(&lchn->lock);
>>>>>> +
>>>>>>      spin_unlock(&ld->event_lock);
>>>>>>  }
>>>>>
>>>>> Again I think the event lock can be dropped earlier now.
>>>>
>>>> Ditto.
>>>
>>> Uh, no. This is notify.  I've kept the locking like this because of the
>>> ld->is_dying check.  I think we need the ld->event_lock in case
>>> d->is_dying is set and evtchn_destroy(ld) is called.
>> 
>> Right, but if evtchn_destroy() was a concern, then this wouldn't
>> apply just here, but also in the sending path you are relaxing.
>> Afaict due to the channel lock being taken in __evtchn_close()
>> you can drop the even lock here as the latest after you acquired
>> the channel one (I haven't been able to convince myself yet that
>> dropping it even before that would be okay).
> 
> But in the evtchn_send() case, we're in a hypercall so we know
> ld->is_dying is false and thus cannot be racing with evtchn_destroy(ld).

That's only the common code path; there's an evtchn_send() call
from __domain_finalise_shutdown() which afaict doesn't make such
guarantees (in particular there clearly are d != current->domain
cases here).

And then - how is being in a hypercall a guard against is_dying not
getting set?

> It would be good to remove event_lock from notify_xen_event_channel() as
> well since this is heavily used for ioreqs and vm events.  Let me have a
> more careful look.

Indeed, thanks.

Jan

  reply	other threads:[~2015-06-17  7:05 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
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 [this message]
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=558138720200007800085D74@mail.emea.novell.com \
    --to=jbeulich@suse.com \
    --cc=david.vrabel@citrix.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.