xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@eu.citrix.com>
To: Paul Durrant <Paul.Durrant@citrix.com>,
	George Dunlap <George.Dunlap@citrix.com>
Cc: "Keir (Xen.org)" <keir@xen.org>, Jan Beulich <jbeulich@suse.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH v4 3/8] ioreq-server: create basic ioreq server abstraction.
Date: Thu, 3 Apr 2014 16:48:44 +0100	[thread overview]
Message-ID: <533D82DC.8070108@eu.citrix.com> (raw)
In-Reply-To: <9AAE0902D5BC7E449B7C8E4E778ABCD02BBDC0@AMSPEX01CL01.citrite.net>

On 04/03/2014 04:43 PM, Paul Durrant wrote:
>> -----Original Message-----
>> From: dunlapg@gmail.com [mailto:dunlapg@gmail.com] On Behalf Of
>> George Dunlap
>> Sent: 03 April 2014 15:50
>> To: Paul Durrant
>> Cc: xen-devel@lists.xen.org; Keir (Xen.org); Jan Beulich
>> Subject: Re: [Xen-devel] [PATCH v4 3/8] ioreq-server: create basic ioreq
>> server abstraction.
>>
>> On Wed, Apr 2, 2014 at 4:11 PM, Paul Durrant <paul.durrant@citrix.com>
>> wrote:
>>> Collect together data structures concerning device emulation together into
>>> a new struct hvm_ioreq_server.
>>>
>>> Code that deals with the shared and buffered ioreq pages is extracted from
>>> functions such as hvm_domain_initialise, hvm_vcpu_initialise and
>> do_hvm_op
>>> and consolidated into a set of hvm_ioreq_server manipulation functions.
>> The
>>> lock in the hvm_ioreq_page served two different purposes and has been
>>> replaced by separate locks in the hvm_ioreq_server.
>>>
>>> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
>>> Cc: Keir Fraser <keir@xen.org>
>>> Cc: Jan Beulich <jbeulich@suse.com>
>>> ---
>>>   xen/arch/x86/hvm/hvm.c           |  406 ++++++++++++++++++++++++++----
>> --------
>>>   xen/include/asm-x86/hvm/domain.h |   35 +++-
>>>   xen/include/asm-x86/hvm/vcpu.h   |   12 +-
>>>   3 files changed, 322 insertions(+), 131 deletions(-)
>>>
>>> diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
>>> index 573f845..5f131c4 100644
>>> --- a/xen/arch/x86/hvm/hvm.c
>>> +++ b/xen/arch/x86/hvm/hvm.c
>>> @@ -352,39 +352,49 @@ void hvm_migrate_pirqs(struct vcpu *v)
>>>       spin_unlock(&d->event_lock);
>>>   }
>>>
>>> -static ioreq_t *get_ioreq(struct vcpu *v)
>>> +static ioreq_t *get_ioreq(struct hvm_ioreq_server *s, struct vcpu *v)
>>>   {
>>> -    struct domain *d = v->domain;
>>> -    shared_iopage_t *p = d->arch.hvm_domain.ioreq.va;
>>> +    shared_iopage_t *p = s->ioreq.va;
>>>
>>> -    ASSERT((v == current) || spin_is_locked(&d-
>>> arch.hvm_domain.ioreq.lock));
>>> +    /*
>>> +     * Manipulation of the shared ioreq structure (to update the event
>>> +     * channel) is protected by a domain_pause(). So this function should
>>> +     * only ever be executed for the current vcpu or one that is paused.
>>> +     */
>> What on earth is "manipulation of the shared ioreq structure is
>> protected by domain_pause()" supposed to mean?  Do you mean that the
>> only time there may be a race is between something in the emulation
>> code writing to it, and something in the resume path reading it?  That
>> there are never any other races to access the structure?  And that
>> since the resume path won't be taken when the domain is paused, there
>> can be no races, and therefore we do not need to be locked?
>>
> The sentiment I'm trying to express is that the shared structure can never be in use in the emulation path whilst it is being modified as the code that modifies always pauses the domain before doing so, so the assertion is that either v == current (in which case the domain is clearly not paused and we're in the emulation path) or !vcpu_runnable(v) (in which case the domain is paused and we're making a change).

Sure, but is there a risk of two different invocations of the "code that 
modifies" happening at the same time?  (Perhaps, for instance, because 
of a buggy toolstack that makes two calls on the same ioreq server?)

  -George

  reply	other threads:[~2014-04-03 15:48 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-02 15:11 [PATCH v4 0/8] Support for running secondary emulators Paul Durrant
2014-04-02 15:11 ` [PATCH v4 1/8] ioreq-server: pre-series tidy up Paul Durrant
2014-04-07 10:48   ` Jan Beulich
2014-04-08  9:13     ` Paul Durrant
2014-04-02 15:11 ` [PATCH v4 2/8] ioreq-server: centralize access to ioreq structures Paul Durrant
2014-04-03 11:22   ` George Dunlap
2014-04-07 11:10   ` Jan Beulich
2014-04-08  9:18     ` Paul Durrant
2014-04-02 15:11 ` [PATCH v4 3/8] ioreq-server: create basic ioreq server abstraction Paul Durrant
2014-04-03 14:49   ` George Dunlap
2014-04-03 15:43     ` Paul Durrant
2014-04-03 15:48       ` George Dunlap [this message]
2014-04-03 15:54         ` Paul Durrant
2014-04-07 11:36   ` Jan Beulich
2014-04-08  9:32     ` Paul Durrant
2014-04-08  9:47       ` Jan Beulich
2014-04-08 10:06         ` Paul Durrant
2014-04-02 15:11 ` [PATCH v4 4/8] ioreq-server: on-demand creation of ioreq server Paul Durrant
2014-04-07 11:50   ` Jan Beulich
2014-04-08  9:35     ` Paul Durrant
2014-04-08  9:51       ` Jan Beulich
2014-04-08 10:11         ` Paul Durrant
2014-04-02 15:11 ` [PATCH v4 5/8] ioreq-server: add support for multiple servers Paul Durrant
2014-04-03 15:32   ` George Dunlap
2014-04-03 15:39     ` Paul Durrant
2014-04-03 15:43       ` George Dunlap
2014-04-03 15:46         ` Paul Durrant
2014-04-07 15:57   ` Ian Campbell
2014-04-08  8:32     ` Paul Durrant
2014-04-08  8:40       ` Ian Campbell
2014-04-08  8:45         ` Paul Durrant
2014-04-09 12:43   ` Jan Beulich
2014-04-09 12:49     ` Ian Campbell
2014-04-09 13:15       ` Jan Beulich
2014-04-09 13:32     ` Paul Durrant
2014-04-09 13:46       ` Jan Beulich
2014-04-09 13:51         ` Paul Durrant
2014-04-09 14:42         ` Ian Campbell
2014-04-02 15:11 ` [PATCH v4 6/8] ioreq-server: remove p2m entries when server is enabled Paul Durrant
2014-04-07 16:00   ` Ian Campbell
2014-04-08  8:33     ` Paul Durrant
2014-04-09 12:20   ` Jan Beulich
2014-04-09 13:36     ` Paul Durrant
2014-04-09 13:50       ` Jan Beulich
2014-04-02 15:11 ` [PATCH v4 7/8] ioreq-server: make buffered ioreq handling optional Paul Durrant
2014-04-07 16:06   ` Ian Campbell
2014-04-08  8:35     ` Paul Durrant
2014-04-02 15:11 ` [PATCH v4 8/8] ioreq-server: bring the PCI hotplug controller implementation into Xen Paul Durrant
2014-04-07 16:14   ` Ian Campbell
2014-04-08  8:25     ` Paul Durrant
2014-04-08  8:45       ` Ian Campbell
2014-04-08  8:49         ` Paul Durrant
2014-04-08  8:57           ` Ian Campbell
2014-04-08  9:00             ` Paul Durrant
2014-04-09 13:34   ` Jan Beulich
2014-04-09 13:42     ` Paul Durrant
2014-04-09 13:53       ` Jan Beulich
2014-04-09 14:25         ` Paul Durrant
2014-04-09 14:47           ` Jan Beulich
2014-04-09 14:59         ` Ian Jackson
2014-04-09 15:06           ` Jan Beulich
2014-04-10 16:04           ` George Dunlap

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=533D82DC.8070108@eu.citrix.com \
    --to=george.dunlap@eu.citrix.com \
    --cc=George.Dunlap@citrix.com \
    --cc=Paul.Durrant@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --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).