Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2181186lqo; Sun, 19 May 2024 18:17:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUmVECB1DcwSSfClQ8SpILa5CJljv73Ik0DuLTXSJgxLfz1zgp8ZIlvhczr805gUUgi4680ImXfztPRAZs6c1nXs2gLBUZeT+ja1v+vDg== X-Google-Smtp-Source: AGHT+IHV2z+ySMbgNCIIKhREhI1Yd7l5e3BhIXO4dwQZIEaH+C6XSqwlHoikXleclSopYgNbCDIh X-Received: by 2002:a05:6512:15a8:b0:51d:9ea3:5649 with SMTP id 2adb3069b0e04-5220ff71d30mr23234261e87.10.1716167860552; Sun, 19 May 2024 18:17:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716167860; cv=pass; d=google.com; s=arc-20160816; b=q5Tcf6OLpPDu88zFo+So1Hc9zN48e8A3AoVGMHUxs4j+ok4vT4s6jG6T2JmNkj7MM3 NJ3iqYZyE1s9UXMO1Ye57BHg3T4PdiPdcRUyDKrdZUwcXuAZG6bKh05yYTcjOi4c3Sxd 4lGIL2OB0WRNmJNyv52HJlTCF8klrCDl1I8RAzOEgVuJ6E7hPIHMGbRMaM3nhYb1DGCj dXc9bDDSaZ5uopVIZiL4Kui2Gig6wNm8TMLgitRMnpB3U570rS8Devg9yErtkddx+xk2 N5GJJvofD3dO3vx8W7zc0XebhGpD+ePQ/DlmOsgPqVkKnaWYmnSqaJbzsxHP1LvwzjgK 8Xug== 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:content-language :references:to:subject:cc:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=o1b+MFzv/y1teOikmnrjoEc2C8I/HBJpEJ+ojMJEKRA=; fh=oj0MC99jJmXr9VOxYru8PCxqsxVpffpkkk/RjcP5DFo=; b=iyYA+idImF+iPUn0ziXxxmgXQeGDB2x/fypA5xTtaOVXNZNH7ImTMgbnXQjovy9dQU G+5fxZknLAqgDyb/UE7JnH0cF2H/nAciFCV//pWgS4x8WIb6AdOv3rSvTv8ARS03k0nL F/I7TpOHiL6gIIOGzrJZcbesxTvOxylPAWYsUU0VA+UnquzD5nYKPBMQfNw/LYWlqog2 A8EvvMYW/JcwqZ4oJwodijMN3TKYNfhCo3gYQucRyaXSPsHhYztvlurun3iOfN0ZIlk9 v3uzgw601yPM4oBMgR4drbV5+VQ02tfZXMOr1nEsvL2bEQhDcBHlQGsBjZmbv9gFNLYo vuKQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="f7Nn/q5S"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-183317-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183317-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5cdab8a4adsi536962066b.53.2024.05.19.18.17.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 May 2024 18:17:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-183317-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="f7Nn/q5S"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-183317-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183317-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 48D091F214B7 for ; Mon, 20 May 2024 01:17:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1414F525D; Mon, 20 May 2024 01:17:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="f7Nn/q5S" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) (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 CB6D04C65 for ; Mon, 20 May 2024 01:17:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716167853; cv=none; b=dT+q75A9oAlvIqiMLxLE49K/McXDSFT3UfNSAEI9eBuYtPqiS1wXjNanUnEs+c/zTA3V2WmgMM1JS8cglOCYCyDzgzLt5iKYlRhjDugPYmyDF92Woso9w3E0iU7VrU6+xbV4N6vWxO3UlFErGLORBtSQfxjFXaz80MUhBxoOY4g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716167853; c=relaxed/simple; bh=OBsVYV9d4GvPqYKGWaHDECvr5gkFQ/7IA+nKs2nXEZ8=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=apNQ+xRKtVm56rbAKlTzT0r/ADDeRLLBSgDIV83C5aLWE0Z7g2vlAhOhhQjMPS5nXPhMQqOOVY9gzxj27S+l0GsbQVZmGf+6TMl+efi+HWNRIHbhV6c2zEQsfYcNUQP8gC/Bw4gMbX2tUOO6PitsK1LzJW4TECChFlaZ2liVJNg= 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=f7Nn/q5S; arc=none smtp.client-ip=198.175.65.17 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=1716167852; x=1747703852; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=OBsVYV9d4GvPqYKGWaHDECvr5gkFQ/7IA+nKs2nXEZ8=; b=f7Nn/q5STYIeQDuIiAHktoKwkcdZejOD40tTK4Lv1Efqb8Xj5jwh46Yl 2vpPg+KYcVC9k076pUH9XNI2OOml4yJJl7Ibkn7fhPaq8vQBoQCOoJTLF WnRqIdsaITkjfjlhjyyWRzkQv6XiMA/NG/hgnXeqhheiXg19iNPpf6fiq nkbqj8fSNE8EkK0pF1Q/8YO5v506JNivpN+5Mhtygd0G8ipqS0OsA7TgD rGtdKe1cIXo4f9MrpR0R+SwU9yR+foBXURReFL9q3Ipmzu+RE6I7frP0D /EkIIjdg74ssgQ/IWPcWvMH77USwYZmZjTOxQloBJKKxgP5msHR9FFrOY g==; X-CSE-ConnectionGUID: sSAKMVsgRcWFiOttYdcSWQ== X-CSE-MsgGUID: C4TsEdAHR82iSOgUSq+ytw== X-IronPort-AV: E=McAfee;i="6600,9927,11077"; a="12398672" X-IronPort-AV: E=Sophos;i="6.08,174,1712646000"; d="scan'208";a="12398672" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2024 18:17:31 -0700 X-CSE-ConnectionGUID: ZxRdiSnpQ7+C2n7WWTY8JA== X-CSE-MsgGUID: TEqOrygfTx+PwakUljXaig== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,174,1712646000"; d="scan'208";a="69805798" Received: from unknown (HELO [10.239.159.127]) ([10.239.159.127]) by orviesa001.jf.intel.com with ESMTP; 19 May 2024 18:17:26 -0700 Message-ID: <2dbfb49b-3d2e-4a3b-ad1b-e53062edbbd4@linux.intel.com> Date: Mon, 20 May 2024 09:15:35 +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, "iommu@lists.linux.dev" , "virtualization@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v5 5/9] iommufd: Add iommufd fault object To: "Tian, Kevin" , Jason Gunthorpe , Joerg Roedel , Will Deacon , Robin Murphy , Jean-Philippe Brucker , Nicolin Chen , "Liu, Yi L" , Jacob Pan , Joel Granados References: <20240430145710.68112-1-baolu.lu@linux.intel.com> <20240430145710.68112-6-baolu.lu@linux.intel.com> Content-Language: en-US From: Baolu Lu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/15/24 4:37 PM, Tian, Kevin wrote: >> @@ -395,6 +396,8 @@ struct iommufd_device { >> /* always the physical device */ >> struct device *dev; >> bool enforce_cache_coherency; >> + /* outstanding faults awaiting response indexed by fault group id */ >> + struct xarray faults; > this... > >> +struct iommufd_fault { >> + struct iommufd_object obj; >> + struct iommufd_ctx *ictx; >> + struct file *filep; >> + >> + /* The lists of outstanding faults protected by below mutex. */ >> + struct mutex mutex; >> + struct list_head deliver; >> + struct list_head response; > ...and here worth a discussion. > > First the response list is not used. If continuing the choice of queueing > faults per device it should be removed. You are right. I have removed the response list in the new version. > > But I wonder whether it makes more sense to keep this response > queue per fault object. sounds simpler to me. > > Also it's unclear why we need the response message to carry the > same info as the request while only id/code/cookie are used. > > +struct iommu_hwpt_page_response { > + __u32 size; > + __u32 flags; > + __u32 dev_id; > + __u32 pasid; > + __u32 grpid; > + __u32 code; > + __u32 cookie; > + __u32 reserved; > +}; > > If we keep the response queue in the fault object, the response message > only needs to carry size/flags/code/cookie and cookie can identify the > pending message uniquely in the response queue. It seems fine from the code's point of view. Let's wait and see whether there are any concerns from the uAPI's perspective. Best regards, baolu