Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1628963pxb; Thu, 4 Mar 2021 16:55:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJx6RSStwh7j/kKxzYrn5xaeGaxB9jWWw+PVT9PSyudtAls9ITFcX3o1MSGEyoqBox3anJ4R X-Received: by 2002:a92:cda1:: with SMTP id g1mr6252389ild.267.1614905723716; Thu, 04 Mar 2021 16:55:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614905723; cv=none; d=google.com; s=arc-20160816; b=UdCtWnEL2Zubo8n8O5Db81CKsVT/Tx+XHfI++F3WQTN6gr+aUEK8ecpdBENESqV5EN R6e/Yvw3zD66cyX1TzV2cNVTsIYPjHk9/b8j6wqrCCUVko1NTpLQlBcZMSs0tfP4SujD VkMNjNL6qiwAX1ZX93ZBR50nfEFaFIH79tWoEBZzenZME/KazSDmO6lU+XfQp8KyED83 P4rOLe47bk3ge8MkLl3zcDzhMk7V/IsrqCbzkl4JTj7j7QzVx1JdfF/kUJ3Jz8rlFKhC SE/ioAHUFzfyC45YEcnXJSsDNJWh9jJezo0TT64D7ciDFrxh29Hp+LeaV5tt0+DUv6f7 vjaw== 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=b3VqBZwrVaGmEyuFu/fA31orzv0ePdCsHBu64KVLy6s=; b=B1hknjHMlQzatKGoFGlaicHOyH4FTVEpYCtu5PngKgWeP2h03x1BsAjwVrvG3HUe7G AoR87wJw4TEOmPpHRtJydIcUjjU8bDYCeATWuHguRrJu4xxYK2gNrliKVQuVRWpC46vy DnCKfySPmxt5OWPcifMPEQ2PTkGasrwg9oNZlDjC6BnShL0QX1sbjsim2Lfo1UvPcQ1q 7drkW/WzHZDh7MEdSkx6GkG0oRBlWb+MfVZjQIj57VxZO42sMmNEdFIP6TEslOs1u1P/ KZv1TVVVu81Pm8juTSEwQ3heXArHS8q2AZpuEhpZXJnUiSTi4U3Cw/11a/LD3xTuPIZc cPiQ== 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 v28si895108jah.86.2021.03.04.16.55.10; Thu, 04 Mar 2021 16:55:23 -0800 (PST) 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 S232301AbhCDTBk (ORCPT + 99 others); Thu, 4 Mar 2021 14:01:40 -0500 Received: from mga03.intel.com ([134.134.136.65]:35399 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235421AbhCDTBQ (ORCPT ); Thu, 4 Mar 2021 14:01:16 -0500 IronPort-SDR: Bod1G5DPcWjXYx1FQgC2eq8sOngymESich0b8XLTra7T9XCpoA4EeM2441LrIUdQR27Cd5woCZ uCtIxPvkecEg== X-IronPort-AV: E=McAfee;i="6000,8403,9913"; a="187534615" X-IronPort-AV: E=Sophos;i="5.81,223,1610438400"; d="scan'208";a="187534615" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2021 10:59:30 -0800 IronPort-SDR: NbqFzMbMSGkhCygtH0In0Xtszb1NnhzOwThNk0wCxsqlTYeCynz4T+5CvB+YvlRK43kFtk5qJf wDisfAEJFTig== X-IronPort-AV: E=Sophos;i="5.81,223,1610438400"; d="scan'208";a="445844611" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.7.199.155]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2021 10:59:28 -0800 Date: Thu, 4 Mar 2021 11:01:44 -0800 From: Jacob Pan To: Jason Gunthorpe Cc: Jean-Philippe Brucker , Tejun Heo , LKML , Joerg Roedel , Lu Baolu , David Woodhouse , , , Johannes Weiner , Jean-Philippe Brucker , Alex Williamson , Eric Auger , "Jonathan Corbet" , Raj Ashok , "Tian, Kevin" , Yi Liu , Wu Hao , Dave Jiang , jacob.jun.pan@linux.intel.com Subject: Re: [RFC PATCH 15/18] cgroup: Introduce ioasids controller Message-ID: <20210304110144.39ef0941@jacob-builder> In-Reply-To: <20210304175402.GG4247@nvidia.com> References: <1614463286-97618-1-git-send-email-jacob.jun.pan@linux.intel.com> <1614463286-97618-16-git-send-email-jacob.jun.pan@linux.intel.com> <20210303131726.7a8cb169@jacob-builder> <20210303160205.151d114e@jacob-builder> <20210304094603.4ab6c1c4@jacob-builder> <20210304175402.GG4247@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 Thu, 4 Mar 2021 13:54:02 -0400, Jason Gunthorpe wrote: > On Thu, Mar 04, 2021 at 09:46:03AM -0800, Jacob Pan wrote: > > > Right, I was assuming have three use cases of IOASIDs: > > 1. host supervisor SVA (not a concern, just one init_mm to bind) > > 2. host user SVA, either one IOASID per process or perhaps some private > > IOASID for private address space > > 3. VM use for guest SVA, each IOASID is bound to a guest process > > > > My current cgroup proposal applies to #3 with IOASID_SET_TYPE_MM, which > > is allocated by the new /dev/ioasid interface. > > > > For #2, I was thinking you can limit the host process via PIDs cgroup? > > i.e. limit fork. So the host IOASIDs are currently allocated from the > > system pool with quota of chosen by iommu_sva_init() in my patch, 0 > > means unlimited use whatever is available. > > https://lkml.org/lkml/2021/2/28/18 > > Why do we need two pools? > > If PASID's are limited then why does it matter how the PASID was > allocated? Either the thing requesting it is below the limit, or it > isn't. > you are right. it should be tracked based on the process regardless it is allocated by the user (/dev/ioasid) or indirectly by kernel drivers during iommu_sva_bind_device(). Need to consolidate both 2 and 3 and decouple cgroup and IOASID set. > For something like qemu I'd expect to put the qemu process in a cgroup > with 1 PASID. Who cares what qemu uses the PASID for, or how it was > allocated? > For vSVA, we will need one PASID per guest process. But that is up to the admin based on whether or how many SVA capable devices are directly assigned. > Jason Thanks, Jacob