Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp5819352rdb; Sun, 31 Dec 2023 19:40:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IHwtvVqFXBzYkxN2t9bQKfbpM/2oSpZwKwE07L/YkUMMYXvf6gXa4Gy2njtTr4byfnOYemn X-Received: by 2002:ac8:5786:0:b0:427:ef72:499a with SMTP id v6-20020ac85786000000b00427ef72499amr10549256qta.79.1704080409214; Sun, 31 Dec 2023 19:40:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704080409; cv=none; d=google.com; s=arc-20160816; b=uxCx7PEJH2dA1FAQwPzCqc+yWr19p8TwgJYZT38oRpq3jtcHdaj/uWVVihiOJpEoXS LlZbj01t9U+nL0wj4yE4jZe9dukCKC7gyJozHs6+wk/QesZRWFJU5CELvL6cHl2u5P0N MU7dLc+mvA2FdlPY9DzxnDqzPo/w7JrVbgGJBkGinMUYb39VGDSFFgZRybVa3Q1tQmo1 aUxktp7wjnjr4Qqg8OlmN3B+pmBGGFy/iAdocZtoLpMhLh71z73Ctj7QB5I2RVXm370u QcvKeOezvKl/HFpK8O8eCCPouk9qDaRzmkoATGQBGiwzSVLG+ztP4i5a2kSbQsjfxM3c cl2Q== 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:content-language :references:to:subject:cc:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=qE5UW+EZwh3H9Cs8uWK0YdkbEPxe1I8esHuTZPMYips=; fh=7W9wXQb1DTqViF6DU/K/Lcx6T1QNvkH8gCGGn6/3EV4=; b=0C80+hMzmoo40pAGWdg+oaFTObesMnmlRFhmhw2oOThTaaHnriweJzaERzcfLMXJ5a /o0AxOjb2fOplA2s6h1rJA2Y0Q+JhusIVAD/rpqhZlqD+hZZDGvJBXymLC3c+qcCspEe dnj9e+2bqj97mKqGtTnTgrKnL7jQHO+RHgaasuMoT5Xv+U++Dwe9Ofk3zGdL4eimkioz BazfyPMfX3glBg1fIA98D0oYOT0MKKVIErMOwQLV2ay2ciltnplAlpd4U1p4afGxUnFN Q5PQyud14SCmX7z9QBSZlt9zIGePuk0i+CUFPkC+/yzDOIlr8KxvXxb4PK0MLoXfgalA ICxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kTZTylDt; spf=pass (google.com: domain of linux-kernel+bounces-13821-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13821-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ay43-20020a05620a17ab00b0077d59d88b25si25519231qkb.273.2023.12.31.19.40.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Dec 2023 19:40:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13821-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kTZTylDt; spf=pass (google.com: domain of linux-kernel+bounces-13821-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13821-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 94C161C21C78 for ; Mon, 1 Jan 2024 03:40:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9AE061368; Mon, 1 Jan 2024 03:39:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="kTZTylDt" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (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 5A164A52; Mon, 1 Jan 2024 03:39:54 +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=1704080394; x=1735616394; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=TGBXTbeX8tde9ouDg3XSWCKQoZCnrld95jzC7rtlJzQ=; b=kTZTylDtci4r9lxihY/c8bL5EONzJB7/jQJjnW5XZ0ShUTVpJjRp3fvS 7+KESNa29noghU2Br+MaPjnFt45fO2lFrf3wt1yfXU1rO16xSGUeIsSGi Md1N5v1Dy+FKoRsd2U3wCG6iLRpXLMHqXFKlooSxZx0E801eqnoHB7X+w 78x+d5/lLIoGIChkS4aOI8Lg1oTubKQt2K6g8D4PzNVDqR7VHAZuAUqrN lCC3dXaRjJ9YmpTrDOMi05rF+nKBCWLkLo+AqtTi9upJhiI9+8vCi6Jbm w6XaMYlFkX5etbvdVUNL0l2OPa5wtYWMj1/LX7w8SxZSvb5orZA98f9nw w==; X-IronPort-AV: E=McAfee;i="6600,9927,10940"; a="15412198" X-IronPort-AV: E=Sophos;i="6.04,321,1695711600"; d="scan'208";a="15412198" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Dec 2023 19:39:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10940"; a="902785434" X-IronPort-AV: E=Sophos;i="6.04,321,1695711600"; d="scan'208";a="902785434" Received: from allen-box.sh.intel.com (HELO [10.239.159.127]) ([10.239.159.127]) by orsmga004.jf.intel.com with ESMTP; 31 Dec 2023 19:39:47 -0800 Message-ID: <50098edc-2bbb-4c8f-9360-6990f0f5d88a@linux.intel.com> Date: Mon, 1 Jan 2024 11:34: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, "cohuck@redhat.com" , "eric.auger@redhat.com" , "nicolinc@nvidia.com" , "kvm@vger.kernel.org" , "mjrosato@linux.ibm.com" , "chao.p.peng@linux.intel.com" , "yi.y.sun@linux.intel.com" , "peterx@redhat.com" , "jasowang@redhat.com" , "shameerali.kolothum.thodi@huawei.com" , "lulu@redhat.com" , "suravee.suthikulpanit@amd.com" , "iommu@lists.linux.dev" , "linux-kernel@vger.kernel.org" , "linux-kselftest@vger.kernel.org" , "Duan, Zhenzhong" , "joao.m.martins@oracle.com" , "Zeng, Xin" , "Zhao, Yan Y" , "j.granados@samsung.com" Subject: Re: [PATCH v8 07/10] iommu/vt-d: Allow qi_submit_sync() to return the QI faults To: "Tian, Kevin" , "Liu, Yi L" , "joro@8bytes.org" , "alex.williamson@redhat.com" , "jgg@nvidia.com" , "robin.murphy@arm.com" References: <20231227161354.67701-1-yi.l.liu@intel.com> <20231227161354.67701-8-yi.l.liu@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 12/28/23 2:17 PM, Tian, Kevin wrote: >> raw_spin_lock_irqsave(&qi->q_lock, flags); >> /* >> @@ -1430,7 +1439,7 @@ int qi_submit_sync(struct intel_iommu *iommu, >> struct qi_desc *desc, >> * a deadlock where the interrupt context can wait >> indefinitely >> * for free slots in the queue. >> */ >> - rc = qi_check_fault(iommu, index, wait_index); >> + rc = qi_check_fault(iommu, index, wait_index, fault); >> if (rc) >> break; > and as replied in another thread let's change qi_check_fault to return > -ETIMEDOUT to break the restart loop when fault pointer is valid. It's fine to break the retry loop when fault happens and the fault pointer is valid. Please don't forget to add an explanation comment around the code. Something like: /* * The caller is able to handle the fault by itself. The IOMMU driver * should not attempt to retry this request. */ Best regards, baolu