Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5752CC636D4 for ; Mon, 13 Feb 2023 23:40:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230163AbjBMXkP (ORCPT ); Mon, 13 Feb 2023 18:40:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229789AbjBMXkN (ORCPT ); Mon, 13 Feb 2023 18:40:13 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 306B1CA2E for ; Mon, 13 Feb 2023 15:40:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676331606; x=1707867606; h=date:from:to:cc:subject:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ixZ4bLVsafsO/qfHYxt6mrTGLCPfk7e2PfpXdYXUk7M=; b=KNvWEnFLX0ubFS4X6Ezgm+gUblh9hVdJpZDzZuDOAByfDjcjOawJA2EJ 7RGWGTE5kMdCAD+rv5KvV+4z5gc56QfCleixdbufbNiAWFFkj2WNQqNFV yTrTvqOWaXQNlsKVUzV7pYYzdgWiH2nBRmvVnJb7eezGeEPFvghsiDS6H /+FCwrRvbuQy5Z4ZblwR8DYHno+IaY4JaJ+4vsltavx4ymUWZqEP5Csz2 0BId4WscwkkEtPu4m2CQMY6vN+HXdwZ7F82iouccqtL21fBd3JZo6uB/C ENcQkkjjBTSlIVcI0J9dmQ3kj2JeepVc6jiCehKnsKaA8TrFteVtFjIIQ A==; X-IronPort-AV: E=McAfee;i="6500,9779,10620"; a="311387946" X-IronPort-AV: E=Sophos;i="5.97,294,1669104000"; d="scan'208";a="311387946" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Feb 2023 15:40:05 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10620"; a="701453131" X-IronPort-AV: E=Sophos;i="5.97,294,1669104000"; d="scan'208";a="701453131" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.24.100.114]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Feb 2023 15:40:05 -0800 Date: Mon, 13 Feb 2023 15:43:45 -0800 From: Jacob Pan To: Jason Gunthorpe Cc: Jean-Philippe Brucker , LKML , iommu@lists.linux.dev, Lu Baolu , Joerg Roedel , Jean-Philippe Brucker , Robin Murphy , David Woodhouse , Raj Ashok , "Tian, Kevin" , Yi Liu , jacob.jun.pan@linux.intel.com Subject: Re: [PATCH 2/2] iommu/ioasid: Remove custom IOASID allocator Message-ID: <20230213154345.0f76eea1@jacob-builder> In-Reply-To: References: <20230210230206.3160144-1-jacob.jun.pan@linux.intel.com> <20230210230206.3160144-3-jacob.jun.pan@linux.intel.com> <20230213103455.02f3ac37@jacob-builder> <20230213134402.194ed7fd@jacob-builder> 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 Mon, 13 Feb 2023 19:18:51 -0400, Jason Gunthorpe wrote: > On Mon, Feb 13, 2023 at 01:44:02PM -0800, Jacob Pan wrote: > > > Your DMA API PASID thing will simply need one new API to alloc/free a > > > PASID from the iommu_global_pasid_ida > > It should satisfy what we need right now. > > Just wondering if we were to do resource management of global PASIDs, > > say with the new misc cgroup controller, do we plan to expand in iommu > > sva code? If yes, do we keep DMA API PASID in a separate range/set? > > I would say all shared PASIDs held by userspace should be captured by > by a resource limit, it doesn't matter if they are global PASIDs or > device local shared PASIDs. agreed, I was just thinking in-kernel DMA PASID is not held by userspace, might be good to keep them in separate pool, thus keeping ioasid_set. > So if a cgroup comes it is just a matter of putting charges in the > right place which is auditable by looking at calls to attach pasid > functions. shouldn't we charge cg during allocation? Or it might be too early for iommufd so we have to wait until attach? Thanks, Jacob