Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp626645rdg; Thu, 10 Aug 2023 14:01:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE8NgD5sNjqnvDID6ZuYzhZcIGvW804iNrHh60ZrnSY8mborRyT2KemOiPOryKyQf2G+isV X-Received: by 2002:a05:6000:1b0e:b0:317:6846:2341 with SMTP id f14-20020a0560001b0e00b0031768462341mr2581128wrz.21.1691701269407; Thu, 10 Aug 2023 14:01:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691701269; cv=none; d=google.com; s=arc-20160816; b=Y9Uufm7TemTmwC1DUaP14YvHYfCn+8xL/W3vp+INqWBn6e/xUL1WSVViPtGDY07q4O ONjL5VTwGIQKsejHosyrwbgZlHXrwNu2bAcSMD2cZ9jpWoCDWkSaqb9/JlUlZTToQE39 qaGiM+9ePv8+xfZuIiWBab5mcz4PQ2MTWAv+WhTx88GcAw38NkqJDb+4fGMhPv4GXEXf pGkLu+w3zNn+q24fBEv/tCsq9jTkpyoUPY3LZgof60LkOwzni+vUr6sUZ3KOI4lLPQjB gsXFMnD0dnyhoZIHgxkCTx7X90OXfwGG9VIQ0yy69ROjM4rlgda1QM0kqm4YgGIPUbes h7Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kcjxdJ9WmHxKNY6KosOB3TxKaZ6LfXZdDC4NFaJO6to=; fh=xltAmSPd/yLdUi9FHi45DAi3RH3y0htPE7VC5DZecA8=; b=ukQPPQB2brinHCPNgTXiO/8DVcp6RfDBTKw8kSC3ZNfb0DslDoCh+go0isSpf+ZoqC VPQVuIXhU1oZ1HuAjgZ0OfRJQrvKeAWEi4FII0krilCoc5VItOAZv2R81CDuo31grE05 eh7m6XZgHzCP8PX2GGtswe2EP3oCcYdya2y+zeqzx7YMdAOkl5TcqQAklcbFFK/gDF5p X26tsL1U9Avh6xZeQcYCXrObV5w2sH9gSyP2bRi/g+ISz6cses8izvaqmuJJU4Aznkkh pvYE5bDE2IS9klxuhXCtSef/Yx0YQ+s+kN9T1VEDXiCYG6KSoNv/sEenxJ2rei1bLsJh 6yoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=BdW7UNRg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e22-20020aa7d7d6000000b00522274f8e24si2075544eds.389.2023.08.10.14.00.42; Thu, 10 Aug 2023 14:01:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=BdW7UNRg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235271AbjHJSWU (ORCPT + 99 others); Thu, 10 Aug 2023 14:22:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233624AbjHJSWU (ORCPT ); Thu, 10 Aug 2023 14:22:20 -0400 Received: from mail-qv1-xf2d.google.com (mail-qv1-xf2d.google.com [IPv6:2607:f8b0:4864:20::f2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDCC8271B for ; Thu, 10 Aug 2023 11:22:18 -0700 (PDT) Received: by mail-qv1-xf2d.google.com with SMTP id 6a1803df08f44-63d2b7d77bfso7102126d6.3 for ; Thu, 10 Aug 2023 11:22:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1691691738; x=1692296538; 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=kcjxdJ9WmHxKNY6KosOB3TxKaZ6LfXZdDC4NFaJO6to=; b=BdW7UNRg9AT5/2egP81zRCWOkcMVXDUf1IoXVs7kpDi/lU81fRnympXyKF6K9B9cyK 6WONDV4Q2c9S5P3f3uZL7pDa7/Q2FaJUlBMm2qWjgMdAbsBhFKKAc1YN12dpmy6iSYwA lITo7ZQfY77GJMyCh2VpHTHr3XCat9iB87Fvck0pK44glJm/A6tjCYggASebe6HJXUUv rlM4ZcRpnXmAM8T5Z/U2++n7YHKDm6qnqG83zFbHP1j0Fvi1RaYqNylfYUk5qAf5EHgj 8Fj2MPAUyhE1e/0U2eG49MOoO1uX8fovF0M71I51V4rr87rgHR/0s8kdVhlPbcKll0ej jKrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691691738; x=1692296538; 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=kcjxdJ9WmHxKNY6KosOB3TxKaZ6LfXZdDC4NFaJO6to=; b=JIq8jxSyfkiNw8moDWoV2e6Ens8LGZzSVDDi+ewYt4m2YwexFCe/3OAljA3LBf/kRG C0bgCWSGSiOOf6NVrOWOK5uEgNzU9TIMtQ0EeqwI8wdr+dngEHZrAHIYoa9i75FIM1TN 3gJdynmtbLjBHDx3mOijXD0jVoXnlxIrSu95zt5iHghUVs5aiuePb0ehGTXVkyfvPOzo tv3XlBkZcBOvBlrr5vwmt/H4LIq4QyoFscabbbUgNrWiOpjKERMxEVDuouFUYys/pbhE 60tudGi895qwpVr+HNkVLeIuKkrnd1F2TEGHmidVTOSyBosnSp+yVxVVI+gBEBhWuseq LAAg== X-Gm-Message-State: AOJu0YwalJIJH+iHGBw8AUoZHhz7lIAR15zt+cBW3HuiupF05m+td8qN CjdvHXh59KQblmH+Coj/SMkVPQ== X-Received: by 2002:a0c:c986:0:b0:63c:ed11:7bf0 with SMTP id b6-20020a0cc986000000b0063ced117bf0mr2923351qvk.6.1691691738065; Thu, 10 Aug 2023 11:22:18 -0700 (PDT) Received: from ziepe.ca ([206.223.160.26]) by smtp.gmail.com with ESMTPSA id r27-20020a0cb29b000000b0063cdcd5699csm665282qve.118.2023.08.10.11.22.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 11:22:16 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1qUAIa-005HuO-83; Thu, 10 Aug 2023 15:22:16 -0300 Date: Thu, 10 Aug 2023 15:22:16 -0300 From: Jason Gunthorpe To: Lu Baolu Cc: Joerg Roedel , Will Deacon , Robin Murphy , Kevin Tian , Jean-Philippe Brucker , Nicolin Chen , Yi Liu , Jacob Pan , iommu@lists.linux.dev, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 04/12] iommu: Replace device fault handler with iommu_queue_iopf() Message-ID: References: <20230727054837.147050-1-baolu.lu@linux.intel.com> <20230727054837.147050-5-baolu.lu@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230727054837.147050-5-baolu.lu@linux.intel.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 27, 2023 at 01:48:29PM +0800, Lu Baolu wrote: > The individual iommu drivers report iommu faults by calling > iommu_report_device_fault(), where a pre-registered device fault handler > is called to route the fault to another fault handler installed on the > corresponding iommu domain. > > The pre-registered device fault handler is static and won't be dynamic > as the fault handler is eventually per iommu domain. Replace calling > device fault handler with iommu_queue_iopf(). > > Signed-off-by: Lu Baolu > --- > drivers/iommu/iommu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c > index 4352a149a935..00309f66153b 100644 > --- a/drivers/iommu/iommu.c > +++ b/drivers/iommu/iommu.c > @@ -1381,7 +1381,7 @@ int iommu_report_device_fault(struct device *dev, struct iommu_fault_event *evt) > mutex_unlock(&fparam->lock); > } > > - ret = fparam->handler(&evt->fault, fparam->data); > + ret = iommu_queue_iopf(&evt->fault, dev); > if (ret && evt_pending) { > mutex_lock(&fparam->lock); > list_del(&evt_pending->list); I don't get it, why not remove fparam->handler/data entirely in this patch? There is no user once you do this change? Jason