From mboxrd@z Thu Jan 1 00:00:00 1970 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 B7B71C001DE for ; Wed, 9 Aug 2023 11:03:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233022AbjHILDV (ORCPT ); Wed, 9 Aug 2023 07:03:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233048AbjHILDI (ORCPT ); Wed, 9 Aug 2023 07:03:08 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3CF73AB6 for ; Wed, 9 Aug 2023 03:54:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691578447; x=1723114447; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=zrizEA1ZrvJpZWfXi3wLOYH6emAnI6kPIryklf3OJaY=; b=iobczcTSv4yHeU90mkGJqGlHaYQ5B/b981GhuitpzEvq4bIHN2UU6sVf PFX+dXBQ+K5uQVZ4+DjrPga4pdGhmYGO5lUhtUBZR3WVIl0ovTYSZ+1vJ T2z3/jOqcdKroux8R7mQgB5YYGxBP5MVNkzcHAJLO2dV7gfA4RayGsjQF d+SGCY0G++HWAXtCIm5M6NIuM+QID3P0aI1Txp4YNapeiWQZ2+vfzj10x /HEw8OUnaPRukiBVw4+makUC59z3ZsQGQ/orBaRZ3sOjdK9QCTiLX0YCO fRzNP5120ZHqICBh6P/ks05ryxniREn3UGOHZXPeJ0c95E10YNb5j3OBH w==; X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="437456671" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="437456671" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Aug 2023 03:51:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="1062418007" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="1062418007" Received: from blu2-mobl.ccr.corp.intel.com (HELO [10.254.210.171]) ([10.254.210.171]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Aug 2023 03:51:43 -0700 Message-ID: <86ecc67a-8567-f3b3-02c9-572474af8e72@linux.intel.com> Date: Wed, 9 Aug 2023 18:51:41 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Cc: baolu.lu@linux.intel.com, "iommu@lists.linux.dev" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 0/5] Share sva domains with all devices bound to a mm Content-Language: en-US To: "Tian, Kevin" , "Zhang, Tina" , Jason Gunthorpe , Michael Shavit References: <20230808074944.7825-1-tina.zhang@intel.com> <184044ad-880f-5452-727b-f7fd18330c22@linux.intel.com> From: Baolu Lu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/8/9 17:44, Tian, Kevin wrote: >> From: Baolu Lu >> Sent: Wednesday, August 9, 2023 8:18 AM >> >> On 2023/8/8 15:49, Tina Zhang wrote: >>> A sva domain's lifetime begins with binding a device to a mm and ends >>> by releasing all the bound devices from that sva domain. Technically, >>> there could be more than one sva domain identified by the mm PASID for >>> the use of bound devices issuing DMA transactions. >>> >>> To support mm PASID 1:n with sva domains, each mm needs to keep both >> a >>> reference list of allocated sva domains and the corresponding PASID. >>> However, currently, mm struct only has one pasid field for sva usage, >>> which is used to keep the info of an assigned PASID. That pasid field >>> cannot provide sufficient info to build up the 1:n mapping between PASID >>> and sva domains. >> Is it more appropriate to have the same life cycle for sva domain and mm >> pasid? I feel that they represent the same thing, that is, the address >> space shared by mm to a device. >> > iirc it's a simplification to free mm pasid at __mmdrop() otherwise the > implementation is tricky, but I don't remember all the detail... Yeah, probably we could also free the sva domains in __mmdrop()? Remove the refcount for sva domain just like what we did for pasid (at the beginning we had refcount for each pasid...). Best regards, baolu