Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3578981iob; Tue, 17 May 2022 03:08:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyb9lry58H0OWCran9LZA+QVRy3YWK2dpep1K2x1kzRhUrGNfjirLYq4ZW37wrr+mEer50D X-Received: by 2002:a05:6a00:1501:b0:510:7ab8:71c8 with SMTP id q1-20020a056a00150100b005107ab871c8mr21628079pfu.63.1652782086631; Tue, 17 May 2022 03:08:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652782086; cv=none; d=google.com; s=arc-20160816; b=zmmG8WUGemgac9tgfyacFHR9eN8B2CAMHhaFOnY4S57eweIO8IvJy0svy2Pv2eK64i uTckbpyvJK+GN/EuRaQMlVLNeUCcxxGkKJ45JkZhw2q8J8CxXTVovP4Dw5NJVpxGgG52 VMPXgFnt9y1SCSES4VI0dNvhekg6/5KJ0KSuRipv1+tJSZXeiUIidldcOhRIP9E5Cdsb xTsFvrLQTOkvdNdcJe/nF6zIcHCQkC6uGSGkx1HNvfUviFqqBtYhrr7C6XH7Mh2rLSU6 ucX5JX/gHl4W+FhjCZ6WHLDimoX10u1LM/zUz9H9Mbp21VRdDXqYZvnDhnvJUGSO92It PdmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=+tK7o+o7Kj2BQK1w3k57mXkaPLoN/4QFNnxgOKxEuBU=; b=brM+rmcHuF1zmAzZuQI02OD/ij+FWrQ0RXfpE/D3MW2iwlwa3ZNvQHwqpMvsZPkho3 j5M85DCbZnFHkQAISSoUz/FPeX8wPBHJ49iD9ndVsCx9g2Q5y3tSVPHeALLctH3y/lwb MU6cQqVSAh2oaszeeHVtZsXe+Sqof3ydzguhv1JHWgXLtzOTHzL4o1sEQ1sa4qA0p4S1 ODRijKl23lBJO2z7M5350I+nPvfUqWjhePjIdJt92Z0aSZr2gnUaneFBQJG/ENJHFoYs E+qFVCYCTJxr0SGhxENntu9F3SVuFGHC7ukKAFswrQWHMccOxaqAh7ieuNO+qXks3YzF NGWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LfTk844f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f21-20020a635115000000b003f25b1f2a0asi8894039pgb.783.2022.05.17.03.07.53; Tue, 17 May 2022 03:08:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LfTk844f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345500AbiEPTkY (ORCPT + 99 others); Mon, 16 May 2022 15:40:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345602AbiEPTi5 (ORCPT ); Mon, 16 May 2022 15:38:57 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A71EF3F88E for ; Mon, 16 May 2022 12:38:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652729923; 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=+tK7o+o7Kj2BQK1w3k57mXkaPLoN/4QFNnxgOKxEuBU=; b=LfTk844feNuMvpixAdumjrUNDcHZdcpR2OOLbwIT6WZkwqyRUUUSo14HjfSQmi5O+qx0uF GVY5iJrG+oTUNovTVw91mVu849UNw6zx5KTMSEQzuUyYFleWYIsDAMKJuH9c5BasnkoBXF eZMNUm3iNy3Yy0DceMnkWUketa94lPM= Received: from mail-il1-f199.google.com (mail-il1-f199.google.com [209.85.166.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-113-DBgmTOhsPc6xdxXVZ6Sw1Q-1; Mon, 16 May 2022 15:38:42 -0400 X-MC-Unique: DBgmTOhsPc6xdxXVZ6Sw1Q-1 Received: by mail-il1-f199.google.com with SMTP id s6-20020a056e021a0600b002d0fe2b6d2fso3810751ild.12 for ; Mon, 16 May 2022 12:38:42 -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:organization:mime-version:content-transfer-encoding; bh=+tK7o+o7Kj2BQK1w3k57mXkaPLoN/4QFNnxgOKxEuBU=; b=h8W40qIVLnqzZuLoUWzizxjijmmUdOmfaeo05QwjGhVv5wLNEk5F8HDQcY1WC8XQGh STjVziEBXYgvA+nrCTgBPyjCoSG6VqxA0NphqZ38f1XPAQXx0iBjb27JQDRjBtDSgeYQ xyhXd8L0NbWFHDFb3ttvm2N/omI9fL72Mki8GWtZGJxOSl+V44A+t4+cstonjO/dNV/e kNqU+DQjYp66eCXWmxGxpvJqvxcEmeh0bWrDG5UiIjn9bt1PY7GDv2XVDBlm7vFLEZAv LiOxDPQhRlRgeLETXMHmO9/39ehQVJ8A6x24U9vRwzGnVcSn7O9HKONpEu3Er1VI9sx4 Lkxw== X-Gm-Message-State: AOAM5320PxkkNAc0ip+NRIxzyw/0QIgYdoMVNrTfohKDS9RQXWoBbdjr 8J1Fa2YlKxpNYcxNra6pwAoAYghBnkUnRXPUDJoXs0e3myPN0gWfokPouInsCji5XvnUg5E4GZ2 JlJB9OT/riZP8ZicBwhDjZDXl X-Received: by 2002:a05:6638:41a9:b0:32e:415a:a8a9 with SMTP id az41-20020a05663841a900b0032e415aa8a9mr2168794jab.101.1652729921713; Mon, 16 May 2022 12:38:41 -0700 (PDT) X-Received: by 2002:a05:6638:41a9:b0:32e:415a:a8a9 with SMTP id az41-20020a05663841a900b0032e415aa8a9mr2168777jab.101.1652729921515; Mon, 16 May 2022 12:38:41 -0700 (PDT) Received: from redhat.com ([38.15.36.239]) by smtp.gmail.com with ESMTPSA id v20-20020a02b914000000b0032e049b2949sm2803562jan.101.2022.05.16.12.38.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 12:38:41 -0700 (PDT) Date: Mon, 16 May 2022 13:38:39 -0600 From: Alex Williamson To: Jason Gunthorpe Cc: Matthew Rosato , linux-s390@vger.kernel.org, cohuck@redhat.com, schnelle@linux.ibm.com, farman@linux.ibm.com, pmorel@linux.ibm.com, borntraeger@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com, gerald.schaefer@linux.ibm.com, agordeev@linux.ibm.com, svens@linux.ibm.com, frankja@linux.ibm.com, david@redhat.com, imbrenda@linux.ibm.com, vneethv@linux.ibm.com, oberpar@linux.ibm.com, freude@linux.ibm.com, thuth@redhat.com, pasic@linux.ibm.com, pbonzini@redhat.com, corbet@lwn.net, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: Re: [PATCH v7 17/22] vfio-pci/zdev: add open/close device hooks Message-ID: <20220516133839.7e116489.alex.williamson@redhat.com> In-Reply-To: <20220516183558.GN1343366@nvidia.com> References: <20220513191509.272897-1-mjrosato@linux.ibm.com> <20220513191509.272897-18-mjrosato@linux.ibm.com> <20220516172734.GE1343366@nvidia.com> <7a31ec36-ceaf-dcef-8bd0-2b4732050aed@linux.ibm.com> <20220516183558.GN1343366@nvidia.com> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 16 May 2022 15:35:58 -0300 Jason Gunthorpe wrote: > On Mon, May 16, 2022 at 02:30:46PM -0400, Matthew Rosato wrote: > > > Conceptually I think this would work for QEMU anyway (it always sets the kvm > > before we open the device). I tried to test the idea quickly but couldn't > > get the following to apply on vfio-next or your vfio_group_locking -- but I > > understand what you're trying to do so I'll re-work and try it out. > > I created it on 8c9350e9bf43de1ebab3cc8a80703671e6495ab4 which is the > vfio_group_locking.. I can send you a github if it helps > https://github.com/jgunthorpe/linux/commits/vfio_group_lockin > > > @Alex can you think of any usecase/reason why we would need to be able to > > set the KVM sometime after the device was opened? Doing something like > > below would break that, as this introduces the assumption that the group is > > associated with the KVM before the device is opened (and if it's not, the > > device open fails). > > Keep in mind that GVT already hard requires this ordering to even > allow open_device to work - so it already sets a floor for what > userspace can do.. How is this going to work when vfio devices are exposed directly? We currently have a strict ordering through the group to get to the device, and it's therefore a reasonable requirement for userspace to register the group with kvm before opening the device. Is the notifier and async KVM registration necessary to support this dependency with direct device access? I don't have as clear a picture of the ordering with with direct access. Thanks, Alex