Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp1924393rwp; Thu, 13 Jul 2023 20:10:48 -0700 (PDT) X-Google-Smtp-Source: APBJJlFJFiMbGaqbKOC8OqkJ4LHM5keku4Z2v39aIoYZdQW5zx49wwwb02aqkmk0x22P+a1Et6Ym X-Received: by 2002:a17:902:ce8e:b0:1b8:954c:1fb with SMTP id f14-20020a170902ce8e00b001b8954c01fbmr2232278plg.7.1689304247881; Thu, 13 Jul 2023 20:10:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689304247; cv=none; d=google.com; s=arc-20160816; b=TlXfjWY6yMZppEb2oTBK6Z1W04/YF0BYksW1x8AZCZCgzLX6ALC0FhHoYTuGHerHZR mt9j85Pqz89J4lgFHdKjFbEEli+Scra0v4oBml6ynXZx22hPiJF5AHUJj+i/T5S+o8mM b+nvXWClPnbYQTA6hgPU8hAHjCbO7mgXCG29c13k0bK8WSbPWK1jqhDcuT/DltzroBJn 8g0UxGTPqRTzEXE8UDU9yUFNrWrMxDR5NqElXjnHIuta7qN3uU5Xr6Zj1gUa+Dy9+2LY RtslNF0TrQMEarCo1eu1Ihof+UUuBtITZonZR19WG0Wf0f1DmEBQ6wpQ5IPZp8PY9naW SzYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:cc:user-agent:mime-version :date:message-id:dkim-signature; bh=D5R/9zwDcNKIFyQo1kZb3XiwfUc1kOU+QVaWc+zYiOI=; fh=KsTO535+ho9t6EXXctiD8s+tsEf6kZd4XYO4oH9mtwQ=; b=pGXPjL8iNvrf9sdq93mqDDHMekfFUVGxWLEbwUeUA2zQhldUsowq6YGBHyV062uRfB ualmstMpi8nmA8ChLlgcHXi3+a8ZJtv80NqlyjNNLtnqcCFfbsTd3FnmsGRBLCqOyXpL QQC/Mf7UyYFFQnUX0RVkUbPIwByQrYj8VOo92QvToWzkp6A5l+kS8EX+fDxwdeJdCO9R mX8C/D3eIF5bGEYuYWn83a22JxTxIL/xcMel6ZCuc2qYoMq65RjajwsIuCda9zTPNAC2 tFp5TBi0ivLsDMWSotZrdfnFTj8bhTxzwiMewVvg2Qs1g/HJ621st/geN6H5GDXcNTfp Tr8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=i6uyo8nl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x9-20020a170902ec8900b001b53d2870d8si2046826plg.33.2023.07.13.20.10.36; Thu, 13 Jul 2023 20:10:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=i6uyo8nl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234417AbjGNCt1 (ORCPT + 99 others); Thu, 13 Jul 2023 22:49:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234050AbjGNCtY (ORCPT ); Thu, 13 Jul 2023 22:49:24 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8499B2D4B; Thu, 13 Jul 2023 19:49:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689302961; x=1720838961; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=XQ9ZNDLXRYxR2/glWQTMI+edqAw/ek5JcdoktMjwEi0=; b=i6uyo8nlC36MrjMtAm/g94ryqPRK89oTB9Ri4DOaT945STWP4O7IDQjy 8INnWDmjMVdPk9zqFwmQL4whzXv7uKWRZvxWLgA9kiw+uuSbPhFBNNpbB DvkD4QbrBw6bdO84FfJAhruXYTy1KvvFBZwA+lLw1eFb7HYGncP5OfQ5h HrzEF4A8Li7gYR1YicjVw5uFuFpSqwKJn1wn9MLhUw3lu/Qk9Seyl9ZTr y2Z0U5kL3p8I2Wrj5oW8Z77vyNfWTueXgWUN8xwrol+YnxMMgXfXUf8eT /FqO99s0oQ/V+hc1U+sv59BIkmMQ7kdzn2b7StplF0K37HyPADduXIfku Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10770"; a="365412025" X-IronPort-AV: E=Sophos;i="6.01,204,1684825200"; d="scan'208";a="365412025" 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 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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