Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp2920384rdb; Tue, 26 Dec 2023 09:15:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IGoMN2bx5YlLJENyQocmBm1Aave4Dzmvgz04HfcFS0trvJvj5FchUAfmxL7fNDAlWsmGbMV X-Received: by 2002:a17:906:1609:b0:a26:8ab0:43b3 with SMTP id m9-20020a170906160900b00a268ab043b3mr3500311ejd.74.1703610928721; Tue, 26 Dec 2023 09:15:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703610928; cv=none; d=google.com; s=arc-20160816; b=esOD8tgtjkVKj/if5y6dAFCmYsBwFhpzbHLP+I3CNv3cSQbcNUlgJKSir8bOWBQJE9 98K8a2r+OQISoua4t49Ho242jrg/hGfi6MSQiSuyjMvPDcfhqFigzpZ1o6329mNl3VRx V4t5SXPX0yby/n/BB3QkdIeSBQSZjG/nuN0ONmJ6vgWKjlBB8X/6OaYckbiLPbh67N1Y BnZjTvpe+sdhwqVqpiolWi877Y6EbHf5E2oe39rigwJRVxgeOMd7h/wHTm94Mw+eldQd mACqwuWcfjtpMq4XruzqIT8rYRiks4Nq7TPVxsvpx+nbpZWqnBWJ5rMSMP0OZae+6hat kGLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=znBescOeGDyEd/eBwZlWM7zCSH3WtYT9hTuxQY/0ciQ=; fh=rNTbm2cQOQBGo3svG8uieTAaTS6b8xA1ZVl+mbPQBA8=; b=yTEjnIhzEBwWZPsxrBNFzCBLGk7gJ24qoX/+5qRXnXcNiTMuH3KSM/bXN3CHZgfd3o 6+dy6u6/D9LnhrZb4zagD4BXKMWFcuzw0m4EuQ74irOFeGkjIBKfheLSKrToLpu02V+9 zXs8IY0Dhb7KkKcl8VBFGnRSSUXRsPJnALZFX39gDWeytUcj4cWVgokx6CdJs38Flgws 9hw7NAGarz+YIRfi99xRytSDB9JsGAQlJhvQvkSpbLzkh+JaefTH/whpPqNZo09OcsQn gm9LMq7iBTMMNPw2sWvr6Nbm9/P6RQ1i+p5C8zJl9GCV6imxtDA/9l2ogOxbB1TljW0O hOUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=XG8NXn4F; spf=pass (google.com: domain of linux-kernel+bounces-11592-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11592-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id c18-20020a17090654d200b00a23359048casi5283414ejp.759.2023.12.26.09.15.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Dec 2023 09:15:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-11592-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=XG8NXn4F; spf=pass (google.com: domain of linux-kernel+bounces-11592-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11592-linux.lists.archive=gmail.com@vger.kernel.org" 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 799CC1F21C47 for ; Tue, 26 Dec 2023 17:15:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D25594FF81; Tue, 26 Dec 2023 17:15:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b="XG8NXn4F" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (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 A813A4F896 for ; Tue, 26 Dec 2023 17:15:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=soleen.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=soleen.com Received: by mail-qt1-f181.google.com with SMTP id d75a77b69052e-427a2fd7b87so32004511cf.0 for ; Tue, 26 Dec 2023 09:15:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1703610912; x=1704215712; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=znBescOeGDyEd/eBwZlWM7zCSH3WtYT9hTuxQY/0ciQ=; b=XG8NXn4Fr+o6AFgkb7X5OPcfBqq+fpn7iaghciF2mBPh/76Z2Gl1GjtDqFoZCjWXCq 25dZxF+i90zFauBaUQNVn/qUPfAvXqJCdbrGfCheQf51Je/x8+jLj6NnWT8TPEV3dVSZ u5LjEdKRw1h9nyn8cTp+m6kJOPOpbX3qqRN4NMpixyXeXeHoOfa/SrvpalKAo97CSmqt H9HhBbupSM09x9RC8oDJEl0tkapBhgK4he/2p4f67NS3gUCmLiLqKkIlMDdtydWoaPAy Qj6N0Mfr5QSSwMaMkZ9oUzjT6UXbGvupaByjQMg5+QHcGFUUXGRHUXX1MnPXAX/J3elA fADw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703610912; x=1704215712; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=znBescOeGDyEd/eBwZlWM7zCSH3WtYT9hTuxQY/0ciQ=; b=wUKU7eVMC0FKeZWUI5BSTa1d2v0NvmS0IF4d0Up+ca0TRncq1Lpz/3/m2QotDRW1wH 1DgynBF0F391ALhEvr2WPYYGzHxQrZAxgwnWHL5+zFdK1nNAs6rSVmF+MfS/LASsAhfm h0mIZXMWdxaYANRLM4+QDY+0OFeRMKxxVCx05GFXVCoU8B2psMicLapjrzGPZR9tS8V2 UctjclYVO3dRqn1OIHquc3HFVvdHbHBW71Qq5olcgxsAG1BwxuLosByi6PgLKDSXI6en djoYvyuc6hmFerMXJXyVG2Cndloo6SbsvIj4SyiTJdUiQduDus1r7P7pzuUgsMk6LioD fFwg== X-Gm-Message-State: AOJu0YwZl83NvPl1RDu40BmwokWHwsNxLw3qjYOtSBazYU/shi7bgP2P VMRklrt0UZU3MovOh10vp6Bm4Co3I4ybjJvJOOUMOruRKcWEvQ== X-Received: by 2002:ac8:5bc2:0:b0:425:a28f:ddd8 with SMTP id b2-20020ac85bc2000000b00425a28fddd8mr8563250qtb.137.1703610912560; Tue, 26 Dec 2023 09:15:12 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231130201504.2322355-1-pasha.tatashin@soleen.com> <20231130201504.2322355-2-pasha.tatashin@soleen.com> <776e17af-ae25-16a0-f443-66f3972b00c0@google.com> <0ba8e579-2b6f-4e9f-a38c-097694f14d3c@intel.com> In-Reply-To: <0ba8e579-2b6f-4e9f-a38c-097694f14d3c@intel.com> From: Pasha Tatashin Date: Tue, 26 Dec 2023 12:14:35 -0500 Message-ID: Subject: Re: [PATCH v2 01/10] iommu/vt-d: add wrapper functions for page allocations To: "Liu, Jingqi" Cc: David Rientjes , Andrew Morton , 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, 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 Content-Type: text/plain; charset="UTF-8" > >> Document the locking requirements for this? > > > > Thank you for the review. I will add info about locking requirements, > > in fact they are very relaxed. > > > > These pages are added to the list by unmaps or remaps operation in > > Intel IOMMU implementation. These calls assume that whoever is doing > > those operations has exclusive access to the VA range in the page > > table of that operation. The pages in this freelist only belong to the > > former page-tables from the IOVA range for those operations. > > These pages maybe be accessed concurrently by thread contexts other than > the IOMMU driver (such as debugfs). Good point regarding debugfs. While, it does not change any locking assumptions, for this series. It might change some design decisions that we need to make when freeing pages on unmaps (a separate RFC series that I sent). I will have to study how debugfs affect refcnt and mapcount, and whether we could use per-page page table locking if needed. Thanks, Pasha