From: Stewart Hildebrand <stewart.hildebrand@amd.com>
To: "Chen, Jiqian" <Jiqian.Chen@amd.com>,
Jan Beulich <jbeulich@suse.com>,
"Daniel P . Smith" <dpsmith@apertussolutions.com>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>,
"George Dunlap" <george.dunlap@citrix.com>,
"Julien Grall" <julien@xen.org>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Anthony PERARD" <anthony@xenproject.org>,
"Juergen Gross" <jgross@suse.com>,
"Huang, Ray" <Ray.Huang@amd.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [XEN PATCH v8 1/5] xen/vpci: Clear all vpci status of device
Date: Fri, 17 May 2024 09:15:35 -0400 [thread overview]
Message-ID: <48901bbd-40ed-4783-992d-9f9ec6a81a24@amd.com> (raw)
In-Reply-To: <BL1PR12MB5849FCB53BDAB6968536E5A5E7EE2@BL1PR12MB5849.namprd12.prod.outlook.com>
On 5/17/24 04:08, Chen, Jiqian wrote:
> On 2024/5/16 21:08, Jan Beulich wrote:
>> On 16.05.2024 11:52, Jiqian Chen wrote:
>>> @@ -67,6 +68,41 @@ ret_t pci_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>>> + pcidevs_lock();
>>> + pdev = pci_get_pdev(NULL, sbdf);
>>> + if ( !pdev )
>>> + {
>>> + pcidevs_unlock();
>>> + ret = -ENODEV;
>>> + break;
>>> + }
>>> +
>>> + write_lock(&pdev->domain->pci_lock);
>>> + ret = vpci_reset_device_state(pdev);
>>> + write_unlock(&pdev->domain->pci_lock);
>>> + pcidevs_unlock();
>>
>> Can't this be done right after the write_lock()?
> You are right, I will move it in next version.
So that we are clear on the proposed order of calls here:
+ write_lock(&pdev->domain->pci_lock);
+ pcidevs_unlock();
+ ret = vpci_reset_device_state(pdev);
+ write_unlock(&pdev->domain->pci_lock);
>>> --- a/xen/drivers/vpci/vpci.c
>>> +++ b/xen/drivers/vpci/vpci.c
>>> @@ -115,6 +115,16 @@ int vpci_assign_device(struct pci_dev *pdev)
>>>
>>> return rc;
>>> }
>>> +
>>> +int vpci_reset_device_state(struct pci_dev *pdev)
>>> +{
>>> + ASSERT(pcidevs_locked());
>>
>> Is this necessary for ...
>>
>>> + ASSERT(rw_is_write_locked(&pdev->domain->pci_lock));
>>> +
>>> + vpci_deassign_device(pdev);
>>> + return vpci_assign_device(pdev);
>>
>> ... either of these calls? Both functions do themselves only have the
>> 2nd of the asserts you add.
> I checked codes again; I will remove the two asserts here in next version.
Nit: I think it's okay to keep the
ASSERT(rw_is_write_locked(&pdev->domain->pci_lock));
next prev parent reply other threads:[~2024-05-17 13:16 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-16 9:52 [XEN PATCH v8 0/5] Support device passthrough when dom0 is PVH on Xen Jiqian Chen
2024-05-16 9:52 ` [XEN PATCH v8 1/5] xen/vpci: Clear all vpci status of device Jiqian Chen
2024-05-16 13:08 ` Jan Beulich
2024-05-17 8:08 ` Chen, Jiqian
2024-05-17 8:20 ` Jan Beulich
2024-05-17 9:28 ` Chen, Jiqian
2024-05-17 9:50 ` Jan Beulich
2024-05-17 10:00 ` Chen, Jiqian
2024-05-17 10:31 ` Jan Beulich
2024-05-17 11:01 ` Chen, Jiqian
2024-05-17 11:48 ` Jan Beulich
2024-05-17 10:03 ` Jürgen Groß
2024-05-17 10:09 ` Chen, Jiqian
2024-05-17 13:15 ` Stewart Hildebrand [this message]
2024-05-16 9:52 ` [XEN PATCH v8 2/5] x86/pvh: Allow (un)map_pirq when dom0 is PVH Jiqian Chen
2024-05-16 13:29 ` Jan Beulich
2024-05-17 8:44 ` Chen, Jiqian
2024-05-16 9:52 ` [XEN PATCH v8 3/5] x86/pvh: Add PHYSDEVOP_setup_gsi for PVH dom0 Jiqian Chen
2024-05-16 13:49 ` Jan Beulich
2024-05-17 9:00 ` Chen, Jiqian
2024-05-17 9:04 ` Jan Beulich
2024-05-16 9:52 ` [RFC XEN PATCH v8 4/5] tools: Add new function to get gsi from dev Jiqian Chen
2024-05-16 9:52 ` [RFC XEN PATCH v8 5/5] domctl: Add XEN_DOMCTL_gsi_permission to grant gsi Jiqian Chen
2024-05-16 14:01 ` Jan Beulich
2024-05-17 10:45 ` Chen, Jiqian
2024-05-17 10:51 ` Jan Beulich
2024-05-17 11:14 ` Chen, Jiqian
2024-05-17 11:50 ` Jan Beulich
2024-05-29 2:41 ` Chen, Jiqian
2024-05-29 6:31 ` Jan Beulich
2024-05-29 6:56 ` Chen, Jiqian
2024-05-29 7:10 ` Jan Beulich
2024-05-29 11:13 ` Chen, Jiqian
2024-05-29 12:22 ` Jan Beulich
2024-05-30 11:19 ` Chen, Jiqian
2024-05-30 15:51 ` Jan Beulich
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=48901bbd-40ed-4783-992d-9f9ec6a81a24@amd.com \
--to=stewart.hildebrand@amd.com \
--cc=Jiqian.Chen@amd.com \
--cc=Ray.Huang@amd.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony@xenproject.org \
--cc=dpsmith@apertussolutions.com \
--cc=george.dunlap@citrix.com \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=julien@xen.org \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=wl@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 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 read-only IMAP folder(s) and NNTP newsgroup(s).