Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp572128pxj; Fri, 7 May 2021 15:16:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJmamwNOJeHiQPbWmfoebJDGaQFRqZRGMt9apu6BqH9xb8A+qU/3OGcWwiveRtItXZ7agA X-Received: by 2002:a05:6402:145:: with SMTP id s5mr13936421edu.221.1620425793546; Fri, 07 May 2021 15:16:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620425793; cv=none; d=google.com; s=arc-20160816; b=j+wyUITF6xq9fFTBzT8qFapjdtDPXJKLtC2Re6H5ZRgQ5idHqho/bL9LQTkHOGdOUH 0N3qpqZpvGxGGE3KH+XXdaQQUS7K9LcUtEymjOLcnxzft4rjDImjjdJeVb0l6fUiIKq6 jqd0WO/zIzeApNDbcK5+zNKS32jeTbPhyrcI7CE1WwJw3pw6ma7Yjj+q/dmRvmREBLvO /eNq4K8ufEcDSeGtUww6OF/xAIIDhik1woNwrcw2tejDFFWJzqdKIhcoxnFWv44vSL1w sphtoBAkHA+IEUtKwaDKdniLbmWSL+XS5XH3rxnpABmYqHEpdmq4hTw/E0dXmuUOspgm Cxrw== 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:ironport-sdr:ironport-sdr; bh=QgkSsWwHzKhHP4cGb/Us/iqvOzNl0mHWHWOHoChvqu4=; b=jDjoHtYagEJjQX0EiB800u1auPblGkQSjL1g4xD7T3AwJtbdF7LeuwQux8rh02QSnb 1596ckbzc8OfNWglp7Xu593YnkZX26UgzRaAry67hvsmspEB1TAeW4PkSAKZvyr4obKb jP7ShoP6o1bly/kPf5GW6O4G13u0hFAek0xqy80ZInPHQa7Iz0vOL17mBJ5K71TDcct2 6nBBX3UVIo9O0CWbIJY0+7i2IBzCkY90FEyTNBpxy4n3TqJRH1MeL0nb7NSD7PL4QHvi Y+m1Pi6o/Uth7M3/B9Esjp2QuhzV5MQo1sF1oDK+o7U8XxUvZ3oXwXQzNFf5qCIUFc89 svfg== 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 bm15si6624751edb.233.2021.05.07.15.16.09; Fri, 07 May 2021 15:16:33 -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 S229930AbhEGWN4 (ORCPT + 99 others); Fri, 7 May 2021 18:13:56 -0400 Received: from mga17.intel.com ([192.55.52.151]:15806 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230169AbhEGWNu (ORCPT ); Fri, 7 May 2021 18:13:50 -0400 IronPort-SDR: aXdFi8hvsTiYYRo1CLYoyQUEZSKordx44yph5O8qV8LioB/hWXpBG00ulI7k7hYmK+MpsLySFS G1nQsBaFNttQ== X-IronPort-AV: E=McAfee;i="6200,9189,9977"; a="179066241" X-IronPort-AV: E=Sophos;i="5.82,282,1613462400"; d="scan'208";a="179066241" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2021 15:12:48 -0700 IronPort-SDR: 7WNbQ0A1+3oGRBKbWEfzfOFJWCNFKRgaATZCvUAV4vlGVej4zXBduyRXqZ3lghhLF9/05JQlSR LNS1KAx8QGWQ== X-IronPort-AV: E=Sophos;i="5.82,282,1613462400"; d="scan'208";a="429156396" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.7.199.155]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2021 15:12:48 -0700 Date: Fri, 7 May 2021 15:15:11 -0700 From: Jacob Pan To: Jason Gunthorpe Cc: "Raj, Ashok" , Jean-Philippe Brucker , "Tian, Kevin" , Alex Williamson , "Liu, Yi L" , Auger Eric , LKML , Joerg Roedel , Lu Baolu , David Woodhouse , "iommu@lists.linux-foundation.org" , "cgroups@vger.kernel.org" , Tejun Heo , Johannes Weiner , Jean-Philippe Brucker , Jonathan Corbet , "Wu, Hao" , "Jiang, Dave" , jacob.jun.pan@linux.intel.com Subject: Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs Message-ID: <20210507151511.612d1424@jacob-builder> In-Reply-To: <20210507192810.GY1370958@nvidia.com> References: <20210505102259.044cafdf@jacob-builder> <20210505180023.GJ1370958@nvidia.com> <20210505130446.3ee2fccd@jacob-builder> <20210506122730.GQ1370958@nvidia.com> <20210506163240.GA9058@otc-nc-03> <20210507172051.GW1370958@nvidia.com> <20210507181458.GA73499@otc-nc-03> <20210507182050.GX1370958@nvidia.com> <20210507192325.GB73499@otc-nc-03> <20210507192810.GY1370958@nvidia.com> Organization: OTC X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-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 Hi Jason, On Fri, 7 May 2021 16:28:10 -0300, Jason Gunthorpe wrote: > > The unanswered question is how do we plumb from vIOMMU without a custom > > allocator to get a system wide PASID? > > PASID allocation is part of the iommu driver, it really shouldn't be > global. > In the current code, the pluggable custom allocator *is* part of the iommu vendor driver. If it decides the allocation is global then it should be suitable for the platform since there will never be a VT-d IOMMU on another vendor's platform. It is true that the default allocator is global which suites the current needs. I am just wondering if we are solving a problem does not exist yet. > When the architecture code goes to allocate a single PASID for the > mm_struct it should flag that allocation request with a 'must work for > all RIDs flag' and the iommu driver should take care of it. That might > mean the iommu driver consults a global static xarray, or maybe it > does a hypercall, but it should be done through that API, not a side > care global singleton. Why do we need to flag the allocation every time if on a platform *every* PASID can potentially be global? At the time of allocation, we don't know if the PASID will be used for a shared (ENQCMD) or a dedicated workqueue. Thanks, Jacob