Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp432093rdh; Wed, 7 Feb 2024 08:49:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IH0MiFzL9bt1/adU2wKTbgnp31Wnd/T6jYwvdC1Uy20oTIMeBmlAN3pW3IBHO3Pg2WsVciV X-Received: by 2002:a05:6358:72aa:b0:178:6211:871 with SMTP id w42-20020a05635872aa00b0017862110871mr3405677rwf.0.1707324578361; Wed, 07 Feb 2024 08:49:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707324578; cv=pass; d=google.com; s=arc-20160816; b=hYYrYmsT8ZtLIzc89WK55yRo2MBv0azD7renmdJ6669kkXZmDhcqa/gh2Fok/cmNw+ 7hBWToXEayT+h57LSZADyS49JsQKeq3VEr77O5IjL9g62OzUM/uIFd2hByRcLO6I6Svt RSlhhBLrGwRvXBrTMwiiyLzFq43yGYqVTCRobtQCKYBoIgE7BYJ9imJ+vu3XcJvAxdJJ N/d3cGckqmY9D83+rLrvYUzdqgweZaFjVwVRqn8RaI5eU5rn9LL/tofCNROJpeDdWJCS tn8i8XTcz4Zmz9IqqD7iNxKfvFqzfMIdbXC8DJXzsIy7nB6dSb9ZMZIwfPn2m1Ag4997 cwhg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:cc:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=KG1SPc0+DND4EZSycqDO+Ocdw8WeNSQnM+/uNCbG0GA=; fh=06gBPNhFhGLG7out9eP24jZNVnMHyiVD2RWQzpDivd0=; b=tPkNXPgls6NB2KwleOSQfMil/xx8L4EiWOe7T6e500AI6PcJ9h1UKlBkhwqvI+cbVq m0CoyFdMnvIN6U3mPDIjrkasSWkqQ4on087eGlNoCMSWCyhN7o/LHxgR7jJDfqoxB+oz hTviReZR0EI2E1rZtRkvda9kP72N9bnrRX59Qdpb+xM9k7uobeNecshd8Z9LqUIr+HyZ kIRJ/ei3OQt33HmsRaooDsXy/gni2ebBhYFEBHOPQHwfdodMWETtq/n2utRhwhdnAfuX L3QF8CA4V2y9yutCW6f5hz7EzpwdkKNL0n4WAfFnqJIIXwPJxnXjhFEctIIwDrQ/l354 e+sw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Q3vJ7KWR; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-56484-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56484-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCXA7eLljw9tYO544YxrvrkLsRRpVJV9E1sJEIkedRVl/hrFZaFnG687Q8rqDXOKVrHdHqo/JCJMAzUDveP53nQlw4pvT5rlpTJxs2Hh2A== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p26-20020a63951a000000b005dc375e5da4si1185110pgd.486.2024.02.07.08.49.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 08:49:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56484-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Q3vJ7KWR; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-56484-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56484-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A650E288DA1 for ; Wed, 7 Feb 2024 12:30:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C966E5A118; Wed, 7 Feb 2024 12:29:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Q3vJ7KWR" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 6580F5A108; Wed, 7 Feb 2024 12:29:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707308994; cv=none; b=gLJwaN/5PNxKopRmWutbEHCRzO5O8kmtBOrnsgLrkzQXLReQm3LMONiOVoWa5K3qKapsXvRlTulvifMszs5lmaiv1YIBwAl+qBLRHgoqHxwvxaumT4RHq5jiL4PzJa5WQj+75fepM6K1MKijGK36+WLKwpUqoP/au8Nsm22LGlc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707308994; c=relaxed/simple; bh=khJSx+sRKXLZUupDrn2ywNGOHTSvykattMG1rSkvEOk=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=El2WA0+0AkS+hTu48N7ZzUVMDxUUDqdGPDwk6td/1mynMFfC1XXiyOyazcaWQ6IrJjy3MfKhkYwEMkv+0eygs/joXKNvBYJjyOgq/iSFIvje9z3Y90NZSXfuMeka8jnbH3oNkG0vVdEixRQlMQcOQLkOQTW2DkayjRh1W9ulMUE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Q3vJ7KWR; arc=none smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707308992; x=1738844992; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=khJSx+sRKXLZUupDrn2ywNGOHTSvykattMG1rSkvEOk=; b=Q3vJ7KWRQytrL0y9+0K7Ii2yCrE7EAb7ozLHmjddU3zKm4iXnM2jFMLD UmT3xCeAZOz9aLPY3FhcG+qQfkUi1iSnkeY+T3aSpuD7QQVGrJunU5iLH Oicewx5Fxla0rH37GzNUMhzZpoy++uPTiubYzK4Gfy1XOuuKvUPmo0Uim T5yaVxsYsCLuLk6Mq48vCow5wn5yVegYcIEazlZ9fUiYb+9iffFQUNHmk BR3TPnO5qYmsHrLsUIsnH6DIzR+QaYPkS1yvX0krDYlCNghja7ctrNtU3 yxFupu+FYXSXXg+JWGTCktC6HpVlz6aOdWk3WFDSF3kZU+1R+/FgXsu0Y w==; X-IronPort-AV: E=McAfee;i="6600,9927,10976"; a="1254978" X-IronPort-AV: E=Sophos;i="6.05,250,1701158400"; d="scan'208";a="1254978" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Feb 2024 04:29:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,250,1701158400"; d="scan'208";a="1319731" Received: from blu2-mobl.ccr.corp.intel.com (HELO [10.254.215.224]) ([10.254.215.224]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Feb 2024 04:29:47 -0800 Message-ID: <693ee23d-30c6-4824-9bb2-1cfbf2eccfef@linux.intel.com> Date: Wed, 7 Feb 2024 20:29:45 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: baolu.lu@linux.intel.com, "Liu, Yi L" , Jacob Pan , Longfang Liu , "Zhao, Yan Y" , Joel Granados , "iommu@lists.linux.dev" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Jason Gunthorpe Subject: Re: [PATCH v12 13/16] iommu: Improve iopf_queue_remove_device() Content-Language: en-US To: "Tian, Kevin" , Joerg Roedel , Will Deacon , Robin Murphy , Jason Gunthorpe , Jean-Philippe Brucker , Nicolin Chen References: <20240207013325.95182-1-baolu.lu@linux.intel.com> <20240207013325.95182-14-baolu.lu@linux.intel.com> From: Baolu Lu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024/2/7 10:50, Tian, Kevin wrote: >> From: Lu Baolu >> 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 >> Signed-off-by: Lu Baolu >> Reviewed-by: Jason Gunthorpe >> Tested-by: Yan Zhao > Reviewed-by: Kevin Tian, 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