Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp908266rdb; Fri, 2 Feb 2024 07:37:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IGnCs2NItJ1rggYWfGTpaMjwLBI91jfLgnM0lBV2BWUxXHUvoowLOS50X0TpfPIq5JUOCyw X-Received: by 2002:a17:906:7013:b0:a36:239:77a with SMTP id n19-20020a170906701300b00a360239077amr1764768ejj.23.1706888221779; Fri, 02 Feb 2024 07:37:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706888221; cv=pass; d=google.com; s=arc-20160816; b=JrpB/G0km4IHtrtjylRra1+SMrrgvYxk8MZTVTzikLRPPqPdzSEoyjFfNbYbeNGuVl aqETSA8wDBvpwFOI5LifgOpOvHRuqOCrDg4MogECQwfb+gHi6ty2h1khYvn9YGA9qr9U heQuprIcpjCZnQhmw4IG44B0bhYKz5I/qoe4/O2jg574er7hj4m/zpC7VnBNlN1YjiDZ 37G7k6I0VGDSm7Ek2F5hAT45RtkSkXNKO4PPCVj1XOucmdh8RroOilw0eVCQFc8gd9ex yxBCO57e3sobhgEpvN498BADAGr4qIvrb7gvONOQ1B/OSNJtTOlSuTsvIVRn/nlvGiw8 WxlQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=jRSa4TT8HVH8576bDhqIPmdbLRM9nyjGP0P+K9geus8=; fh=jY+lFQNKO3OU2+qDUVaNhfvp3b9ps7BGt3ilQK3aqO4=; b=O4P9GwdnGN9KlWb9myeRVEbjYxfwtWim9W4aVQpqUVegL6386f8ADbsjqf9oKrcDAh +oKcYI7ThOUF2rv9MPFOQORCrI/ns0z11drAMPZecJYeIJcybJMZ5X+aUKgVUSXIN/v4 4V7PyjVoqjTUqd8ijAm+7NMbKCzYKv1iSHaNYtmOxjIAK9o7iIB/MyR5JgiJxPFeLUZA IXC8vxEr5TCRoI7WIhOEE6SRjQ021mff1ZR437asbaR6aF9Mhi72KE0F9TGhTtuxIE3E OGaPS/6Fl1dL3NzVHsYBs4+ud8CDkMXYE0jCB35mxgoYaKyvez4KAM3IMHeF1Ch0b8WL gk9w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=It4UgSvK; arc=pass (i=1 spf=pass spfdomain=ziepe.ca dkim=pass dkdomain=ziepe.ca); spf=pass (google.com: domain of linux-kernel+bounces-50029-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50029-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCXPc6/caslq8fCnQfNPpl9K696pEjx9T96fh7MEKkrKjAhbFEI7i8XuuB527S007OTaUXL89lz81Wj0yt2biogMCuYuspY8NdhK45Aujw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id m24-20020a17090607d800b00a368b791a21si983257ejc.833.2024.02.02.07.37.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:37:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50029-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=@ziepe.ca header.s=google header.b=It4UgSvK; arc=pass (i=1 spf=pass spfdomain=ziepe.ca dkim=pass dkdomain=ziepe.ca); spf=pass (google.com: domain of linux-kernel+bounces-50029-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50029-linux.lists.archive=gmail.com@vger.kernel.org" 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 B1A8F1F272E4 for ; Fri, 2 Feb 2024 15:36:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8FF8B1474A6; Fri, 2 Feb 2024 15:36:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="It4UgSvK" Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 565AB14691D for ; Fri, 2 Feb 2024 15:36:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706888194; cv=none; b=WWlpfwNnxfuCHVkc20f9hEDkwKsrUgEJ3nIoKVTWSEh9fAMuT46sWVjS05hppwvQkXV9nCUfObhrP+a+atc7BKX+ZF5xnjAEvf7vl5SE2TsWazOHag0MfU+4vcGhb9lfS/80XnibGabgJRw+4yEjHl0zliSAOUZDQ4800xfvei8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706888194; c=relaxed/simple; bh=Fg0vF/DKGnFKdPAxtNJWEsCiIanMISLov5rth1azicY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fxv7RgvEz87Hmc1QGOh3B3tBOlbYVKpyARiIUaKkybiAiydxpsn3sqmryj49IOSHTdCiUOcelw86BZat1KfZUigD+AaxRUL96Sldo85zGz8v/6hAe0UODau2kZ2S1ppzJi6zrnRFSl5Ji2Z43THeCBiVDp8xMIVHNwEEDzV/Xp4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=It4UgSvK; arc=none smtp.client-ip=209.85.222.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-78552105081so47449685a.3 for ; Fri, 02 Feb 2024 07:36:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1706888185; x=1707492985; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=jRSa4TT8HVH8576bDhqIPmdbLRM9nyjGP0P+K9geus8=; b=It4UgSvKLEpxOMpS7xqSJijhPsH5kq6d3Z3PfOt64xfqKYUDQc7S7XNMYqrlf28Ssu e+tGq/2S4bUWfo+1XQlYrbDhpA8WkOOsfyTnY1m8hEogjNSGCIQBfXAKjK5btJ8E6SQ5 ObGCy93QhPdj8VXDJL5TKrU2NCdFk8xkyLcbkRtBk5ij7GOrxU6WLdaJ7HECiFAr4A/4 tDTzJvc+SyfUhnyqrb2JUf3kIAEzvcwcb6VOvIg705tsAHtW6aGXGYh4PYBaGSBwdzNC zhrhSCEP9iJjXygGv12cK3f4Dc1ZaEgaty/QsSTeOqnaeYk9IQCjPE3SLKk2Q/hLnFMw vnSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888185; x=1707492985; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=jRSa4TT8HVH8576bDhqIPmdbLRM9nyjGP0P+K9geus8=; b=IdcYaib4elBWxlLBA7lIj/PiwlfomLrRJx7GkcJrfhxanOczVv4/f76wXzhPGZQVWs b259hDCiPVei0PvyWcS4Vg6wPstY8ETH25xzRbEK1yEJRFVblZ1y5ae8VG1VD5ktO/Rv 7DJiVODG8bCKebn6AnMfL/ueoDEk6bc7EkAFfNKZE5CM3wJKymKZ/IejlSbMpE2trJcU GPbTMccV9P5iu05N8+ds+Ei+inqWICJPhcZVC6ltx53s+Skgwf38ylpZeV1et9p0vzyF W+7JX5Fk0mNHLhXZAnYOno5vG+JnbLNrWzLNQLAzfqc9k5dAESzJXSlBxdG5Ou14zK5T g4WQ== X-Gm-Message-State: AOJu0Yze10Fdtf8S+0mK+/YpFjLKBZFUV+VjBcFFy96MNpmD1+T8k7pU DAaNxzhXFlObchZGyrMwtie/KrCvponVn5fNj4GiJ5xMxV2MYvxZcU+voN25JQU= X-Received: by 2002:a05:620a:1447:b0:785:43d7:cd0d with SMTP id i7-20020a05620a144700b0078543d7cd0dmr5503107qkl.27.1706888185060; Fri, 02 Feb 2024 07:36:25 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUFwKseQX4Qsq/U7oliva32huh0WpnlP9H2RmmN32JeZGOlrWJLaJZWLc9ppObbDwYDQV4sN7pUUZMCsO8tSFXSQJmcRGn+0ufquLHbJD1n5fzINj6sjjJv3dkjJOrN1QEsZiBVWFkYzeqnXqMwOqEHyIymkSi3B0oCOc5x9B6RE9X0hh8jrCLAS/PANjfoSo/rRgMRJGBcFJUCufODDCXB9jPLvby/TOw6PDi/PiXXaNWf6dsKiH+LDw3kiKrGVwerK4/DkUHol9QZWPHWp5Omyx0ca2rOvsUYk+OUWtuGlc7B0eOG3a6RzgWhdK8dYHm0gscYJwdfLAiXXgZ7SzzLyziu3DsqSb/YsxwTsJLPwdREaYfhXn96czeFqnVrIVcsWxSSIWpVfPCraGXpvS0VTC8bFw6Xzg4VBcDrwgor7MFt03tk Received: from ziepe.ca (hlfxns017vw-142-68-80-239.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.80.239]) by smtp.gmail.com with ESMTPSA id vu21-20020a05620a561500b0078552f53b85sm724769qkn.86.2024.02.02.07.36.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:24 -0800 (PST) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1rVvaZ-00AwH2-RL; Fri, 02 Feb 2024 11:36:23 -0400 Date: Fri, 2 Feb 2024 11:36:23 -0400 From: Jason Gunthorpe To: Lu Baolu Cc: 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 v10 15/16] iommu: Make iopf_group_response() return void Message-ID: <20240202153623.GA50608@ziepe.ca> References: <20240122054308.23901-1-baolu.lu@linux.intel.com> <20240122054308.23901-16-baolu.lu@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240122054308.23901-16-baolu.lu@linux.intel.com> On Mon, Jan 22, 2024 at 01:43:07PM +0800, Lu Baolu wrote: > The iopf_group_response() should return void, as nothing can do anything > with the failure. This implies that ops->page_response() must also return > void; this is consistent with what the drivers do. The failure paths, > which are all integrity validations of the fault, should be WARN_ON'd, > not return codes. > > If the iommu core fails to enqueue the fault, it should respond the fault > directly by calling ops->page_response() instead of returning an error > number and relying on the iommu drivers to do so. Consolidate the error > fault handling code in the core. > > Co-developed-by: Jason Gunthorpe > Signed-off-by: Jason Gunthorpe > Signed-off-by: Lu Baolu > --- > include/linux/iommu.h | 14 +-- > drivers/iommu/intel/iommu.h | 4 +- > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 50 +++----- > drivers/iommu/intel/svm.c | 18 +-- > drivers/iommu/io-pgfault.c | 132 +++++++++++--------- > 5 files changed, 99 insertions(+), 119 deletions(-) Reviewed-by: Jason Gunthorpe > > +static struct iopf_group *iopf_group_alloc(struct iommu_fault_param *iopf_param, > + struct iopf_fault *evt, > + struct iopf_group *abort_group) > +{ > + struct iopf_fault *iopf, *next; > + struct iopf_group *group; > + > + group = kzalloc(sizeof(*group), GFP_KERNEL); > + if (!group) { > + /* > + * We always need to construct the group as we need it to abort > + * the request at the driver if it cfan't be handled. ^^^^^^ can't Jason