[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patch V2 02/31] genirq/msi: Add mutex for MSI list protection


  • To: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
  • From: Jason Gunthorpe <jgg@xxxxxxxxxx>
  • Date: Wed, 8 Dec 2021 20:47:02 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.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=DcTVV+Ei22uQ3QsSYsqc/2t1gTooA2VnriyB6SbTpXA=; b=YtTB56kxvnXaCDAppfLG/RddniC7Yo4XLEua/0A4E9NRMzK60v6UacvCASIU03+u0Ez6i39o/JlYiCEMVeb0GujRWm5PFnOIw88Dfsnr4Coz54pDGq4kS2fEanYoDoAs2LYE/7ksyia0P6gb4Rz6hGGBBpE3LzSNqsSHwfvzWQMvRIr9EuKp55i4fwD7SVessVXsQCzGze/Q8fe9KTiTNvGFBuX63MWPSB2LB2dCFh/T5r42wacgY7392MxL0H35M5LUumc9dmzNhgmKQX9FU8IHWwZh+bTXijQi8ec+wSwajOKOB6cdB7ltkCHaC9wRGmevHkSou0qbAy1+hTm5ew==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XB8JpUYZUqhaaZfsAbnr6nxUMs7K+RhThO3vZH3TETnzKOdeOT2ciFwTHYXEQ8TyfVDWHAvQMk2hAP9Ju3tY8vrydnGi6DB02fimcHDTY2suoc0kMS8+bVevLU7FOLfAmJkUyu5KL36Tq67PQzDNv7XzxNJuwxqFvyLqWPETgzyltsIBuhEJ34FfbkYF6xFNQqv9PJEgr5fTtdFEEoc9LwUikVfReQWTVliAj1mIrDq7hPKj89umv3fj3agFNN3JNda/cHg6M35cf4cCGH9L3N02X6cK7qE6dz8hbxMhxD9YL8bkl1zkjJ8N7hfpquF3W5aPgDf2who7vgJgAyovGw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com;
  • Cc: LKML <linux-kernel@xxxxxxxxxxxxxxx>, Bjorn Helgaas <helgaas@xxxxxxxxxx>, Marc Zygnier <maz@xxxxxxxxxx>, Alex Williamson <alex.williamson@xxxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Megha Dey <megha.dey@xxxxxxxxx>, Ashok Raj <ashok.raj@xxxxxxxxx>, linux-pci@xxxxxxxxxxxxxxx, Cedric Le Goater <clg@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Juergen Gross <jgross@xxxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, Niklas Schnelle <schnelle@xxxxxxxxxxxxx>, linux-s390@xxxxxxxxxxxxxxx, Heiko Carstens <hca@xxxxxxxxxxxxx>, Christian Borntraeger <borntraeger@xxxxxxxxxx>, Logan Gunthorpe <logang@xxxxxxxxxxxx>, Jon Mason <jdmason@xxxxxxxx>, Dave Jiang <dave.jiang@xxxxxxxxx>, Allen Hubbe <allenbh@xxxxxxxxx>, linux-ntb@xxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 09 Dec 2021 00:47:22 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Dec 06, 2021 at 11:51:05PM +0100, Thomas Gleixner wrote:
> +++ b/kernel/irq/msi.c
> @@ -127,12 +127,37 @@ int msi_setup_device_data(struct device
>               return -ENOMEM;
>  
>       INIT_LIST_HEAD(&md->list);
> +     mutex_init(&md->mutex);
>       dev->msi.data = md;
>       devres_add(dev, md);
>       return 0;
>  }
>  
>  /**
> + * msi_lock_descs - Lock the MSI descriptor storage of a device
> + * @dev:     Device to operate on
> + */
> +void msi_lock_descs(struct device *dev)
> +{
> +     if (WARN_ON_ONCE(!dev->msi.data))
> +             return;

Is this useful? Other places that call msi_lock_descs will continue on and deref
null dev->msi anyhow - is the dump from the WARN_ON that much better
than the oops from the null deref here:

> +     mutex_lock(&dev->msi.data->mutex);

?

Honestly, still a bit unclear on what the community consensus is for
using WARN_ON.

Jason



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.