From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: "Roger Pau Monné" <roger.pau@citrix.com>,
"Chao Gao" <chao.gao@intel.com>
Cc: linux-kernel@vger.kernel.org, Juergen Gross <jgross@suse.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Jia-Ju Bai <baijiaju1990@gmail.com>,
xen-devel@lists.xenproject.org, Jan Beulich <jbeulich@suse.com>
Subject: Re: [PATCH] xen: xen-pciback: Reset MSI-X state when exposing a device
Date: Wed, 5 Dec 2018 09:01:33 -0500 [thread overview]
Message-ID: <c27236d3-6125-4049-6268-3d9c93cf3ef2@oracle.com> (raw)
In-Reply-To: <20181205093223.dncg4nq4dh6xmrhk@mac>
On 12/5/18 4:32 AM, Roger Pau Monné wrote:
> On Wed, Dec 05, 2018 at 10:19:17AM +0800, Chao Gao wrote:
>> I find some pass-thru devices don't work any more across guest reboot.
>> Assigning it to another guest also meets the same issue. And the only
>> way to make it work again is un-binding and binding it to pciback.
>> Someone reported this issue one year ago [1]. More detail also can be
>> found in [2].
>>
>> The root-cause is Xen's internal MSI-X state isn't reset properly
>> during reboot or re-assignment. In the above case, Xen set maskall bit
>> to mask all MSI interrupts after it detected a potential security
>> issue. Even after device reset, Xen didn't reset its internal maskall
>> bit. As a result, maskall bit would be set again in next write to
>> MSI-X message control register.
>>
>> Given that PHYSDEVOPS_prepare_msix() also triggers Xen resetting MSI-X
>> internal state of a device, we employ it to fix this issue rather than
>> introducing another dedicated sub-hypercall.
>>
>> Note that PHYSDEVOPS_release_msix() will fail if the mapping between
>> the device's msix and pirq has been created. This limitation prevents
>> us calling this function when detaching a device from a guest during
>> guest shutdown. Thus it is called right before calling
>> PHYSDEVOPS_prepare_msix().
> s/PHYSDEVOPS/PHYSDEVOP/ (no final S). And then I would also drop the
> () at the end of the hypercall name since it's not a function.
>
> I'm also wondering why the release can't be done when the device is
> detached from the guest (or the guest has been shut down). This makes
> me worry about the raciness of the attach/detach procedure: if there's
> a state where pciback assumes the device has been detached from the
> guest, but there are still pirqs bound, an attempt to attach to
> another guest in such state will fail.
I wonder whether this additional reset functionality could be done out
of xen_pcibk_xenbus_remove(). We first do a (best effort) device reset
and then do the extra things that are not properly done there.
-boris
next prev parent reply other threads:[~2018-12-05 14:01 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-05 2:19 Chao Gao
2018-12-05 9:32 ` Roger Pau Monné
2018-12-05 14:01 ` Boris Ostrovsky [this message]
2018-12-12 7:06 ` Chao Gao
2018-12-12 8:51 ` Jan Beulich
2018-12-12 15:18 ` Chao Gao
2018-12-12 15:21 ` Jan Beulich
2018-12-13 3:46 ` Chao Gao
2018-12-13 7:54 ` Jan Beulich
2018-12-13 13:17 ` Chao Gao
2018-12-06 2:18 ` Chao Gao
2018-12-05 16:26 ` Jan Beulich
2019-09-13 10:02 ` Spassov, Stanislav
2019-09-13 15:28 ` Chao Gao
2019-09-26 10:13 ` [Xen-devel] " Pasi Kärkkäinen
2019-09-26 10:54 ` Spassov, Stanislav
2020-01-17 18:57 ` Rich Persaud
2020-01-18 1:13 ` 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=c27236d3-6125-4049-6268-3d9c93cf3ef2@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=baijiaju1990@gmail.com \
--cc=chao.gao@intel.com \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®