From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA652C43214 for ; Fri, 23 Jul 2021 08:12:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D3ABC60E8E for ; Fri, 23 Jul 2021 08:12:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234351AbhGWHbl (ORCPT ); Fri, 23 Jul 2021 03:31:41 -0400 Received: from verein.lst.de ([213.95.11.211]:37547 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233619AbhGWHbk (ORCPT ); Fri, 23 Jul 2021 03:31:40 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id E2D7267373; Fri, 23 Jul 2021 10:12:08 +0200 (CEST) Date: Fri, 23 Jul 2021 10:12:08 +0200 From: Christoph Hellwig To: Jason Gunthorpe Cc: David Airlie , Tony Krowiak , Alex Williamson , Christian Borntraeger , Cornelia Huck , Jonathan Corbet , Daniel Vetter , Diana Craciun , dri-devel@lists.freedesktop.org, Eric Auger , Eric Farman , Harald Freudenberger , Vasily Gorbik , Heiko Carstens , intel-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, Jani Nikula , Jason Herne , Joonas Lahtinen , kvm@vger.kernel.org, Kirti Wankhede , linux-doc@vger.kernel.org, linux-s390@vger.kernel.org, Matthew Rosato , Peter Oberparleiter , Halil Pasic , Rodrigo Vivi , Vineeth Vijayan , Zhi Wang , "Raj, Ashok" , Christoph Hellwig , Leon Romanovsky , Max Gurtovoy , Yishai Hadas , Zhenyu Wang Subject: Re: [PATCH v2 10/14] vfio/pci: Reorganize VFIO_DEVICE_PCI_HOT_RESET to use the device set Message-ID: <20210723081208.GE2795@lst.de> References: <0-v2-b6a5582525c9+ff96-vfio_reflck_jgg@nvidia.com> <10-v2-b6a5582525c9+ff96-vfio_reflck_jgg@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <10-v2-b6a5582525c9+ff96-vfio_reflck_jgg@nvidia.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Tue, Jul 20, 2021 at 02:42:56PM -0300, Jason Gunthorpe wrote: > Like vfio_pci_try_bus_reset() this code wants to reset all of the devices > in the "reset group" which is the same membership as the device set. > > Instead of trying to reconstruct the device set from the PCI list go > directly from the device set's device list to execute the reset. > > The same basic structure as vfio_pci_try_bus_reset() is used. The > 'vfio_devices' struct is replaced with the device set linked list and we > simply sweep it multiple times under the lock. > > This eliminates a memory allocation and get/put traffic and another > improperly locked test of pci_dev_driver(). Looks fine. But oh gad is that locking scheme awful.. Signed-off-by: Christoph Hellwig