Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3472639ioo; Wed, 25 May 2022 01:05:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBcfdJRXgd4Rbuf4D9vjn86klW9D6lxJhGwrK0uHbM6VB0ss0gZ+y9QrkNMKMDkWELkieM X-Received: by 2002:a05:6402:90d:b0:428:bda9:3e6b with SMTP id g13-20020a056402090d00b00428bda93e6bmr32796332edz.132.1653465957365; Wed, 25 May 2022 01:05:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653465957; cv=none; d=google.com; s=arc-20160816; b=IUWZgUSNJG/sjtLO44nFEhLH7R6riIckAyD1VHkeUtWmhxqUdFczwpIZb8NhNz3+Fs S6HR9RGNR3E77aASl1BMFdWLXo6gj3NtC8OeG6VKhfcF3wHrjlqduoh2iNmjXi8df1Jd yosqRSIlQG1PvXD9F+OciHIQj5NNzRawcki9o8S41/UHm5Ah/4YLliIrkuh5iHvv5Mfr FCWzEUn6q/8wYSw8mqMds0JxAlfdD6UqkqGZ8fKcvIO1CNxCjIfRph0+shSb98oSuyfH BB1x0/8WmqdAiSNTqY2OAHMwouZAn1yfSN0O7SVXKsReNaXldRefSkIvGL8/P+tiqNlv j3RQ== 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=AjP5JPsp4sTeptQO7etKphezL1GL7XatlC7yllc+qq4=; b=nqtKwk7UwCQyMJE4I7OBjTxF77Z4Y95mCcqgqa/edklp2jVqF2YHoIO0qGnxU/htRy GOwefRUzIw86w+rj5YRIIahZFI4QNbnQL1/VxpTmasVl57kvs76GIe+bT99rNs2/SAmU 2y8vs+4bQR5KjBfz3wgRQLzxFcFAJOUNosyq7Jjj4WIAedEW0tIu9ZOt7MYSCpu4H/ca MKKiJST10Pnc2FX/QY/WZjf1AeH+kZ5x0Ihp/Vkw0UISU/IGHjPVLq891N/WB3xAMfNw cjlAWXZtiHlVY0kF90gia/fpAYj+pEAt8AKp+LgIJeV+rOU2v636i8D/khoa3q/PXcbs MXlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gBszV04d; 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 r12-20020a05640251cc00b0042ac7280c0csi7607664edd.8.2022.05.25.01.05.28; Wed, 25 May 2022 01:05:57 -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=gBszV04d; 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 S239652AbiEXQIH (ORCPT + 99 others); Tue, 24 May 2022 12:08:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239546AbiEXQH5 (ORCPT ); Tue, 24 May 2022 12:07: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 4BA11762AA for ; Tue, 24 May 2022 09:07:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653408469; 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=AjP5JPsp4sTeptQO7etKphezL1GL7XatlC7yllc+qq4=; b=gBszV04dxkBikKwPnzba24F8oMtXGniV4mRYLr8ldd6XAvXs0M8WDz/Q9aXY4SuoAWePFO dzIsnZ4xYfFiXkv4luf1h+thscCv+InT1bchstFtO/57oNXX3fENHq7SMiu9YuKnXbxNRb +KKqeRogxNYKsS2mmOa0prFJyuey7SY= Received: from mail-il1-f200.google.com (mail-il1-f200.google.com [209.85.166.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-495-PlUO2xNJNuWUlL1N1VpnTA-1; Tue, 24 May 2022 12:07:48 -0400 X-MC-Unique: PlUO2xNJNuWUlL1N1VpnTA-1 Received: by mail-il1-f200.google.com with SMTP id g11-20020a056e021e0b00b002d1b5e8389bso3401671ila.2 for ; Tue, 24 May 2022 09:07:47 -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=AjP5JPsp4sTeptQO7etKphezL1GL7XatlC7yllc+qq4=; b=6qUajJwrP+NzXnDpgeUNzJc2I0mcVGr5O4ZD0LGfWE5mJ8yFEOaH7oxi9G/2nOgI8o mAOGlsaf6mJ73uSpxCmheJp5B06D3jOPzDqwSNA0T2OAHd6DLSgbmEpwPo9FimbQF73d wXXZ+whzBP6ZLI8hHKS0EFMHtaebafGnuQwcS8bfAvykk9kZfKhqtfn/XPtcdBChnVdt HMgkRrCy+qCh8in3SnkR92pzU2eacASXIHq7CwpBYlZbT9WLzdaoncJ0RHSTeGlcIYBB Y/9pjrL7kMr3Aa5M9rxzQ1jukfdZvnhUM/CtJYHiKy0U9TU3vNAkNe+I42wC/ztmMz7+ Q46A== X-Gm-Message-State: AOAM533VQLgVNjRs1k1YUIF3zsxA6P66oa3Y9luCxjUMk+gCTK8tTxWm pGTpeVFiPf0l2Tp2VUdKb6M8Q5Ut2TwfXTdrFKp7yB0oTrK71ICviHl+tn3OzQ4TDyVb/BqgH3X 67pMzC+sl/wTT/hh5Uxj8W8Tk X-Received: by 2002:a05:6e02:170a:b0:2d1:3f8b:ad75 with SMTP id u10-20020a056e02170a00b002d13f8bad75mr13606324ill.135.1653408467257; Tue, 24 May 2022 09:07:47 -0700 (PDT) X-Received: by 2002:a05:6e02:170a:b0:2d1:3f8b:ad75 with SMTP id u10-20020a056e02170a00b002d13f8bad75mr13606312ill.135.1653408467062; Tue, 24 May 2022 09:07:47 -0700 (PDT) Received: from redhat.com ([38.15.36.239]) by smtp.gmail.com with ESMTPSA id m15-20020a056e021c2f00b002cde6e352d5sm4628333ilh.31.2022.05.24.09.07.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 May 2022 09:07:46 -0700 (PDT) Date: Tue, 24 May 2022 10:07:45 -0600 From: Alex Williamson To: Matthew Rosato Cc: jgg@nvidia.com, cohuck@redhat.com, borntraeger@linux.ibm.com, jjherne@linux.ibm.com, akrowiak@linux.ibm.com, pasic@linux.ibm.com, zhenyuw@linux.intel.com, zhi.a.wang@intel.com, hch@infradead.org, intel-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 0/1] vfio: remove VFIO_GROUP_NOTIFY_SET_KVM Message-ID: <20220524100745.006a3635.alex.williamson@redhat.com> In-Reply-To: <20220519183311.582380-1-mjrosato@linux.ibm.com> References: <20220519183311.582380-1-mjrosato@linux.ibm.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.5 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 Thu, 19 May 2022 14:33:10 -0400 Matthew Rosato wrote: > As discussed in this thread: > > https://lore.kernel.org/kvm/20220516172734.GE1343366@nvidia.com/ > > Let's remove VFIO_GROUP_NOTIFY_SET_KVM and instead assume the association > has already been established prior to device_open. For the types today > that need a KVM (GVT, vfio-ap) these will fail if a KVM is not found. > Looking ahead, vfio-pci-zdev will optionally want the KVM association > (enable hardware assists) but it will not be a hard requirement (still > want to allow other, non-KVM userspace usage). > > This is built on top of vfio-next and tested with s390x-pci > (zdev-kvm series) and vfio-ap (GVT changes are compile-tested only) > > Changes for v3: > - merge branches under if (device->open_count == 1) (Kevin) > - move device->open_count-- out from group_rwsem (Kevin) > - drop null KVM check (Christoph) > - remove extra kvm_{get,put}_kvm from vfio_ap_ops, it was already getting > a reference (Jason) > - Add comment about kvm reference in vfio.h (Jason) > - Return -EINVAL if !kvm for vfio-ap (Tony) > > Changes for v2: > - gvt no longer needs release_work, get rid of it (Christoph) > - a few compile fixes for gvt > - update commit to mention fixes gvt oops (Jason) > - s/down_write/down_read/ in a few spots (Jason) > - avoid kvm build dependency by holding group read lock over device > open/close and put the onus on the driver to obtain a reference if > it will actually use the kvm pointer. Document the requirement, > use lockdep_assert to ensure lock is held during register_notifer; > today all callers are from driver open_device. > > Matthew Rosato (1): > vfio: remove VFIO_GROUP_NOTIFY_SET_KVM > > drivers/gpu/drm/i915/gvt/gtt.c | 4 +- > drivers/gpu/drm/i915/gvt/gvt.h | 3 - > drivers/gpu/drm/i915/gvt/kvmgt.c | 82 ++++++-------------------- > drivers/s390/crypto/vfio_ap_ops.c | 35 ++--------- > drivers/s390/crypto/vfio_ap_private.h | 3 - > drivers/vfio/vfio.c | 83 ++++++++++----------------- > include/linux/vfio.h | 6 +- > 7 files changed, 57 insertions(+), 159 deletions(-) Applied to vfio next branch for v5.19. Thanks, Alex