Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4686590ybi; Mon, 3 Jun 2019 15:34:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwt1AskhL9QPwAAPBQ8SjK7a/pzQGNM4VqXU9LiUEqQSgo6yvJnqL8IEyTmom866G36YKvX X-Received: by 2002:a63:1d1d:: with SMTP id d29mr32183494pgd.63.1559601243718; Mon, 03 Jun 2019 15:34:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559601243; cv=none; d=google.com; s=arc-20160816; b=FT+ox1qItl6lMIDNsyG+8qnKM/Z0jncrd+izO+WYUSxeB6SACZaZE3cUrDk674KaDB cAY2laBkkQymWdfRUrPusEl1yvbxfUFhTjzurxFPsogZe0fmt430iDy8szzVEhUtL+9V uYGahBsRyOki33ZnTp+UWoLPcOne7CfrsJ6MrBEzPFRoXNsTeyN+AtLJ6PLtdfm6iTyj 7QBtfmm4TJhUmBqfqoCGvamEgxlDdJX9MLwjk1k+mOmiudMNleYovLFpNknLsQk1mJUl inJIgV44B9TJGXmns2bkKQQMHk+W2YVrhGuLejIhlQGi6LwWAYJd0GIAkeREXbaRi+Vb Zfyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=YXf0L6tkroMqVZmEF1nE5/FyCs3HNMTRulnU18NVq9I=; b=yVAhf2a52l7/ZxCxarvVh66j3/cnNTmqWl8d3taI5gc4p8RME0ByQUd7g5h5MA0aKA 9I16fkRsHkWnqOUBNcGx/5wOoVm1qLG2NzlToqnm+OMS2CTOAW7grykf+fjb93CwHz1j xFHD0vrtkiYcSwAXVQvV2xDG6dC4Sp1LgtJR09f1I7A/tJt3LNod62hlb6DuzaW4qD0B 9Bp1+ASctWk9Vf/nViow1SXDpQZ+gaRAD/AJ3ydKgvaQ7GlH6bFol7IdJp3Ijh1ZiThh 8/vo9tG+UmphwaC0KBIIafm/2ZRVsc57Dhp9IDvlMjSFuVPiI00XFhn6BCGz5eipXcBl 5nYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z12si17126747pln.207.2019.06.03.15.33.47; Mon, 03 Jun 2019 15:34:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726762AbfFCWcQ (ORCPT + 99 others); Mon, 3 Jun 2019 18:32:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45486 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726101AbfFCWcQ (ORCPT ); Mon, 3 Jun 2019 18:32:16 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CC2D530C0DED; Mon, 3 Jun 2019 22:32:15 +0000 (UTC) Received: from x1.home (ovpn-116-22.phx2.redhat.com [10.3.116.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id C188E1001DE0; Mon, 3 Jun 2019 22:32:14 +0000 (UTC) Date: Mon, 3 Jun 2019 16:32:14 -0600 From: Alex Williamson To: Eric Auger Cc: eric.auger.pro@gmail.com, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, joro@8bytes.org, jacob.jun.pan@linux.intel.com, yi.l.liu@intel.com, jean-philippe.brucker@arm.com, will.deacon@arm.com, robin.murphy@arm.com, kevin.tian@intel.com, ashok.raj@intel.com, marc.zyngier@arm.com, peter.maydell@linaro.org, vincent.stehle@arm.com Subject: Re: [PATCH v8 05/29] iommu: Add a timeout parameter for PRQ response Message-ID: <20190603163214.483884a7@x1.home> In-Reply-To: <20190526161004.25232-6-eric.auger@redhat.com> References: <20190526161004.25232-1-eric.auger@redhat.com> <20190526161004.25232-6-eric.auger@redhat.com> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Mon, 03 Jun 2019 22:32:16 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 26 May 2019 18:09:40 +0200 Eric Auger wrote: > From: Jacob Pan > > When an IO page request is processed outside IOMMU subsystem, response > can be delayed or lost. Add a tunable setup parameter such that user can > choose the timeout for IOMMU to track pending page requests. > > This timeout mechanism is a basic safety net which can be implemented in > conjunction with credit based or device level page response exception > handling. > > Signed-off-by: Jacob Pan > --- > .../admin-guide/kernel-parameters.txt | 8 +++++ > drivers/iommu/iommu.c | 29 +++++++++++++++++++ > 2 files changed, 37 insertions(+) > > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > index 138f6664b2e2..b43f0893d252 100644 > --- a/Documentation/admin-guide/kernel-parameters.txt > +++ b/Documentation/admin-guide/kernel-parameters.txt > @@ -1813,6 +1813,14 @@ > 1 - Bypass the IOMMU for DMA. > unset - Use value of CONFIG_IOMMU_DEFAULT_PASSTHROUGH. > > + iommu.prq_timeout= > + Timeout in seconds to wait for page response > + of a pending page request. > + Format: > + Default: 10 > + 0 - no timeout tracking > + 1 to 100 - allowed range > + > io7= [HW] IO7 for Marvel based alpha systems > See comment before marvel_specify_io7 in > arch/alpha/kernel/core_marvel.c. > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c > index 13b301cfb10f..64e87d56f471 100644 > --- a/drivers/iommu/iommu.c > +++ b/drivers/iommu/iommu.c > @@ -45,6 +45,19 @@ static unsigned int iommu_def_domain_type = IOMMU_DOMAIN_DMA; > #endif > static bool iommu_dma_strict __read_mostly = true; > > +/* > + * Timeout to wait for page response of a pending page request. This is > + * intended as a basic safty net in case a pending page request is not > + * responded for an exceptionally long time. Device may also implement > + * its own protection mechanism against this exception. > + * Units are in jiffies with a range between 1 - 100 seconds equivalent. > + * Default to 10 seconds. > + * Setting 0 means no timeout tracking. > + */ > +#define IOMMU_PAGE_RESPONSE_MAX_TIMEOUT (HZ * 100) > +#define IOMMU_PAGE_RESPONSE_DEF_TIMEOUT (HZ * 10) > +static unsigned long prq_timeout = IOMMU_PAGE_RESPONSE_DEF_TIMEOUT; > + > struct iommu_group { > struct kobject kobj; > struct kobject *devices_kobj; > @@ -157,6 +170,22 @@ static int __init iommu_dma_setup(char *str) > } > early_param("iommu.strict", iommu_dma_setup); > > +static int __init iommu_set_prq_timeout(char *str) > +{ > + unsigned long timeout; > + > + if (!str) > + return -EINVAL; > + timeout = simple_strtoul(str, NULL, 0); > + timeout = timeout * HZ; > + if (timeout > IOMMU_PAGE_RESPONSE_MAX_TIMEOUT) > + return -EINVAL; > + prq_timeout = timeout; > + > + return 0; > +} > +early_param("iommu.prq_timeout", iommu_set_prq_timeout); > + > static ssize_t iommu_group_attr_show(struct kobject *kobj, > struct attribute *__attr, char *buf) > { It doesn't seem to make much sense to include this patch without also including "iommu: handle page response timeout". Was that one lost? Dropped? Lives elsewhere? Thanks, Alex