All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Chao Gao <chao.gao@intel.com>
Cc: xen-devel@lists.xenproject.org, Jan Beulich <jbeulich@suse.com>
Subject: Re: [PATCH v5 1/3] xen/pt: fix some pass-thru devices don't work across reboot
Date: Wed, 16 Jan 2019 16:29:09 +0100	[thread overview]
Message-ID: <20190116152909.zsvi55q64kk6nls5@mac> (raw)
In-Reply-To: <20190116145246.GA27916@gao-cwp>

On Wed, Jan 16, 2019 at 10:52:48PM +0800, Chao Gao wrote:
> On Wed, Jan 16, 2019 at 01:34:28PM +0100, Roger Pau Monné wrote:
> >On Wed, Jan 16, 2019 at 07:59:44PM +0800, Chao Gao wrote:
> >> On Wed, Jan 16, 2019 at 11:38:23AM +0100, Roger Pau Monné wrote:
> >> >On Wed, Jan 16, 2019 at 04:17:30PM +0800, Chao Gao wrote:
> >> >> diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
> >> >> index 93c20b9..4f2be02 100644
> >> >> --- a/xen/drivers/passthrough/pci.c
> >> >> +++ b/xen/drivers/passthrough/pci.c
> >> >> @@ -1514,6 +1514,68 @@ static int assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn, u32 flag)
> >> >>      return rc;
> >> >>  }
> >> >>  
> >> >> +/*
> >> >> + * Unmap established mappings between domain's pirq and device's MSI.
> >> >> + * These mappings were set up by qemu/guest and are expected to be
> >> >> + * destroyed when changing the device's ownership.
> >> >> + */
> >> >> +static void pci_unmap_msi(struct pci_dev *pdev)
> >> >> +{
> >> >> +    struct msi_desc *entry, *tmp;
> >> >> +    struct domain *d = pdev->domain;
> >> >> +
> >> >> +    ASSERT(pcidevs_locked());
> >> >> +    ASSERT(d);
> >> >> +
> >> >> +    spin_lock(&d->event_lock);
> >> >> +    list_for_each_entry_safe(entry, tmp, &pdev->msi_list, list)
> >> >> +    {
> >> >> +        struct pirq *info;
> >> >> +        int ret, pirq = 0;
> >> >> +        unsigned int nr = entry->msi_attrib.type != PCI_CAP_ID_MSIX
> >> >> +                          ? entry->msi.nvec : 1;
> >> >
> >> >I think you should mask the entry, like it's done in
> >> >pt_irq_destroy_bind, see the call to guest_mask_msi_irq. That gives a
> >> >consistent state between bind and unbind.
> >> 
> >> I don't think it is necessary considering that we are to unmap pirq.
> >> The reason of keeping state consistent is that we might try to bind
> >> the same pirq to another guest interrupt.
> >
> >Even taking into account that the pirq will be unmapped afterwards I'm
> >not sure the state is going to be the same. unmap_domain_pirq doesn't
> >seem to mask the MSI entries, and so I wonder whether we could run
> >into issues (state not being the expected) when later re-assigning the
> >device to another guest.
> 
> A valid call trace (in this patch's description) is:
> 
> ->unmap_domain_pirq (if pirq isn't unmapped by qemu)
>     ->pirq_guest_force_unbind
> 	->__pirq_guest_unbind
> 	    ->mask_msi_irq(=desc->handler->disable())
> 		->the warning in msi_set_mask_bit()

Ack, sorry for not realizing this.

Thanks, Roger.

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

  reply	other threads:[~2019-01-16 15:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-16  8:17 [PATCH v5 1/3] xen/pt: fix some pass-thru devices don't work across reboot Chao Gao
2019-01-16  8:17 ` [PATCH v5 2/3] libxl: don't reset device when it is accessible by the guest Chao Gao
2019-01-16  8:17 ` [PATCH v5 3/3] xen/pt: initialize 'warned' field of arch_msix properly Chao Gao
2019-01-16 10:38 ` [PATCH v5 1/3] xen/pt: fix some pass-thru devices don't work across reboot Roger Pau Monné
2019-01-16 11:59   ` Chao Gao
2019-01-16 12:34     ` Roger Pau Monné
2019-01-16 14:52       ` Chao Gao
2019-01-16 15:29         ` Roger Pau Monné [this message]
2019-01-22  5:50   ` Chao Gao
2019-01-22  8:24     ` Jan Beulich
2019-01-22 16:08       ` Chao Gao
2019-01-22 16:28         ` Jan Beulich
2019-01-25 11:10           ` Chao Gao
2019-01-25 15:57             ` Jan Beulich
2019-01-22  9:18     ` Roger Pau Monné
2019-01-22 16:11       ` Chao Gao

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=20190116152909.zsvi55q64kk6nls5@mac \
    --to=roger.pau@citrix.com \
    --cc=chao.gao@intel.com \
    --cc=jbeulich@suse.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.