Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp135890rdd; Mon, 8 Jan 2024 22:01:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IFJLgCluskYOz7MT51qmam9PvbWW7kcw2lduC+qZWzPJ+gFYUjw2E7HocsZFXWjKtF2zQY+ X-Received: by 2002:a05:6358:70c:b0:170:ee27:bfa1 with SMTP id e12-20020a056358070c00b00170ee27bfa1mr4091903rwj.5.1704780097120; Mon, 08 Jan 2024 22:01:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704780097; cv=none; d=google.com; s=arc-20160816; b=H+gPWbraG+xA3XsKsHCGJBB3YMxXuaAS31LDIaEtS5O6AbmqVNoZE+OpA6hoD/3TcQ +Od5dzAMJRyyd7BfidUXrAOouzxH5xeOpcb4zWILEN3m/9a3Kw9byDPkVxYLREpj2K9e kF/UGhu0w2MiRTCEcNQVAYDbivrhX66JvtHk8EewN317tdVjtceUfnseFMKj5lDevGKi vssDX5Q4rqidExLIRvDJE0jZA633UgrN7oj3NT3hJSn2c0VIVZP01n6CRemf8qKne/Xk c2PLBulYC9XJOkT3nJPKWFAGMuow1czWjeLH1HZt/j5ExSp0DJAuQqLC2RA4fSjy1/9n p+tg== ARC-Message-Signature: i=1; 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=p8xB++4sZFLaxpVO6rVhPdl6ZgNf0mEmWV78hOP5CBo=; fh=uzznn7J+IYAjVbPHItJO5zuzOqyiZAy1PaNe6S3d3bk=; b=DSCVLwN1vzzRQPsykJPFpYvJyjLyxqMyA2x3Te9WzrNKsaDHO8he/dokGK4q0aOyNw 7Nk7VwtVkYvigIyx3IKszHrPkH4kFJyjmUlbSS7R7CmKw5WRE0Vd0b2pNhw+wFsMS8zx PrE9wiuXN/YbS1xd1mN3OAszDXRfflXJBvtacDa7NdYhlMhon2bySIZ3VQaqQ1O8cskx YT3qTsuOFnMViTMiHK/c1WbD+eiFFQaGGdXAiSepi5jSG0avAKScaTEg+uyhT8j2B12t kXdblB9zUvovVvHmmgVu/Ax+C/vK/MUw8YVYHvxJKmrVbEs/jm3BSeHbCNALrvAmludr Zrgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="MG/nb9DQ"; spf=pass (google.com: domain of linux-kernel+bounces-20419-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20419-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id y5-20020a17090aa40500b0028cd234e938si6745787pjp.61.2024.01.08.22.01.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 22:01:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20419-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="MG/nb9DQ"; spf=pass (google.com: domain of linux-kernel+bounces-20419-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20419-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E51E1B22E60 for ; Tue, 9 Jan 2024 06:01:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B07263B9; Tue, 9 Jan 2024 06:01:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="MG/nb9DQ" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 BAA9D15A7; Tue, 9 Jan 2024 06:01:17 +0000 (UTC) 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=1704780078; x=1736316078; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=Cezvo80lqsWNNBHgcaX+gkBDbwknIaH/Y08nlDDml3o=; b=MG/nb9DQJ7W2/crb+0tqdmA0zzMF0G6eBEFvgLt/MXKkAhGJrujP8EE/ nKNxd1cZEzyQ7L1n5EXVsr+PCCGF+etUodhNgYNSKYOYAXV2Qhei12Ewb RKvDUz8OxJZLb4oDIa3UvsKDRABIpoTqYraG3xPIAl23llX9Yfzd1Pdcg +itiCnyJKjUrpl1Dy+MaNkE+XgSpoWy8GCTkbTGRMyvoXuTM7Z3knFEgA 2FgNwzSnnk3BkOsXUfPJCYFhel5QVv87CKTYLzp9DHo+G1Gp/CRq3OHCe QY4QhOe17KLA4KHKvK5BNbLFmvHclXpBFWnqVLX3P1iz1A0PE4b0i68Rq g==; X-IronPort-AV: E=McAfee;i="6600,9927,10947"; a="5459892" X-IronPort-AV: E=Sophos;i="6.04,181,1695711600"; d="scan'208";a="5459892" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2024 22:01:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10947"; a="905037339" X-IronPort-AV: E=Sophos;i="6.04,181,1695711600"; d="scan'208";a="905037339" Received: from allen-box.sh.intel.com (HELO [10.239.159.127]) ([10.239.159.127]) by orsmga004.jf.intel.com with ESMTP; 08 Jan 2024 22:01:12 -0800 Message-ID: Date: Tue, 9 Jan 2024 13:55:59 +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, Joerg Roedel , Will Deacon , Robin Murphy , Kevin Tian , Jean-Philippe Brucker , Nicolin Chen , Yi Liu , Jacob Pan , Longfang Liu , Yan Zhao , iommu@lists.linux.dev, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v9 14/14] iommu: Track iopf group instead of last fault Content-Language: en-US To: Jason Gunthorpe References: <20231220012332.168188-1-baolu.lu@linux.intel.com> <20231220012332.168188-15-baolu.lu@linux.intel.com> <20240105175339.GI50608@ziepe.ca> From: Baolu Lu In-Reply-To: <20240105175339.GI50608@ziepe.ca> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 1/6/24 1:53 AM, Jason Gunthorpe wrote: > On Wed, Dec 20, 2023 at 09:23:32AM +0800, Lu Baolu wrote: >> /** >> - * iommu_handle_iopf - IO Page Fault handler >> - * @fault: fault event >> - * @iopf_param: the fault parameter of the device. >> + * iommu_report_device_fault() - Report fault event to device driver >> + * @dev: the device >> + * @evt: fault event data >> * >> - * Add a fault to the device workqueue, to be handled by mm. >> + * Called by IOMMU drivers when a fault is detected, typically in a threaded IRQ >> + * handler. When this function fails and the fault is recoverable, it is the >> + * caller's responsibility to complete the fault. > This patch seems OK for what it does so: > > Reviewed-by: Jason Gunthorpe > > However, this seems like a strange design, surely this function should > just call ops->page_response() when it can't enqueue the fault? > > It is much cleaner that way, so maybe you can take this into a > following patch (along with the driver fixes to accomodate. (and > perhaps iommu_report_device_fault() should return void too) > > Also iopf_group_response() should return void (another patch!), > nothing can do anything with the failure. This implies that > ops->page_response() must also return void - which is consistent with > what the drivers do, the failure paths are all integrity validations > of the fault and should be WARN_ON'd not return codes. Make sense. I will integrate the code in the next version and convert iommu_report_device_fault() to return void. Best regards, baolu