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 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B5B50C4332F for ; Fri, 29 Apr 2022 20:28:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DCFE110FA6E; Fri, 29 Apr 2022 20:28:27 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6DAD110FA6E for ; Fri, 29 Apr 2022 20:28:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651264105; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n8HsfkpqhssnZoIsPQ1O3oVRAyXbkapxW4GnxH0gSv4=; b=OXyk+ZlA2xofIDLIpoh4YJ+rLWv81XKCIyy/IB39BgGEe31RKH4WNLCYpEDcIa1ShrAN2n Df/3G8VM/wCkyyVQ1ZiPCi2WCGcyyQGgVCm4XzcCAkmyd+sygyQJLNjtrtFnsUkDESUdmC f8FSupPV971Lb1Wl1zABlpBDfU5IZDE= Received: from mail-il1-f197.google.com (mail-il1-f197.google.com [209.85.166.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-212-FT7fs6G4MHK_kwXqdFBdtA-1; Fri, 29 Apr 2022 16:28:24 -0400 X-MC-Unique: FT7fs6G4MHK_kwXqdFBdtA-1 Received: by mail-il1-f197.google.com with SMTP id l13-20020a056e021c0d00b002cc38cb4554so4184338ilh.10 for ; Fri, 29 Apr 2022 13:28:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n8HsfkpqhssnZoIsPQ1O3oVRAyXbkapxW4GnxH0gSv4=; b=shocI1hDjGAIa9qpJ2panmaFaG4J9eGBQ7k29puBDLO6GrJQVijlccA/x7nPlHCjXy pzQehmyPTctpAnwIXH3USxzWFqMYWFHZXtqDbBNF5B6GZme7zhx4LzxHaRQkwc74CVan NAI6vKZT8eK8i4tC+QbBt4fC3mW/vm2kXDOn5k3V4+wP20DQNddt5aOP7PGIT2z4+IQG NMjSQ5YOKy5wQ6yVT7HZF95Q2SYBXlAzpZG7Mdmp5hTqk03XiHZYoPUNr1HUWjVuOwpW a8spDdk/x3DUAE/LX2JfhSQxzmPr2fsrlIpXzbTXdVBXcEew8SUJy8uOS3fpbMSOOTF3 Sf9Q== X-Gm-Message-State: AOAM531jK+mJfNl1ltKaM8MF9AOTyHojrcj05V3rziDC09bCE4lsw2Bu 9QRgGCnXII2HcWqV8dVOLaRiXK2bU+P7GGRGkmRwlRQXlFkzTo/mqYQ16A6dVbjceutX4nbTWBc I01Fvy94iFToLTpMCP1fS1LA2cfiZ X-Received: by 2002:a6b:ca44:0:b0:657:b54a:5c53 with SMTP id a65-20020a6bca44000000b00657b54a5c53mr445925iog.108.1651264103327; Fri, 29 Apr 2022 13:28:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXw055Zf6CAZcffMOqFXVe3D8deItwuTS9dyUJRlHujGyFKq6cxPYeLOoiZHbK09XyaEEw5w== X-Received: by 2002:a6b:ca44:0:b0:657:b54a:5c53 with SMTP id a65-20020a6bca44000000b00657b54a5c53mr445889iog.108.1651264103032; Fri, 29 Apr 2022 13:28:23 -0700 (PDT) Received: from redhat.com ([38.15.36.239]) by smtp.gmail.com with ESMTPSA id j7-20020a02cb07000000b0032b3a7817b2sm836302jap.118.2022.04.29.13.28.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Apr 2022 13:28:22 -0700 (PDT) Date: Fri, 29 Apr 2022 14:28:20 -0600 From: Alex Williamson To: Jason Gunthorpe Message-ID: <20220429142820.6afe7bbe.alex.williamson@redhat.com> In-Reply-To: <7-v2-6011bde8e0a1+5f-vfio_mdev_no_group_jgg@nvidia.com> References: <0-v2-6011bde8e0a1+5f-vfio_mdev_no_group_jgg@nvidia.com> <7-v2-6011bde8e0a1+5f-vfio_mdev_no_group_jgg@nvidia.com> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=alex.williamson@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Intel-gfx] [PATCH v2 7/7] vfio: Remove calls to vfio_group_add_container_user() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, linux-doc@vger.kernel.org, David Airlie , dri-devel@lists.freedesktop.org, Kirti Wankhede , Vineeth Vijayan , Alexander Gordeev , Christoph Hellwig , linux-s390@vger.kernel.org, "Liu, Yi L" , Matthew Rosato , Jonathan Corbet , Halil Pasic , Christian Borntraeger , intel-gfx@lists.freedesktop.org, Tony Krowiak , Eric Farman , Vasily Gorbik , Heiko Carstens , Harald Freudenberger , Rodrigo Vivi , intel-gvt-dev@lists.freedesktop.org, Jason Herne , Cornelia Huck , Peter Oberparleiter , Sven Schnelle Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Thu, 21 Apr 2022 13:28:38 -0300 Jason Gunthorpe wrote: > When the open_device() op is called the container_users is incremented and > held incremented until close_device(). Thus, so long as drivers call > functions within their open_device()/close_device() region they do not > need to worry about the container_users. > > These functions can all only be called between open_device() and > close_device(): > > vfio_pin_pages() > vfio_unpin_pages() > vfio_dma_rw() > vfio_register_notifier() > vfio_unregister_notifier() > > Eliminate the calls to vfio_group_add_container_user() and add > vfio_assert_device_open() to detect driver mis-use. A comment here explaining that decrementing open_count is pushed until after close_device to support this feature would help to explain the somewhat subtle change in vfio_group_get_device_fd(). Otherwise the series looks ok with fixes noted by previous reviews. Thanks, Alex