From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com [209.85.167.173]) (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 17AD27C0AE for ; Wed, 24 Jan 2024 16:28:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706113692; cv=none; b=TRAgf3Ks2mswXPDKueQUVi/fopSPZq/xJlWaVXf+K6G2qAgQcHVzgV8lb9CML+DEKOwuTjEA2Vybbn5DDIZTzUuFGdhrQVietm/rECVUv6qbfawH+w9IFKnfAO+rjMM5AILKAhRzJhShigld0qTJkZDm/UQ1Uw/sTBEOf12q6oY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706113692; c=relaxed/simple; bh=gLHkSQWpkbD1hmnLgTICPpcir4dWz8DwxnNhev1K+hc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=l9ozQJYyYi+neaoLbd+9NM8Ez99miL/Yaf20kfv50gOcUlmlRjYe6HG/3lxShjnzAAzTvbInW/CeOeIQ3lXlAcRtGteY6TTtxr81AvDSHa1C/g9h6ngn9wKkLHqg64HXiussgFKCcb7jJ5fjiIE1WmzmnvvCzefihRh/XvEpSx4= 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=jdDmeUka; arc=none smtp.client-ip=209.85.167.173 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="jdDmeUka" Received: by mail-oi1-f173.google.com with SMTP id 5614622812f47-3bdca4f495cso874091b6e.3 for ; Wed, 24 Jan 2024 08:28:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1706113690; x=1706718490; darn=lists.linux.dev; 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=KB2zplKZXZmwEaf35sIS9GHJDUJDfzr6dvv7piAnaEg=; b=jdDmeUka35ichHO+Efma+fN+0vF61GusI49FxZEQWx+WyBX31FE5nR/auosZnfqhUY XkAccbnNqVLtf3dl1i1tWnALP1G7oQDsTcoAlPN+x0rDIYmqIdnofEfHUEu3jGWuV6aY clV9iCeVO93dV49NPKW+5u5sklwlyXf3NiTrQCtRmqwgAR/dNuFQSjIkLAdktFDg4TaE /PZbrSsewFw05Q+75+T/ITffKjETra6nnz6MFAlf59z1zTPWj0RlPnVBxohF0WHh9kja 436MwN0iLizTPU05POaxh7kYPyTGDOC592gFIYusPPqkq/wUWPuXX2HOcSpwizMZ+UsJ kiiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706113690; x=1706718490; 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=KB2zplKZXZmwEaf35sIS9GHJDUJDfzr6dvv7piAnaEg=; b=nYncNq8lvj2+4GCdLxTqlRSScTZh6+yHerVRl6MdW06fa+9MIK58JWWI/FPJOJb7wJ P98cesMk0xcd5lhbXj2tJX88zJlsm3PfIhtwIbsFx/w2KZaYv70eWrR15rCYLpRO7y3n U5emGeiSSoKGQTnEasJQEwethhLkQOHpvpA5KBEGmYtPabwXgXbhrWCCKzxaYrLW8+V4 AS2cJXs3GQlXNtnUKEszTruoqsHsKhsFGu63DpSzyHPyUh86yFdK0WMaTADB0XQreKaS iPVb5KH7Ml0UlEgv2/i3OYX9OGlRKYXi7g/iNAKPXg89Voy9pUYYj+H8wEa24MMlLjEf pzRw== X-Gm-Message-State: AOJu0YzxhTGigNjFQIsNRTJic+EFZ8DPpdIxSSfKKKwZqbaa6rLi2E9L mVpCmHwh9M9AI3ZdxshxB9MRYc6D0Gq5wW5QTBtrkUPOlkk/R2DB5FQSzm82DC8= X-Google-Smtp-Source: AGHT+IEi7HTUXH3vmWl30/1TUyQz5MURf/7khn5w6ICtjrdySxkJ4o7FVdQYk67VDlULKCkNAAcMjg== X-Received: by 2002:a05:6808:3c85:b0:3bd:36fc:1c1e with SMTP id gs5-20020a0568083c8500b003bd36fc1c1emr2302861oib.44.1706113690073; Wed, 24 Jan 2024 08:28:10 -0800 (PST) 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 g50-20020a0568080df200b003bdb4a17d4bsm1614959oic.16.2024.01.24.08.28.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 08:28:09 -0800 (PST) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1rSg6i-008pwi-AR; Wed, 24 Jan 2024 12:28:08 -0400 Date: Wed, 24 Jan 2024 12:28:08 -0400 From: Jason Gunthorpe To: Robin Murphy Cc: "zhangzekun (A)" , will@kernel.org, joro@8bytes.org, nicolinc@nvidia.com, mshavit@google.com, iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] iommu/arm-smmu-v3: Add a threshold to avoid potential soft lockup Message-ID: <20240124162808.GT50608@ziepe.ca> References: <20240115114040.6279-1-zhangzekun11@huawei.com> <20240115153152.GA50608@ziepe.ca> <20240118142243.GI50608@ziepe.ca> <10c1980a-df07-4f69-93e5-c1c50b106a13@arm.com> Precedence: bulk X-Mailing-List: iommu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <10c1980a-df07-4f69-93e5-c1c50b106a13@arm.com> On Wed, Jan 24, 2024 at 12:17:43PM +0000, Robin Murphy wrote: > I don't think the story here has changed from when I first remember this > being discussed probably 7 or 8 years ago - what VFIO has always really > wanted for this situation is to know when it's doing a complete teardown and > just detach and free the domain, then unpin the pages afterwards, without > wasting any time at all on frivolous unmapping. What VFIO/iommufd really wants is a fast way to to read back and unmap the PFNs from the domain. Today it has to call iommu_iova_to_phys() and then unmap which ends up walking the radix many times. Ideally we'd batch read and unmap in a single call with a single radix walk. This is because the domain is used to store the 'struct page *' which is needed to unpin the memory. Combined with the no-attachments optimization I described it could be pretty close to optimal. Jason