From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 74A487EB for ; Fri, 14 Jul 2023 02:49:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689302962; x=1720838962; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=XQ9ZNDLXRYxR2/glWQTMI+edqAw/ek5JcdoktMjwEi0=; b=ntDzfNcrvYUXDnStFEgbiwbQZSZC5k+mh25c5H9x/WlJzsrtz4RglrZ4 S3p/9znXugVsP3VuVFnhoWUzkUYQKXceB08le89JFatAvHnW5/ut2e4Tn 7uyYBiZrX7EZjmh28UGckWXo1CG1I6y1Tut+yQ++qLqMveCTXbyBG1kj1 xWvk905E7v7C+9aLBICDNnEV95cCb231crgt/434DgmKk2vbarM2QjXIB akXhrgCQta1CcbnqxpwgPYKKnIoS0fXNCFEX6F3eANJsyIii9tFRDgSEF kDyogFc/Zw3Er4zS8uk5W8vou/CCge4in8ERFhNsXxOyZN5xm+b+vOgpb Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10770"; a="365412026" X-IronPort-AV: E=Sophos;i="6.01,204,1684825200"; d="scan'208";a="365412026" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2023 19:49:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10770"; a="968853209" X-IronPort-AV: E=Sophos;i="6.01,204,1684825200"; d="scan'208";a="968853209" Received: from blu2-mobl.ccr.corp.intel.com (HELO [10.252.191.49]) ([10.252.191.49]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2023 19:49:16 -0700 Message-ID: Date: Fri, 14 Jul 2023 10:49:12 +0800 Precedence: bulk X-Mailing-List: iommu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: baolu.lu@linux.intel.com, Joerg Roedel , Will Deacon , Robin Murphy , Jason Gunthorpe , Jean-Philippe Brucker , Nicolin Chen , "Liu, Yi L" , "iommu@lists.linux.dev" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 9/9] iommu: Use fault cookie to store iopf_param Content-Language: en-US To: "Tian, Kevin" , Jacob Pan References: <20230711010642.19707-1-baolu.lu@linux.intel.com> <20230711010642.19707-10-baolu.lu@linux.intel.com> <20230711150249.62917dad@jacob-builder> From: Baolu Lu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2023/7/13 16:01, Tian, Kevin wrote: >> From: Baolu Lu >> Sent: Thursday, July 13, 2023 11:44 AM >> >> On 2023/7/13 11:24, Tian, Kevin wrote: >>>> From: Baolu Lu >>>> Sent: Wednesday, July 12, 2023 11:13 AM >>>> >>>> On 2023/7/12 6:02, Jacob Pan wrote: >>>>> On Tue, 11 Jul 2023 09:06:42 +0800, Lu Baolu >>>>> wrote: >>>>> >>>>>> @@ -158,7 +158,7 @@ int iommu_queue_iopf(struct iommu_fault >> *fault, >>>>>> struct device *dev) >>>>>> * As long as we're holding param->lock, the queue can't be >>>>>> unlinked >>>>>> * from the device and therefore cannot disappear. >>>>>> */ >>>>>> - iopf_param = param->iopf_param; >>>>>> + iopf_param = iommu_get_device_fault_cookie(dev, 0); >>>>> I am not sure I understand how does it know the cookie type is >> iopf_param >>>>> for PASID 0? >>>>> >>>>> Between IOPF and IOMMUFD use of the cookie, cookie types are >> different, >>>>> right? >>>>> >>>> >>>> The fault cookie is managed by the code that delivers or handles the >>>> faults. The sva and IOMMUFD paths are exclusive. >>>> >>> >>> what about siov? A siov-capable device can support sva and iommufd >>> simultaneously. >> >> For siov case, the pasid should be global. RID and each pasid are still >> exclusive, so I don't see any problem. Did I overlook anything? >> > > they are exclusive but it's weird to see some pasids (for sva) on this > device are tracked by slot#0 while other pasids (for iommufd) occupies > per-pasid slot. > > why not generalizing them given you name it as "per-pasid fault cookie"? Yeah! Get your point now. At least the partial list should be per-pasid. Let me invest more time on this. Best regards, baolu