All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: "Roger Pau Monné" <roger.pau@citrix.com>
Cc: Simon Gaiser <simon@invisiblethingslab.com>,
	xen-devel@lists.xenproject.org, Wei Liu <wei.liu2@citrix.com>,
	Jan Beulich <jbeulich@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [PATCH v4 4/6] xen/x86: Allow stubdom access to irq created for msi.
Date: Thu, 7 Feb 2019 18:51:57 +0100	[thread overview]
Message-ID: <20190207175157.GZ21228@mail-itl> (raw)
In-Reply-To: <20190207174016.gij6u5wqhrhckt3a@mac>


[-- Attachment #1.1: Type: text/plain, Size: 3172 bytes --]

On Thu, Feb 07, 2019 at 06:40:16PM +0100, Roger Pau Monné wrote:
> On Thu, Feb 07, 2019 at 04:41:38PM +0100, Marek Marczykowski-Górecki wrote:
> > On Thu, Feb 07, 2019 at 03:57:54PM +0100, Roger Pau Monné wrote:
> > > On Thu, Feb 07, 2019 at 03:52:38PM +0100, Marek Marczykowski-Górecki wrote:
> > > > Hmm, looking at the code, wouldn't it make sense to give device model
> > > > domain access to the IRQ _instead of_ hardware domain? If stubdomain is
> > > > in use, I don't see why dom0 would need access to that irq. Simply
> > > > provide what the device model domain is as parameter - either
> > > > hardware_domain, or stubdomain. Something like:
> > > > 
> > > >     create_irq(..., current->domain->target == d ? current->domain : hardware_domain);
> > > 
> > > Isn't there some cleanup that likely needs to be done by dom0 if it's
> > > not done by the stubdom, or in case the stubdom crashes for some
> > > reason?
> > 
> > I don't think toolstack know anything about IRQs allocated by device
> > model, looks like it does cleanup only for INTx interrupts.
> > 
> > > Or maybe that's already done on domain destruction by Xen itself, in
> > > which case not giving permissions to dom0 would be fine.
> > 
> > There is free_domain_pirqs() call in arch_domain_destroy(). But I don't
> > have device model reference there. Is there a way to get target ->
> > stubdomain mapping (other than iterating over all the domains)? I see
> > also domain->target field, which is the other way around.
> > The only thing needed is irq_deny_access() call there (in case of domain
> > ID reuse). Since such IRQs are not mapped to stubdomain itself,
> > free_domain_pirqs() for stubdomain will not clean this up.
> > Or maybe, _if stubdomain is guaranteed to be destroyed before its
> > target_, we can iterate over target domain's IRQs during stubdomain
> > destruction for this purpose?
> 
> The list of allowed irqs is stored inside of the domain struct,
> which means that it goes away when the domain is destroyed, there's no
> need to do any specific cleanup when the stubdomain is destroyed
> AFAICT. Now if the target domain is destroyed, those permissions over
> the irqs must be removed from the stubdomain, because the irqs will be
> freed and likely reused. The current model assumes that the hardware
> domain is always the controlling owner of such irqs, but if we allow
> stubdomains to also be the controlling owner then we need to keep some
> track of this, or else Xen could be leaking permissions.

This looks to be not a problem, because stubdomain keeps reference to
its target domain (and there is corresponding put_domain(d->target) on
domain destroy), so to answer my own question "if stubdomain is
guaranteed to be destroyed before its target" - yes, it is.

So, if domain destruction also implicitly revoke all _its_ irq
permissions (because of where they are stored), there is no additional
cleanup needed here.

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-02-07 17:52 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-07  0:07 [PATCH v4 0/6] Fix PCI passthrough for HVM with stubdomain Marek Marczykowski-Górecki
2019-02-07  0:07 ` [PATCH v4 1/6] libxl: do not attach xen-pciback to HVM domain, if stubdomain is in use Marek Marczykowski-Górecki
2019-02-07  0:07 ` [PATCH v4 2/6] libxl: attach PCI device to qemu only after setting pciback/pcifront Marek Marczykowski-Górecki
2019-02-07  0:07 ` [PATCH v4 3/6] libxl: don't try to manipulate json config for stubdomain Marek Marczykowski-Górecki
2019-02-21 16:16   ` Wei Liu
2019-02-07  0:07 ` [PATCH v4 4/6] xen/x86: Allow stubdom access to irq created for msi Marek Marczykowski-Górecki
2019-02-07  9:57   ` Roger Pau Monné
2019-02-07 13:21     ` Marek Marczykowski-Górecki
2019-02-07 13:40       ` Roger Pau Monné
2019-02-07 14:52       ` Marek Marczykowski-Górecki
2019-02-07 14:57         ` Roger Pau Monné
2019-02-07 15:41           ` Marek Marczykowski-Górecki
2019-02-07 17:40             ` Roger Pau Monné
2019-02-07 17:51               ` Marek Marczykowski-Górecki [this message]
2019-02-08  9:35                 ` Roger Pau Monné
2019-02-08 10:15                   ` Marek Marczykowski-Górecki
2019-02-08 10:17                     ` [PATCH v4.1 " Marek Marczykowski-Górecki
2019-02-21 16:47                       ` Roger Pau Monné
2019-02-21 17:40                         ` Marek Marczykowski-Górecki
2019-02-22 10:42                           ` Roger Pau Monné
2019-02-22 11:11                             ` Jan Beulich
2019-03-07  0:50                             ` Marek Marczykowski-Górecki
2019-03-07 14:48                               ` Roger Pau Monné
2019-03-07 22:28                                 ` Marek Marczykowski-Górecki
2019-03-08 10:26                                   ` Roger Pau Monné
2019-03-08 16:49                                     ` Marek Marczykowski-Górecki
2019-03-08 17:04                                       ` Jan Beulich
2019-03-08 12:33                                   ` Jan Beulich
2019-02-27 11:07                       ` Jan Beulich
2019-02-27 15:18                         ` Marek Marczykowski
2019-02-28 10:50                           ` Jan Beulich
2019-02-28 11:41                             ` Roger Pau Monné
2019-02-07  0:07 ` [PATCH v4 5/6] xen/x86: add PHYSDEVOP_msi_set_enable Marek Marczykowski-Górecki
2019-02-07 10:25   ` Roger Pau Monné
2019-02-27 11:41   ` Jan Beulich
2019-02-27 15:05     ` Marek Marczykowski
2019-02-28 10:58       ` Jan Beulich
2019-02-28 12:25         ` Marek Marczykowski
2019-03-03  1:10           ` Marek Marczykowski
2019-03-04 10:19             ` Roger Pau Monné
2019-03-04 10:22               ` Jan Beulich
2019-03-03  3:26         ` Marek Marczykowski
2019-02-07  0:07 ` [PATCH v4 6/6] tools/libxc: add wrapper for PHYSDEVOP_msi_set_enable Marek Marczykowski-Górecki

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=20190207175157.GZ21228@mail-itl \
    --to=marmarek@invisiblethingslab.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=roger.pau@citrix.com \
    --cc=simon@invisiblethingslab.com \
    --cc=wei.liu2@citrix.com \
    --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.