Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1001897pxj; Fri, 4 Jun 2021 03:48:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHdNCLyHGkeM0ov3ESoZkywjDcaap7OHlvJu2UhqfJG4LtUlCTnBMNS3Rzd9MNLEJ4AePe X-Received: by 2002:aa7:db93:: with SMTP id u19mr3985209edt.227.1622803709041; Fri, 04 Jun 2021 03:48:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622803709; cv=none; d=google.com; s=arc-20160816; b=0rAflttwYR7AGLSYf5QkIvL3mGqIBT1n7+6Em8WStK20Bb6VoU+jAv1RsZeL+gInER 432+QtN4sXlC0XaZ//9RI//TGDgt0mL5bUeewAhOLUPc7/uatsIgklmAjHrgwPF/LjjG qnB6DBE0y0nsDE3ePRMU0kU+8ZZqfd0ghdRyZn/M1cvlEGhwG1uZ58UTOeQ0Y3GTJeSD EZwDU/DsiM6a4kTChwPq94tbJL1kr39OgMOmoS2IFAf7JSN2UOIecrqGZodTmg/TLBIr 3pPxtlGcL1kP9JW5+ZNhJgjrKWELtBNJP+d25RJaE6dyMD3lDQojS2EnEFA8F9lJK420 084A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=1Lnx07nNFIUglQ1axWLjohDYBr1JB9oVsykoeTT+wsw=; b=YrqkmQouxDvDPlA+WnDKUpeq5i7ZzV1YqmVEVuZcVW7Gy5C7uY3gkVp0BKMVT0iFRl /vhVuYCcE329X6ZbLJHnkGZjAIkRlkTlvdjsAfkP466hnBOmz5hE73Jq90sYI4SulJs8 0RK0TdSrzPprnTtWeDPXyU6ehI+vig4z7f5IkdwzH8kAGpfRobSbINAapWHPf3CdFSAW qcZRfvXdF5BlvWkEG6P0oW+tCAI/2vmFl/liemqDeHFSL2nXogsc6ay7kG+U6ebLTWzb UgRWYNi4yt624sIEGW/XLmR4GpEyCSwCiYbYzOfoDGaS3tJT6tcxA+QV35KCC/Fbu2U6 e/sA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e25si4502636eds.353.2021.06.04.03.48.05; Fri, 04 Jun 2021 03:48:29 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230084AbhFDKqs (ORCPT + 99 others); Fri, 4 Jun 2021 06:46:48 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:37741 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229625AbhFDKqr (ORCPT ); Fri, 4 Jun 2021 06:46:47 -0400 Received: from [192.168.1.155] ([77.9.34.20]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MXH3e-1lrzgc1R4Y-00YmfZ; Fri, 04 Jun 2021 12:44:32 +0200 Subject: Re: [RFC] /dev/ioasid uAPI proposal To: Jason Gunthorpe Cc: "Tian, Kevin" , LKML , Joerg Roedel , Lu Baolu , David Woodhouse , "iommu@lists.linux-foundation.org" , "kvm@vger.kernel.org" , "Alex Williamson (alex.williamson@redhat.com)" , Jason Wang , Eric Auger , Jonathan Corbet , "Raj, Ashok" , "Liu, Yi L" , "Wu, Hao" , "Jiang, Dave" , Jacob Pan , Jean-Philippe Brucker , David Gibson , Kirti Wankhede , Robin Murphy References: <20210602172424.GD1002214@nvidia.com> From: "Enrico Weigelt, metux IT consult" Message-ID: Date: Fri, 4 Jun 2021 12:44:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <20210602172424.GD1002214@nvidia.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: tl Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:EoukDPcc2J/QT1D3boJAqDV3J9p3cqCtFNu4BEvhSOo+pu9OZsX DwBwLSc9+AiWMjMqEkc8DgpMYjdaXZ3udFjKV/t35j93kOSrcJS2O5rSy8bS4O9YWqrwJah eQ3aEeFMxZainqV/DPiuIeWIiAAeeoQNexILCOmEFhLNHZ/NUZBkuwfo46oactlC0K7Fada vDtxNQu+o6eAn++Bv+/eQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:QKgPDva5+wg=:eeMux13sB16S9C4PhjuoZD CtwoD8dWEh81W5fy1QPhYLQUS15Eyu4lv3ZTs3TJ1ftGLpHB2oin7q+5F1zibM1WVSzfdeScd uU0679MJoje4xsogtaueiuTQtRcF9QzF0/XvHjQzfWg0g+KGNEw58XxmgZulfIvcirFRfd0JS bDRA6Bz3nIU+Vhb20syeejdhTusBXSk3fj0k0p07MLmf3Aw9Su2r8ncxiz9zoFX04+i2yPQ4O 9xQpYJA09Bamh3J5+sDfaH3BuXCmI5Uj1YN1YFPi1/3l9FGCN95CEX+PvIhQAQ3/MmkdZIvJG AGR70wW8AgrmjraQNoKhqd0CX0w1JHDhv1rd0feIIp/1VWd0xxSHnqyle4T2JlOBmNHY5PuWH /mT93AOHNqxmXXtc2D3+VCmGUYySMWbv1MyW00of6y0T07yKv3XmCL948iDJae4WYI826EjvO sSSSZUyu1ujzfih9pcDYtclYWtmKmNXkn3y9dqmlywTwqoL7hphFkBhxYGsE9vU/fGfUNaH3H PElzz4R4ACzW4c8fgPPEko= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02.06.21 19:24, Jason Gunthorpe wrote: Hi, >> If I understand this correctly, /dev/ioasid is a kind of "common supplier" >> to other APIs / devices. Why can't the fd be acquired by the >> consumer APIs (eg. kvm, vfio, etc) ? > > /dev/ioasid would be similar to /dev/vfio, and everything already > deals with exposing /dev/vfio and /dev/vfio/N together > > I don't see it as a problem, just more work. One of the problems I'm seeing is in container environments: when passing in an vfio device, we now also need to pass in /dev/ioasid, thus increasing the complexity in container setup (or orchestration). And in such scenarios you usually want to pass in one specific device, not all of the same class, and usually orchestration shall pick the next free one. Can we make sure that a process having full access to /dev/ioasid while only supposed to have to specific consumer devices, can't do any harm (eg. influencing other containers that might use a different consumer device) ? Note that we don't have device namespaces yet (device isolation still has to be done w/ complicated bpf magic). I'm already working on that, but even "simple" things like loopdev allocation turns out to be not entirely easy. > Having FDs spawn other FDs is pretty ugly, it defeats the "everything > is a file" model of UNIX. Unfortunately, this is already defeated in many other places :( (I'd even claim that ioctls already break it :p) It seems your approach also breaks this, since we now need to open two files in order to talk to one device. By the way: my idea does keep the "everything's a file" concept - we just have a file that allows opening "sub-files". Well, it would be better if devices could also have directory semantics. --mtx --- Hinweis: unverschlüsselte E-Mails können leicht abgehört und manipuliert werden ! Für eine vertrauliche Kommunikation senden Sie bitte ihren GPG/PGP-Schlüssel zu. --- Enrico Weigelt, metux IT consult Free software and Linux embedded engineering info@metux.net -- +49-151-27565287