[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v9 02/16] vpci: use per-domain PCI lock to protect vpci structure
- To: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Wed, 20 Sep 2023 10:09:14 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FiCVSrzuV0cihNYsA+nq97bZjh6d/A8HmUwpLWcWz28=; b=a2x624R0NynmQdR8bSBUIMEELRbcJ+sc9wk6aLDmDD0ycDmPlOpQRGABIt5OjEMJ8LszthEMpOotiCrB4mIUNVTzZUdB55ZThauZpr0BEMxWgOuX2g8bjIC5QrUBwYmDe9PU5MAu6lBTI1mA5Kc8GvEVDMkvAqUlk06jSilxsqZowhCequwAYq2O2i+v6MIERToVcTCeBRQGx5KmxbDi6lecqK/tuEyNmlmYjfK3vz00U/tqPYdWsc48IbRN4BXro3eKTMahmWaQOGOJNF087rqLpxeHfD5xTvXTVM9Kpp4BSsxSHBgM4PR3kFkTv2eTltpl5m3x02jzqTgtvdkcsg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YUp8yR+J9AwdhHT1n+AS6ycKVhjZhuO/h93qE1RDPYZz+G1DZO/flPhvHOHgJgztxC3d3ecaXQWBljm1psw/kk/KoU/ttoFt22qoFfemVyN7KpuPSgdMfO2PDmvh20kqk/Me5tVkhtdIbFnvcoTikrS9TGPF5J/a0My0c1/YB3hDmm1Y6jp7AZtM0atS8K+RW721JqBej9l+NXo9WHoEPVrMcBklhLaaCIbAzB+o+sLe77xJpOcZ9QxFInHrN86cywpiviyJUk6w4DRR0oRG/guTFSw7UoXQqJgK5X6X+B2Ag6g2eYEl5hgBbXy3pfYYKXxsFF74hE2Bl2XGoIN+Qg==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Jun Nakajima <jun.nakajima@xxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Paul Durrant <paul@xxxxxxx>
- Delivery-date: Wed, 20 Sep 2023 08:09:43 +0000
- Ironport-data: A9a23:96Dv1aIP8VUaG+8PFE+RbJQlxSXFcZb7ZxGr2PjKsXjdYENSgTUFz zYcD22BbvjfMDfyKt4nPIWzo00BvJKBztI1TVNlqX01Q3x08seUXt7xwmUcnc+xBpaaEB84t ZV2hv3odp1coqr0/0/1WlTZhSAhk/nOHvylULKs1hlZHWdMUD0mhQ9oh9k3i4tphcnRKw6Ws Jb5rta31GWNglaYCUpKrfrZwP9TlK6q4mhA7wZmPakjUGL2zBH5MrpOfcldEFOgKmVkNrbSb /rOyri/4lTY838FYj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnVaPpIAHOgdcS9qZwChxLid/ jnvWauYEm/FNoWU8AgUvoIx/ytWZcWq85efSZSzXFD6I+QrvBIAzt03ZHzaM7H09c5mGGBF3 s1bIQw8fzXYje6Q3puWU8Vj05FLwMnDZOvzu1lG5BSBUbMKZM6GRK/Ho9hFwD03m8ZCW+7EY NYUYiZuaxKGZABTPlAQC9Q1m+LAanvXKmUE7g7K4/VspTSMpOBy+OGF3N79YNuFSN8Thk+Fj mnH4374ElcRM9n3JT+tqyj32LeQw3yhMG4UPLKHzMFVhFnI+nAOTzFIDQegqNqnj2frDrqzL GRRoELCt5Ma71CmUdDnQ1u4oXqIsxQGUtxcO+Q/5EeGza+8yzieAm8IXztQcusMvcU9RSEp/ lKRltavDjtq2JWFRHTY+rqKoDeaPSkOMXREdSICVREC4dTovMc0lB2nZvFnHa2uh9v5AwbZx TyQsTM+jLUei80M/6ij9FWBiDWpzrDLRAMo4gTcXkq+8xh0IoWiYuSA9lzz/ftGaoGDQTGpv mUC3c6X7+kMDJSEvC2LXOgJWrqu4p6tMzDCgFgpA5go8Rys/WKuecZb5zQWDF9gL8IsaTLvJ kjJtmtsCIR7OXKraep7Zty3AsFykaz4T4y5CbbTc8ZEZYV3eEmf5iZyaEWM3mfr1k8xjaU4P pTdesGpZZoHNZlaIPONb791+dcWKuoWnws/mbiTI8yb7Iej
- Ironport-hdrordr: A9a23:v6Qbc6o3Fpt42Sv4YW6wq58aV5oJeYIsimQD101hICG9E/bo8v xG+c5wuCMc5wx8ZJhNo7+90dC7MBThHP1OkOss1NWZPDUO0VHARL2Ki7GN/9SKIVycygcy78 Zdmp9FebnN5AhB5voSODPIaerIGuP3iJxAWN2uqUuFkTsaEJ2IMT0JdzpyfSVNNXB7OaY=
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Tue, Sep 19, 2023 at 12:20:39PM -0400, Stewart Hildebrand wrote:
> On 9/19/23 11:39, Roger Pau Monné wrote:
> > On Tue, Aug 29, 2023 at 11:19:42PM +0000, Volodymyr Babchuk wrote:
> >> diff --git a/xen/drivers/vpci/msi.c b/xen/drivers/vpci/msi.c
> >> index 8f2b59e61a..a0733bb2cb 100644
> >> --- a/xen/drivers/vpci/msi.c
> >> +++ b/xen/drivers/vpci/msi.c
> >> @@ -318,15 +321,28 @@ void vpci_dump_msi(void)
> >> * holding the lock.
> >> */
> >> printk("unable to print all MSI-X entries: %d\n", rc);
> >> - process_pending_softirqs();
> >> - continue;
> >> + goto pdev_done;
> >> }
> >> }
> >>
> >> spin_unlock(&pdev->vpci->lock);
> >> + pdev_done:
> >> + /*
> >> + * Unlock lock to process pending softirqs. This is
> >> + * potentially unsafe, as d->pdev_list can be changed in
> >> + * meantime.
> >> + */
> >> + read_unlock(&d->pci_lock);
> >> process_pending_softirqs();
> >> + if ( !read_trylock(&d->pci_lock) )
> >> + {
> >> + printk("unable to access other devices for the domain\n");
> >> + goto domain_done;
> >
> > Shouldn't the domain_done label be after the read_unlock(), so that we
> > can proceed to try to dump the devices for the next domain? With the
> > proposed code a failure to acquire one of the domains pci_lock
> > terminates the dump.
> >
> >> + }
> >> }
> >> + read_unlock(&d->pci_lock);
> >> }
> >> + domain_done:
> >> rcu_read_unlock(&domlist_read_lock);
> >> }
> >>
>
> With the label moved, a no-op expression after the label is needed to make
> the compiler happy:
>
> }
> }
> read_unlock(&d->pci_lock);
> domain_done:
> (void)0;
> }
> rcu_read_unlock(&domlist_read_lock);
> }
>
>
> If the no-op is omitted, the compiler may complain (gcc 9.4.0):
>
> drivers/vpci/msi.c: In function ‘vpci_dump_msi’:
> drivers/vpci/msi.c:351:2: error: label at end of compound statement
> 351 | domain_done:
> | ^~~~~~~~~~~
Might be better to place the label at the start of the loop, and
likely rename to next_domain.
Thanks, Roger.
|