Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp705644pxv; Thu, 15 Jul 2021 14:01:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXyPVKeqwlZrJWnpotMhH35n8KGbb9/YTTqcyx9uxijooI4wCXTPXyPxSF+2Pt5E3ZF1yB X-Received: by 2002:aa7:dcc5:: with SMTP id w5mr9710348edu.355.1626382862853; Thu, 15 Jul 2021 14:01:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626382862; cv=none; d=google.com; s=arc-20160816; b=M2HODpLCkN+1ZJXvFGLGbNqm+2noBp/frZfTp/28dN0UJoM7OglHQPTssc2kXG1+1y 6ZFaJ1HUmw7lZ6eUufzR5x0l0iQp4NLnyVfpfjlG0lhSsIdP3uoq/ieVBL/U1TPd6og7 db3cGJMV27a/VlJJ/MZz7l1NlFrg9EA49A2fYqLYRzQnii2NCYqtePoKAQdXNSScZHj5 FKLlhfpJmS+1lMA2JxrcDnz1Xd+lAi6QZ3Qh7Lf/bmUxiSX3Jl9/EEe6MQl2ILKfcvUE aIWvyKsmgtjMU7nzETFhnyL7dn/feXvs28ePqFPLbEYYpJGj2sZo8K/M4XomzJlUlZsa nXbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=D40yfI90UfEyKyjqS5PPyf0PHtTr3uNRTEB7s4Wb1U0=; b=WZWkm07pthFG5gXsv6w7abAChr6jnhJxrcrCnMXPZu88M8TXYOYWU1F1X5JMw/MUip TGUR9WZrKCWSBNNo6lXxyoXbTboF7YsuK0ysURhpNVMmA3x5Jhs0Ywz0mAQqes7Z2RSl Wai5Np8FeAuMeQrPer5ix6n2F6lZisF6Sl4w7yXk6Pa3q8sZiKVgaahvjCrg8ib5nyF/ v+ATZXJP9rFuzpyiCfe7RanVAd1ixTVg1Xu/kZOXCzKMQXEYbEGYItpInYF9twyIgduR vfwFwqZNHGb+sK/3AGBILfJaO/KH2spOkumbPYDZKz6w1VCmkbs4ia2OLtBcH6eKFveN mnCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f7si8342388ejj.375.2021.07.15.14.00.39; Thu, 15 Jul 2021 14:01:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230076AbhGOQ0z (ORCPT + 99 others); Thu, 15 Jul 2021 12:26:55 -0400 Received: from mga02.intel.com ([134.134.136.20]:6821 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229506AbhGOQ0y (ORCPT ); Thu, 15 Jul 2021 12:26:54 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10046"; a="197765346" X-IronPort-AV: E=Sophos;i="5.84,242,1620716400"; d="scan'208";a="197765346" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2021 09:22:09 -0700 X-IronPort-AV: E=Sophos;i="5.84,242,1620716400"; d="scan'208";a="413692583" Received: from otc-nc-03.jf.intel.com (HELO otc-nc-03) ([10.54.39.36]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2021 09:22:08 -0700 Date: Thu, 15 Jul 2021 09:21:41 -0700 From: "Raj, Ashok" To: Jason Gunthorpe Cc: "Tian, Kevin" , Shenming Lu , "Alex Williamson (alex.williamson@redhat.com)" , Jean-Philippe Brucker , David Gibson , Jason Wang , "parav@mellanox.com" , "Enrico Weigelt, metux IT consult" , Paolo Bonzini , Joerg Roedel , Eric Auger , Jonathan Corbet , "Liu, Yi L" , "Wu, Hao" , "Jiang, Dave" , Jacob Pan , Kirti Wankhede , Robin Murphy , "kvm@vger.kernel.org" , "iommu@lists.linux-foundation.org" , David Woodhouse , LKML , Lu Baolu , "wanghaibin.wang@huawei.com" Subject: Re: [RFC v2] /dev/iommu uAPI proposal Message-ID: <20210715162141.GA593686@otc-nc-03> References: <7ea349f8-8c53-e240-fe80-382954ba7f28@huawei.com> <20210715124813.GC543781@nvidia.com> <20210715135757.GC590891@otc-nc-03> <20210715152325.GF543781@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210715152325.GF543781@nvidia.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 15, 2021 at 12:23:25PM -0300, Jason Gunthorpe wrote: > On Thu, Jul 15, 2021 at 06:57:57AM -0700, Raj, Ashok wrote: > > On Thu, Jul 15, 2021 at 09:48:13AM -0300, Jason Gunthorpe wrote: > > > On Thu, Jul 15, 2021 at 06:49:54AM +0000, Tian, Kevin wrote: > > > > > > > No. You are right on this case. I don't think there is a way to > > > > differentiate one mdev from the other if they come from the > > > > same parent and attached by the same guest process. In this > > > > case the fault could be reported on either mdev (e.g. the first > > > > matching one) to get it fixed in the guest. > > > > > > If the IOMMU can't distinguish the two mdevs they are not isolated > > > and would have to share a group. Since group sharing is not supported > > > today this seems like a non-issue > > > > Does this mean we have to prevent 2 mdev's from same pdev being assigned to > > the same guest? > > No, it means that the IOMMU layer has to be able to distinguish them. Ok, the guest has no control over it, as it see 2 separate pci devices and thinks they are all different. Only time when it can fail is during the bind operation. From guest perspective a bind in vIOMMU just turns into a write to local table and a invalidate will cause the host to update the real copy from the shadow. There is no way to fail the bind? and Allocation of the PASID is also a separate operation and has no clue how its going to be used in the guest. > > This either means they are "SW mdevs" which does not involve the IOMMU > layer and puts both the responsibility for isolation and idenfication > on the mdev driver. When you mean SW mdev, is it the GPU like case where mdev is purely a SW construct? or SIOV type where RID+PASID case? > > Or they are some "PASID mdev" which does allow the IOMMU to isolate > them. > > What can't happen is to comingle /dev/iommu control over the pdev > between two mdevs. > > ie we can't talk about faults for IOMMU on SW mdevs - faults do not > come from the IOMMU layer, they have to come from inside the mdev it > self, somehow. Recoverable faults for guest needs to be sent to guest? A page-request from mdev1 and from mdev2 will both look alike when the process is sharing it. Do we have any isolation requirements here? its the same process. So if the page-request it sent to guest and even if you report it for mdev1, after the PRQ is resolved by guest, the request from mdev2 from the same guest should simply work?