public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Baolu Lu <baolu.lu@linux.intel.com>
To: "Tian, Kevin" <kevin.tian@intel.com>,
	Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	Jean-Philippe Brucker <jean-philippe@linaro.org>,
	Nicolin Chen <nicolinc@nvidia.com>
Cc: baolu.lu@linux.intel.com, "Liu, Yi L" <yi.l.liu@intel.com>,
	Jacob Pan <jacob.jun.pan@linux.intel.com>,
	Longfang Liu <liulongfang@huawei.com>,
	"Zhao, Yan Y" <yan.y.zhao@intel.com>,
	Joel Granados <j.granados@samsung.com>,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Jason Gunthorpe <jgg@nvidia.com>
Subject: Re: [PATCH v12 13/16] iommu: Improve iopf_queue_remove_device()
Date: Wed, 7 Feb 2024 20:29:45 +0800	[thread overview]
Message-ID: <693ee23d-30c6-4824-9bb2-1cfbf2eccfef@linux.intel.com> (raw)
In-Reply-To: <BN9PR11MB527603AB5685FF3ED21647958C452@BN9PR11MB5276.namprd11.prod.outlook.com>

On 2024/2/7 10:50, Tian, Kevin wrote:
>> From: Lu Baolu<baolu.lu@linux.intel.com>
>> Sent: Wednesday, February 7, 2024 9:33 AM
>>
>> Convert iopf_queue_remove_device() to return void instead of an error code,
>> as the return value is never used. This removal helper is designed to be
>> never-failed, so there's no need for error handling.
>>
>> Ack all outstanding page requests from the device with the response code of
>> IOMMU_PAGE_RESP_INVALID, indicating device should not attempt any retry.
>>
>> Add comments to this helper explaining the steps involved in removing a
>> device from the iopf queue and disabling its PRI. The individual drivers
>> are expected to be adjusted accordingly. Here we just define the expected
>> behaviors of the individual iommu driver from the core's perspective.
>>
>> Suggested-by: Jason Gunthorpe<jgg@nvidia.com>
>> Signed-off-by: Lu Baolu<baolu.lu@linux.intel.com>
>> Reviewed-by: Jason Gunthorpe<jgg@nvidia.com>
>> Tested-by: Yan Zhao<yan.y.zhao@intel.com>
> Reviewed-by: Kevin Tian<kevin.tian@intel.com>, with one nit:
> 
>> + * Removing a device from an iopf_queue. It's recommended to follow
>> these
>> + * steps when removing a device:
>>    *
>> - * Return: 0 on success and <0 on error.
>> + * - Disable new PRI reception: Turn off PRI generation in the IOMMU
>> hardware
>> + *   and flush any hardware page request queues. This should be done
>> before
>> + *   calling into this helper.
>> + * - Acknowledge all outstanding PRQs to the device: Respond to all
>> outstanding
>> + *   page requests with IOMMU_PAGE_RESP_INVALID, indicating the device
>> should
>> + *   not retry. This helper function handles this.
> this implies calling iopf_queue_remove_device() here.
> 
>> + * - Disable PRI on the device: After calling this helper, the caller could
>> + *   then disable PRI on the device.
>> + * - Call iopf_queue_remove_device(): Calling iopf_queue_remove_device()
>> + *   essentially disassociates the device. The fault_param might still exist,
>> + *   but iommu_page_response() will do nothing. The device fault parameter
>> + *   reference count has been properly passed from
>> iommu_report_device_fault()
>> + *   to the fault handling work, and will eventually be released after
>> + *   iommu_page_response().
>>    */
> but here it suggests calling iopf_queue_remove_device() again. If the comment
> is just about to detail the behavior with that invocation shouldn't it be merged
> with the previous one instead of pretending to be the final step for driver
> to call?

Above just explains the behavior of calling iopf_queue_remove_device().

Best regards,
baolu

  reply	other threads:[~2024-02-07 12:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-07  1:33 [PATCH v12 00/16] iommu: Prepare to deliver page faults to user space Lu Baolu
2024-02-07  1:33 ` [PATCH v12 01/16] iommu: Move iommu fault data to linux/iommu.h Lu Baolu
2024-02-07  1:33 ` [PATCH v12 02/16] iommu/arm-smmu-v3: Remove unrecoverable faults reporting Lu Baolu
2024-02-07  1:33 ` [PATCH v12 03/16] iommu: Remove unrecoverable fault data Lu Baolu
2024-02-07  1:33 ` [PATCH v12 04/16] iommu: Cleanup iopf data structure definitions Lu Baolu
2024-02-07  1:33 ` [PATCH v12 05/16] iommu: Merge iopf_device_param into iommu_fault_param Lu Baolu
2024-02-07  1:33 ` [PATCH v12 06/16] iommu: Remove iommu_[un]register_device_fault_handler() Lu Baolu
2024-02-07  1:33 ` [PATCH v12 07/16] iommu: Merge iommu_fault_event and iopf_fault Lu Baolu
2024-02-07  1:33 ` [PATCH v12 08/16] iommu: Prepare for separating SVA and IOPF Lu Baolu
2024-02-07  1:33 ` [PATCH v12 09/16] iommu: Make iommu_queue_iopf() more generic Lu Baolu
2024-02-07  1:33 ` [PATCH v12 10/16] iommu: Separate SVA and IOPF Lu Baolu
2024-02-07  1:33 ` [PATCH v12 11/16] iommu: Refine locking for per-device fault data management Lu Baolu
2024-02-07  1:33 ` [PATCH v12 12/16] iommu: Use refcount for fault data access Lu Baolu
2024-02-07  1:33 ` [PATCH v12 13/16] iommu: Improve iopf_queue_remove_device() Lu Baolu
2024-02-07  2:50   ` Tian, Kevin
2024-02-07 12:29     ` Baolu Lu [this message]
2024-02-07 17:59       ` Vasant Hegde
2024-02-08  1:32         ` Baolu Lu
2024-02-08  5:06           ` Vasant Hegde
2024-02-07  1:33 ` [PATCH v12 14/16] iommu: Track iopf group instead of last fault Lu Baolu
2024-02-07  1:33 ` [PATCH v12 15/16] iommu: Make iopf_group_response() return void Lu Baolu
2024-02-07  1:33 ` [PATCH v12 16/16] iommu: Make iommu_report_device_fault() " Lu Baolu
2024-02-08  9:11 ` [PATCH v12 00/16] iommu: Prepare to deliver page faults to user space Zhangfei Gao
     [not found] ` <CABQgh9H02z+uHg_hYnoVZURz7PLeYW_41MwxciE6W+kPRgEHsw@mail.gmail.com>
2024-02-09  2:39   ` Baolu Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=693ee23d-30c6-4824-9bb2-1cfbf2eccfef@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=j.granados@samsung.com \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=jean-philippe@linaro.org \
    --cc=jgg@nvidia.com \
    --cc=jgg@ziepe.ca \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liulongfang@huawei.com \
    --cc=nicolinc@nvidia.com \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    --cc=yan.y.zhao@intel.com \
    --cc=yi.l.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox