Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5123169pxj; Wed, 9 Jun 2021 09:37:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaGloOZH+WLyTYDoEbcJeVrjIQlnpIhuvKxO7QWqhUHgwJq1XcYVb8AmUvcxc9Vs8nI0YA X-Received: by 2002:a05:6402:1644:: with SMTP id s4mr347765edx.190.1623256679314; Wed, 09 Jun 2021 09:37:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623256679; cv=none; d=google.com; s=arc-20160816; b=ov8ZkP/0oPptikLnYob3q2hQgsvVe0qqCniPdEVVTftD9WCk5/1RwFrH0wcwCg7RYv kgq7q3X3tDXnBkmjW4dTGt8exaTq6SRDrsmbdmfWBC5YWpTSiQ2jIHYAemonsseqcNz2 a91a+bpRQg5D1Bmy8BR8m0ETWiLcen7hCTKgfKx0hT7gb6SboASIHtjzwbqxWlhN1ATf QXCNsD3SVFDbFtTInDbqX4Hdom/DOZnWaXjS758CQB+IYQ0R4z2BxMTZxrrvMYc45QPx DxPhYAa506CT+GfimBzwYY4okTtmBeTTsdXNa7Rwu5pAsAHMRsEoOjAqDK/h928KwMe1 WALA== 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=ZKvRJP1Qn2FuRIKKae+xpipPvYviXO+rudBhyvwgw04=; b=tbMAeDbCAm0EqIiP8szz0/YXu0NV/D4WBAZBAb/Kf+sn3tcODczDafXUSIkrVOvmp5 P0t8s1FixH3GtJWAne8+sljMy4tDj9WCYKOJ7Aaw3AHBjIwyl7XeuCl3vK2p568vyRLN jKVzaWlZHdOMTfedt8Wn1qSEOn8aX94FXbqyzjybycID9K+GHrIM/7gQ46RPSNN7DeKG MwolQHV02minRHn8svme+YIv14yYwdkYEFI7ZqlxDWTYTuXsS1utGm10Vvy+EtKWrFbR feF6ZK0MofyE+fqGoN7z7yeHMAL424fihnk3JhYKdE+pYJkXZwuCiTRNA41302dAj8kA X7IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=D3Z8TIeJ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h16si154799edv.213.2021.06.09.09.37.35; Wed, 09 Jun 2021 09:37:59 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=D3Z8TIeJ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233896AbhFIQRd (ORCPT + 99 others); Wed, 9 Jun 2021 12:17:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:25065 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231251AbhFIQRc (ORCPT ); Wed, 9 Jun 2021 12:17:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623255337; 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=ZKvRJP1Qn2FuRIKKae+xpipPvYviXO+rudBhyvwgw04=; b=D3Z8TIeJDtrdNYPocssvdItBYl2bCOHvD6pV6hgLwHnYjOmbpuUX0Tr9wCNN5JytEtkcFw KZeLefoAoJF7Trr7RpUtktQqJj/1VxPmBiwWoi9mRfI+PqeKGJsiNqSVTd+aNGH1bHnPjD nkDx+yA3sScgkjjJ5BPQiom9ZgmiQXc= Received: from mail-ot1-f70.google.com (mail-ot1-f70.google.com [209.85.210.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-209-NLee3tprN6KI74R1M1dUow-1; Wed, 09 Jun 2021 12:15:35 -0400 X-MC-Unique: NLee3tprN6KI74R1M1dUow-1 Received: by mail-ot1-f70.google.com with SMTP id 59-20020a9d0dc10000b02902a57e382ca1so16624250ots.7 for ; Wed, 09 Jun 2021 09:15:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=ZKvRJP1Qn2FuRIKKae+xpipPvYviXO+rudBhyvwgw04=; b=pDEulQ5T10C2NN3d8EUx9o7Evrk5XBvwU2hid/d64iys8sf3rm3CB06NvqMGuMjHsk KhKXUDLJFacQ84otDTTtvaoIrDUVqpE+IqNQ/J9lGGRqvOeo0XZkrbMBV2smRrwo8LGf KAnQ1/49/jlSn/TaijErlpLJ8FRg2vF5qef0zqf1U1xwr76maaSJwZ33eRCTDu5ialpu mEQk1ASp0AtV1LSj2DTR+novgq8V07f8o2gQzB70ZJhI2o2E64PjiOSmurRru7VHut1k 2gyLSWKCJ4T9aC36gdJWHzEz27qQKnAPI1xZDE7iRFGsNlEBhQxsAeJMsTqEvE53bTS6 sisQ== X-Gm-Message-State: AOAM533XZyZYCmzZFxpUQX7OrIDCQfiWMWRqCsmZwvGhnGADhxYGylpf ZbYU9QsEAcwxk8Xcez20tWl53yqsbeyxcbSc+/f9I/Bhu8LvjiDM7ogWZwpEiqhKmqtSl2WkUm2 YMoZvtnzRgmmMPkgTQjd3IQtj X-Received: by 2002:a9d:6042:: with SMTP id v2mr179316otj.170.1623255335010; Wed, 09 Jun 2021 09:15:35 -0700 (PDT) X-Received: by 2002:a9d:6042:: with SMTP id v2mr179287otj.170.1623255334638; Wed, 09 Jun 2021 09:15:34 -0700 (PDT) Received: from redhat.com ([198.99.80.109]) by smtp.gmail.com with ESMTPSA id x9sm76559oto.79.2021.06.09.09.15.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 09:15:34 -0700 (PDT) Date: Wed, 9 Jun 2021 10:15:32 -0600 From: Alex Williamson To: Joerg Roedel Cc: Jason Gunthorpe , "Tian, Kevin" , Jean-Philippe Brucker , David Gibson , Jason Wang , "parav@mellanox.com" , "Enrico Weigelt, metux IT consult" , Paolo Bonzini , Shenming Lu , Eric Auger , Jonathan Corbet , "Raj, Ashok" , "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 Subject: Re: Plan for /dev/ioasid RFC v2 Message-ID: <20210609101532.452851eb.alex.williamson@redhat.com> In-Reply-To: References: <20210609123919.GA1002214@nvidia.com> <20210609150009.GE1002214@nvidia.com> Organization: Red Hat X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 9 Jun 2021 17:51:26 +0200 Joerg Roedel wrote: > On Wed, Jun 09, 2021 at 12:00:09PM -0300, Jason Gunthorpe wrote: > > Only *drivers* know what the actual device is going to do, devices do > > not. Since the group doesn't have drivers it is the wrong layer to be > > making choices about how to configure the IOMMU. > > Groups don't carry how to configure IOMMUs, that information is > mostly in the IOMMU domains. And those (or an abstraction of them) is > configured through /dev/ioasid. So not sure what you wanted to say with > the above. > > All a group carries is information about which devices are not > sufficiently isolated from each other and thus need to always be in the > same domain. > > > The device centric approach is my attempt at this, and it is pretty > > clean, I think. > > Clean, but still insecure. > > > All ACS does is prevent P2P operations, if you assign all the group > > devices into the same /dev/iommu then you may not care about that > > security isolation property. At the very least it is policy for user > > to decide, not kernel. > > It is a kernel decision, because a fundamental task of the kernel is to > ensure isolation between user-space tasks as good as it can. And if a > device assigned to one task can interfer with a device of another task > (e.g. by sending P2P messages), then the promise of isolation is broken. AIUI, the IOASID model will still enforce IOMMU groups, but it's not an explicit part of the interface like it is for vfio. For example the IOASID model allows attaching individual devices such that we have granularity to create per device IOASIDs, but all devices within an IOMMU group are required to be attached to an IOASID before they can be used. It's not entirely clear to me yet how that last bit gets implemented though, ie. what barrier is in place to prevent device usage prior to reaching this viable state. > > Groups should be primarily about isolation security, not about IOASID > > matching. > > That doesn't make any sense, what do you mean by 'IOASID matching'? One of the problems with the vfio interface use of groups is that we conflate the IOMMU group for both isolation and granularity. I think what Jason is referring to here is that we still want groups to be the basis of isolation, but we don't want a uAPI that presumes all devices within the group must use the same IOASID. For example, if a user owns an IOMMU group consisting of non-isolated functions of a multi-function device, they should be able to create a vIOMMU VM where each of those functions has its own address space. That can't be done today, the entire group would need to be attached to the VM under a PCIe-to-PCI bridge to reflect the address space limitation imposed by the vfio group uAPI model. Thanks, Alex