Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3667688pxj; Mon, 24 May 2021 11:55:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwovAXfp923/Z87XNcImQ7WOLvAFQmPxZpdaMiMFDr9NvU6ZUW5N4oqU50lmH+0RvAb+8CF X-Received: by 2002:a17:906:1305:: with SMTP id w5mr24421746ejb.404.1621882519529; Mon, 24 May 2021 11:55:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621882519; cv=none; d=google.com; s=arc-20160816; b=WFCVyBTkpr06geXKxwqvkIGj7kfPmxeigZsyyLenb+YJO8PWrExcWl5qH1Z1P7vh5k BgQd3xe3d/Fluzc6QyTVVa7Ib/xYQrnlO+MxsYr649ALddDXSHO91lyQ+9DE6xQH8vUe rfh1gK03YR6eLozpVgRUiGApbIzlnAkPGnYFBvJm2n+xouEfOwkr13UHaD963YWvI+01 BYTDZnfUzu9tEj+1eevQkdouk5ODh3lVPaR3SalLWwD6d17Wsvzin7qFbmt3X4T45bj1 y4FEDByKh4II2A3Gbe4N2TL0owt7GZ4089hRnCpopErb0H62vkFbYik01mWZgP2r7i4d O9ZQ== 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=goyFMrETTUp1Ut1ybG19MENcDp01cibnjAJVMXDdj+w=; b=ZyrX6yjkXwai3ilTGu6J/ohkQaKfp5kbl/VDoz4Gy5zbH+w8ct3m/M24adpkdk45up qwLVHJTZRyZCpSC3wDXkSEBdAIXTrYpCWwJvj3W4M3IqFRNl+RKRYfDzUfwjZkheD63u HUJv3tu82C/L+7Gd6VguV33m5MU9ss8xqE33dNgwkfZuS7ox5/hBPriR1BIoGxmlB16c qyJfnPK1HmxTDoPAdGWr6LSisg5n+FmXQl+HQAhggENlo1NoSeIwF6H37VdzL7Mhwo7C LuM+i+jPhzwy2ZeIRX+saGI8P1f/C6b+1XReAAkESAF67RBNc5YjbB3t1t0+y+hEtT24 IunQ== 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 nb17si13820693ejc.226.2021.05.24.11.54.56; Mon, 24 May 2021 11:55:19 -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 S233234AbhEXSw6 (ORCPT + 99 others); Mon, 24 May 2021 14:52:58 -0400 Received: from mga05.intel.com ([192.55.52.43]:59146 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232803AbhEXSw6 (ORCPT ); Mon, 24 May 2021 14:52:58 -0400 IronPort-SDR: iYCIIjaymPnozQdVbEbxtnsoopmNQIl0lNrWFPF5XuiIMqEKWCpxHipUJywLumugKEtqKCQb5y m0WP08RKo6pw== X-IronPort-AV: E=McAfee;i="6200,9189,9993"; a="287575831" X-IronPort-AV: E=Sophos;i="5.82,325,1613462400"; d="scan'208";a="287575831" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 May 2021 11:51:29 -0700 IronPort-SDR: RNZ8k4y7Dqu3VMsWlUlKIJhsjK32Ac+Vjq5htQ4XbAxZ7FPuAoF4iIVMPRWMABZtl/e+i4ERa4 xDq5jozJnwAg== X-IronPort-AV: E=Sophos;i="5.82,325,1613462400"; d="scan'208";a="546467113" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.7.199.155]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 May 2021 11:51:28 -0700 Date: Mon, 24 May 2021 11:54:00 -0700 From: Jacob Pan To: Lu Baolu Cc: Joerg Roedel , , , Jean-Philippe Brucker , , , jacob.jun.pan@intel.com Subject: Re: [PATCH 01/11] iommu/vt-d: Add pasid private data helpers Message-ID: <20210524115400.52df4d97@jacob-builder> In-Reply-To: <15bdf989-40c9-2b45-0fb6-273a43479789@linux.intel.com> References: <20210520031531.712333-1-baolu.lu@linux.intel.com> <20210520031531.712333-2-baolu.lu@linux.intel.com> <20210521142518.25087d34@jacob-builder> <15bdf989-40c9-2b45-0fb6-273a43479789@linux.intel.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 Lu, On Mon, 24 May 2021 10:16:18 +0800, Lu Baolu wrote: > Hi Jacob, > > Thanks for reviewing my patch. > > On 5/22/21 5:25 AM, Jacob Pan wrote: > > Hi BaoLu, > > > > On Thu, 20 May 2021 11:15:21 +0800, Lu Baolu > > wrote: > > > >> We are about to use iommu_sva_alloc/free_pasid() helpers in iommu core. > >> That means the pasid life cycle will be managed by iommu core. Use a > >> local array to save the per pasid private data instead of attaching it > >> the real pasid. > >> > > I feel a little awkward to have a separate xarray for storing per IOASID > > data. Seems duplicated. > > Jason suggested in another thread that we can make ioasid_data public > > and embeded in struct intel_svm, then we can get rid of the private data > > pointer. ioasid_find will return the ioasid_data, then we can retrieve > > the private data with container_of. > > The problem that this patch wants to solve is that the > iommu_sva_alloc_pasid() will attach the mm pointer to the sva pasid. > > pasid = ioasid_alloc(&iommu_sva_pasid, min, max, mm); > > Assuming that each sva pasid can have only a single private data > pointer, the vendor iommu driver shouldn't set the private data again. > You are right. I got confused with vSVM, the guest will have the private data assigned after the bind. > > > > roughly, > > > > struct intel_svm { > > ... > > struct ioasid_data; > > }; > > > > struct ioasid_data { > > ioasid_t id; > > refcount_t refs; > > struct mm_struct *mm; > > }; > > > > This can be a separate patch/effort if it make sense to you. > > Yes if we have a better solution. > Will be part of the IOASID core change. Thanks, > Best regards, > baolu Thanks, Jacob