From nobody Wed Dec 17 00:44:28 2025 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (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 70E49803 for ; Sat, 13 Apr 2024 00:25:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712967931; cv=none; b=atebNY4gJKENK2IIvp0r2RcYmONMwcnuvWMv4YVKKRA0k+g12SHP+jqAQmNxFL0p6J55oEAtSmMSddYlAvldsKRksBw2xo2SJ0ACSEqu+CdTP+6urjtu0xsg+emM783E8L4fwnix9RsvX9IhGRQgmvKBBX+OfLrPk6YT8mBdqSU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712967931; c=relaxed/simple; bh=TehD/Ru/HAYMBDFGU99nYa4e2M5BvXq7XtR91Hn0y80=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NuvU2addoe87fPB/gsvqresTfrclRH0CWCo6kKj1bPeivvRx6MAyo7AZypEEujhUzgneqcqc3StZUi5cDQ13dPL8xREgqm5NuQ0mM+xSdg+TK7Udjdfj6evoT6ohQAxVvvhE3mAg6hRrVEFQN85ls79+JWbgNzUa+slh5sN2JRs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=soleen.com; spf=pass smtp.mailfrom=soleen.com; dkim=pass (2048-bit key) header.d=soleen-com.20230601.gappssmtp.com header.i=@soleen-com.20230601.gappssmtp.com header.b=0ZfJwwxN; arc=none smtp.client-ip=209.85.222.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=soleen.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=soleen.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=soleen-com.20230601.gappssmtp.com header.i=@soleen-com.20230601.gappssmtp.com header.b="0ZfJwwxN" Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-78d5b1a34fdso94912285a.2 for ; Fri, 12 Apr 2024 17:25:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen-com.20230601.gappssmtp.com; s=20230601; t=1712967927; x=1713572727; darn=vger.kernel.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=pZlpX3txUE4TJWo1dAHShmrFptGg2d9oY1hNAoNGiuE=; b=0ZfJwwxNFF3LiiKHadJ4plJ5X++virJULuzxb5X7c1idr41oND3tEUt2VCrNYhWYm7 z7jjhz9fiTBIayLbjJwqZZ3Sz/uCxIH7ubsxuZTfLzTVN06KRErEgNEmMBYVBnB11rwg vwMClfNycwPzZ1si/NlGwoKwxNlBW3n5NOumfrcNdqIBuIclkiy02wuqEHEeDN9nYmUz wL3EpS8Fcp49IA+KTkV05zzkNMaf19e6MZg5k8zQH3WV6eUrfQdGgCGFTPhIN2H80W/s I8QbEb2JK+1KJio0zgITQEegOubRGyVDVHMFqlwrbnbWSdniEYOebgx5dDolJuNN8iNZ cnQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712967927; x=1713572727; 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=pZlpX3txUE4TJWo1dAHShmrFptGg2d9oY1hNAoNGiuE=; b=qK9f9MxuHIWfbWUK0FwYcoYxL/0ELTG8IQt1w6763fVjqIL5EJHK1RFU6SsXMQztji pAQU9OHTMRhoMHYYX4Re1DZTFJm4Zo2Ue0EvrQZFnSmqiKgKX/v0LWl1G+Yvg3cOo3CE 7wiuVwqS02W1k/qvuWYhVhvQ9cyR5aiPW/dzNuXDhU5TihL4lu9mc6OfOftFNys1+iV9 Vwn23QkVFVUGPbkKITbgwJPTtHju6DJFcrQCA6I3blgffOZzL6tQRl4O4V10aNPphifW p0KInowAn9PMvjBjXjBkPQCepzkMw2BtFjTfKOnNpfjfpFWoi0tANfsCCKFrL0pCSlKJ ZrsA== X-Forwarded-Encrypted: i=1; AJvYcCVWyy2FsVBfl2YulPPsD7q55SpPaf1gmZGmFtuo+jyR7mPZ8jeYPyvBVe2k+kPozW2Dq+5HDuHgRC2jgVLTYw/NR6JfWqjcaKtciX7b X-Gm-Message-State: AOJu0YxDcUvGzdSzU1/CrD6Uxw2JrZ8V0LXUWHbQcyYYzux2uzSib/eP MlzmDKHK+d91TKEZzEYGuo1PUeBnsFGWiqABUjQ2xcu2tiAgCncPFGeuNqL8C/U= X-Google-Smtp-Source: AGHT+IHnFRJRktafMl8iFWoPD2wZry7L4eUZEKmr/HQPmjiBtsCGzy14Fj8Nir/jZCpUWrNk2ovbMw== X-Received: by 2002:a05:620a:56a:b0:78a:f5b:ed05 with SMTP id p10-20020a05620a056a00b0078a0f5bed05mr3835236qkp.22.1712967927419; Fri, 12 Apr 2024 17:25:27 -0700 (PDT) Received: from soleen.c.googlers.com.com (128.174.85.34.bc.googleusercontent.com. [34.85.174.128]) by smtp.gmail.com with ESMTPSA id wl25-20020a05620a57d900b0078d5fece9a6sm3053490qkn.101.2024.04.12.17.25.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 17:25:26 -0700 (PDT) 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 v6 02/11] iommu/dma: use iommu_put_pages_list() to releae freelist Date: Sat, 13 Apr 2024 00:25:13 +0000 Message-ID: <20240413002522.1101315-3-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.44.0.683.g7961c838ac-goog In-Reply-To: <20240413002522.1101315-1-pasha.tatashin@soleen.com> References: <20240413002522.1101315-1-pasha.tatashin@soleen.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 e4cb26f6a943..16a7c4a4f3db 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -32,6 +32,7 @@ #include =20 #include "dma-iommu.h" +#include "iommu-pages.h" =20 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 >=3D counter) break; =20 - 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; =20 fq_ring_for_each(idx, fq) - put_pages_list(&fq->entries[idx].freelist); + iommu_put_pages_list(&fq->entries[idx].freelist); vfree(fq); } =20 @@ -267,7 +268,7 @@ static void iommu_dma_free_fq_percpu(struct iova_fq __p= ercpu *percpu_fq) struct iova_fq *fq =3D per_cpu_ptr(percpu_fq, cpu); =20 fq_ring_for_each(idx, fq) - put_pages_list(&fq->entries[idx].freelist); + iommu_put_pages_list(&fq->entries[idx].freelist); } =20 free_percpu(percpu_fq); --=20 2.44.0.683.g7961c838ac-goog