From patchwork Thu Feb 22 17:39:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 13567699 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 515E2C48BF8 for ; Thu, 22 Feb 2024 17:39:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CEF746B007E; Thu, 22 Feb 2024 12:39:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C507E6B0080; Thu, 22 Feb 2024 12:39:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A554C6B0087; Thu, 22 Feb 2024 12:39:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 960566B007E for ; Thu, 22 Feb 2024 12:39:50 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 4E3C880EFA for ; Thu, 22 Feb 2024 17:39:50 +0000 (UTC) X-FDA: 81820152540.22.21A9A3D Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) by imf01.hostedemail.com (Postfix) with ESMTP id B2C044001F for ; Thu, 22 Feb 2024 17:39:48 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=ICnWzgeh; spf=pass (imf01.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.160.180 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=pass (policy=none) header.from=soleen.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708623588; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=WCq+3vWtONMZUCcchixRvndD69tz6ABYgm5wv9T97ic=; b=yi7CRzP/19XRj25JTMJ6rAa0w6jMFrrtoWPvDKFjfQlcGHhpfiGAUciAdliBpgZ4XmGciP qI832ZkL9n6ExtESirHCq+hwWZ0H5vG3aEtPdP1w7xzYln0u59almiHrbsKVFVUmzLAHzs KC5kL/4c20kL8MQznRWJbF5n6T75jk8= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=ICnWzgeh; spf=pass (imf01.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.160.180 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=pass (policy=none) header.from=soleen.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708623588; a=rsa-sha256; cv=none; b=4xb2sVj9Z1CdakGBksuk8NAl+14/LN2bkPu/pxU0R/8rHdM6JuumhHCegvzio1uxS91a2v 5c5w4/gc2/8kQ+13iC24R9fqVRGaIBlRXqkH4To+1D+s0tn8ZWF6C2itCylqV0RccDWNk0 JHp15HFO5AMHrS4ckKcZeg0tgt+MQ5A= Received: by mail-qt1-f180.google.com with SMTP id d75a77b69052e-42c7c1cb2e9so47182611cf.3 for ; Thu, 22 Feb 2024 09:39:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen-com.20230601.gappssmtp.com; s=20230601; t=1708623588; x=1709228388; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=WCq+3vWtONMZUCcchixRvndD69tz6ABYgm5wv9T97ic=; b=ICnWzgehp7OCmMu/v99U43yBvelzHdSyFidTkbXsqi5MxuFmrs/nZ3UOZVz+MSDIX/ tYJWUDUUnmTESWTlIYFCV+N4VvL9f3V6UOsVIpcF3jS60uEsJmb3olaLVn26VV/2eJ1d 9XVc8veidNBBxCSVGjYiJVC/13+5DcAG7WhURTk0fUhPV5qRfZY9ZJEAq2w+YrjQoSYt UO7qkK3xCiUywGpPFHyxHkwEOqQRoxjpGd8/FHcv5Fgf1bpNax0LbQgSYFWyRCwXIJJI GRkTzz7G31psW+fD45SsLixNiQx94zmWbE8zelBpbe97nAfuJZyNQNaKgSzuRisSesv3 m37A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708623588; x=1709228388; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WCq+3vWtONMZUCcchixRvndD69tz6ABYgm5wv9T97ic=; b=s4OWu8Tb9cJPkU9h9cJDA+Qo4iU3B9dK4wiTknRup29ry7Po4+Bnk3onsiIHS82tLx IXzj/kJBiL1POUo/ihgqxzlPoDS+9GyYeLebiAbFgSUjCdNf1BXJZHy8bDPKjBZ+0fHX wx0YpsrwWflkvfRDzyn3pOGmkVyMvUo+2V//Pq8LqBQ6InY+/T+rcZDDvwPAEvkB9qLy 476XTO4nvSeh61nrxMBpBZDOUKH06LFmJDeliBtCl6wBG8oEtmAVHfW8KB0s3jlYHOvt E2AkGmnQfFMgaTWfrnWxQ9ho2P386FwRd9mG15sM2NrUme6GN2UeMfz4ZJuSiz8f5Sfq bIEg== X-Forwarded-Encrypted: i=1; AJvYcCXu1uKjZeUeVNu+aSWVS6DszJWKIbTyox+0zSrxUoFJdrVF69nnNY8FHHaK2WozmtYX0X+tNqxV1WXSCFujPZIQY1A= X-Gm-Message-State: AOJu0Yw/y3Zs6c9lVeL2h0qXhBzy5mkhsrHm1WVaNXGTptaOb/Pvfw74 2NBpyD/GRkzA39aSOkV3AmvL3GNMC8ZTVgQXrOiVtjnNNmK26hVSTxCRlHtnv58= X-Google-Smtp-Source: AGHT+IHYsjufxgrQOIaZKGAlBEgAe+E77c4mX2kxpmgTPbMZQuerhv+xRzMr0weawYHNzNvAJaqSlw== X-Received: by 2002:ac8:7e82:0:b0:42e:5791:3531 with SMTP id w2-20020ac87e82000000b0042e57913531mr1519017qtj.22.1708623587773; Thu, 22 Feb 2024 09:39:47 -0800 (PST) Received: from soleen.c.googlers.com.com (249.240.85.34.bc.googleusercontent.com. [34.85.240.249]) by smtp.gmail.com with ESMTPSA id f17-20020ac86ed1000000b0042e5ab6f24fsm259682qtv.7.2024.02.22.09.39.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 09:39:47 -0800 (PST) From: Pasha Tatashin To: akpm@linux-foundation.org, alim.akhtar@samsung.com, alyssa@rosenzweig.io, asahi@lists.linux.dev, baolu.lu@linux.intel.com, bhelgaas@google.com, cgroups@vger.kernel.org, corbet@lwn.net, david@redhat.com, dwmw2@infradead.org, hannes@cmpxchg.org, heiko@sntech.de, iommu@lists.linux.dev, jernej.skrabec@gmail.com, jonathanh@nvidia.com, joro@8bytes.org, krzysztof.kozlowski@linaro.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-rockchip@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, lizefan.x@bytedance.com, marcan@marcan.st, mhiramat@kernel.org, m.szyprowski@samsung.com, pasha.tatashin@soleen.com, paulmck@kernel.org, rdunlap@infradead.org, robin.murphy@arm.com, samuel@sholland.org, suravee.suthikulpanit@amd.com, sven@svenpeter.dev, thierry.reding@gmail.com, tj@kernel.org, tomas.mudrunka@gmail.com, vdumpa@nvidia.com, wens@csie.org, will@kernel.org, yu-cheng.yu@intel.com, rientjes@google.com, bagasdotme@gmail.com, mkoutny@suse.com Subject: [PATCH v5 02/11] iommu/dma: use iommu_put_pages_list() to releae freelist Date: Thu, 22 Feb 2024 17:39:28 +0000 Message-ID: <20240222173942.1481394-3-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog In-Reply-To: <20240222173942.1481394-1-pasha.tatashin@soleen.com> References: <20240222173942.1481394-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: B2C044001F X-Rspam-User: X-Stat-Signature: jcrhwzyin356ek17xbj6ba7yzixiun9c X-Rspamd-Server: rspam01 X-HE-Tag: 1708623588-852463 X-HE-Meta: U2FsdGVkX182KlzcyzJfD87QUSo0ip9Q5S7fZKynNc3ut0/E8dLhM82O9yUbKI2YraAgC9hhOHvhUzsTCOF6vLETSPvTvk6NhtD4YbxB1S1F27QYaOY0BpX0HoLFU57jfh/xeMKyCx8QRMnCLhs92OPxeJeTT0qCqNLXD12B/uPmc0wl0lcNUQMJSXyucHUtugFAhsMunCBO6IhxH1xRkwAybbYMAT/cAZCs5TLy5JY2KyDnWqeThzKRAhENgqRhJerlzhpB1oWCNQ4EN94Z16YuiAQ0pGEg2pW8Qy1qcEzylOYLeNo2tXS7bO60Y6PL+vumZ7bzEyVLAZcMGzxVN/39+Xc6fGgDyRcp4u2EkvmzuIr3haJZ/Er4CLn11z/prnwtTc0qYar/QsMgNKKQDnmHwPlNgFj1e7ihyQquX3pwONtGhlqQHFZJI5T3osHs++ck95jGmi84+NFIZMLQ81dtlKkvlEOZaKLd6KGROUJEpbEvbe+eD9G/nHkZqN6PmIfufA3gsM1sUc71+wzaUi+jNyv7Orwd2DZtGq3SPEjzYw8Z8E3IAvYGw5W0Fw2z4aZ9lHlnf8SkZsNtXjkgfex4hf2+oAYVeguRXFZCOx+ivtNQULylvxU0klJROk8kZAk3Q8I8E7ooNd9P2Duvftf5DVjgFRZ7KXJdvjBzjA2JAVNV9GdU0lfd2kvY2FuNHfVI579f6cU1kkV6MQr9iBa+wRCFnDBioeRHCjfvGu8UVCTrAlcf89+c3dH+c3YD8+LUVrxE6PE3fpzqPncLfhYeufHvXeNOdwwzNfLiS8u3lDu8XrofrvdzW7Rv5rczZ5/t9yTblDHJdVWuMgfCqVgS3586rc9F2DJPGQWVtMrcsQBDrTeIWKalV/uOeZ9GOcxn0IgzbnWgl+grJZaELtwRPP/dz0Te7sn4uFXddkbvRfyiNiZkYNEAMWcECLLXHqQ14pcCOXVi6QaMKc+ OmaF1+37 BsULnu4897Gc/80b1x+mP042BW93cnnLbhQrhpehV7WHVdbz17HK9kQ7Eh+pldmxj33H8FIwYlqWWIZOsGMXWd1CUppbChjjbQzMXUFESWPPEpjkpj3wU/zANVdaET1uwyyznLNwYsQzcOpwOF4BXi+8xn0TIBY/VbFb7hN2LZ8rZVGVIrYot3JfynZn7JhXhlMrHXFtkFNYQBL0vZU38T0hehpamRsJfRSEpufAuT38wdVGwAUHc1PfwfmPMVhr53EgumG5VmB2XlcvBPkPF0CN9r2nDZi5X/MQdzjOqjKMSo1o= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Free the IOMMU page tables via iommu_put_pages_list(). The page tables were allocated via iommu_alloc_* functions in architecture specific places, but are released in dma-iommu if the freelist is gathered during map/unmap operations into iommu_iotlb_gather data structure. Currently, only iommu/intel that does that. Signed-off-by: Pasha Tatashin Acked-by: David Rientjes --- drivers/iommu/dma-iommu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 50ccc4f1ef81..fa0c4be79f9f 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -32,6 +32,7 @@ #include #include "dma-iommu.h" +#include "iommu-pages.h" struct iommu_dma_msi_page { struct list_head list; @@ -156,7 +157,7 @@ static void fq_ring_free_locked(struct iommu_dma_cookie *cookie, struct iova_fq if (fq->entries[idx].counter >= counter) break; - put_pages_list(&fq->entries[idx].freelist); + iommu_put_pages_list(&fq->entries[idx].freelist); free_iova_fast(&cookie->iovad, fq->entries[idx].iova_pfn, fq->entries[idx].pages); @@ -254,7 +255,7 @@ static void iommu_dma_free_fq_single(struct iova_fq *fq) int idx; fq_ring_for_each(idx, fq) - put_pages_list(&fq->entries[idx].freelist); + iommu_put_pages_list(&fq->entries[idx].freelist); vfree(fq); } @@ -267,7 +268,7 @@ static void iommu_dma_free_fq_percpu(struct iova_fq __percpu *percpu_fq) struct iova_fq *fq = per_cpu_ptr(percpu_fq, cpu); fq_ring_for_each(idx, fq) - put_pages_list(&fq->entries[idx].freelist); + iommu_put_pages_list(&fq->entries[idx].freelist); } free_percpu(percpu_fq);