From patchwork Tue Nov 28 20:49:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 13471797 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 C0D08C4167B for ; Tue, 28 Nov 2023 20:50:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 969F56B0364; Tue, 28 Nov 2023 15:49:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 91B986B0366; Tue, 28 Nov 2023 15:49:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CF6E6B0367; Tue, 28 Nov 2023 15:49:58 -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 55F066B0364 for ; Tue, 28 Nov 2023 15:49:58 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1F615A0158 for ; Tue, 28 Nov 2023 20:49:58 +0000 (UTC) X-FDA: 81508554876.13.A5A6680 Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) by imf27.hostedemail.com (Postfix) with ESMTP id 4E34040021 for ; Tue, 28 Nov 2023 20:49:56 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b=l7XNEMto; dmarc=none; spf=pass (imf27.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.54 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701204596; 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=iygGvNb1KE298FiVkmeH8gdBVxeTTuJw4eGKIF/nIuM=; b=8NGnj9gmHCTNsLeFByBjfUubz9XzEsu1ZB4gKDZmh92Ua3/b4gU9FNeoBbnM3fVyEBoEGB ZTnCKPOT2DSyKch/zk8bwv3AgCmQoaO5tofk/3Qx67W7GwEJyi5F1KG4NG2dNltkFttX4w 2EVQJJbwSdtS5GrTjsdHn06EVX5r0Lw= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b=l7XNEMto; dmarc=none; spf=pass (imf27.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.54 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701204596; a=rsa-sha256; cv=none; b=1ZAv780IoerXZrD32DtQQce//4oE/zypMufIuYVleDw7nC3sxSC7XcIUWAiUb2DxIDamIJ x8GHh8UD4B4eHi4NcJi7bnp+gGe9zb2lTqyouIbCemWG8++23jVuMGt40fdDNrgpOUNb3V r0E51n3d7Ep020tWfRwb1iumMNvjlZc= Received: by mail-qv1-f54.google.com with SMTP id 6a1803df08f44-67a18556e4aso29143836d6.1 for ; Tue, 28 Nov 2023 12:49:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1701204595; x=1701809395; 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=iygGvNb1KE298FiVkmeH8gdBVxeTTuJw4eGKIF/nIuM=; b=l7XNEMtoQPDm9pD/nJGKCQypzcRR1fMzikPb5hcjxbnImVtZenioknAkrGiQcepHH1 kTRjxZ4tD0tXa+vXxTKC79erLwIWJ6d94PysGeuE9Gx0Xiqjjw69Q3RzIa9RwNp2/uS7 sKadvTDRtUYIzmojFCsGJ8Qhi9DLmbCyeizVMHmwy6XmiMssYQLH3dsyxHBnxGXoWxtK QrHZjVr141xYnX2AaPvxaa5z7a2S+84c5JWdF8ulRm/uLBUuwVCvjT8yExjuIYUcuiiX bF7UKgzuIUSWGrFTcaoEI1iLKEFaehSJNHRKPhhDKU5j/y76OLk4V/LCivovEKZjtq1V 1AFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701204595; x=1701809395; 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=iygGvNb1KE298FiVkmeH8gdBVxeTTuJw4eGKIF/nIuM=; b=WOMgqq2uFhgL6QuXeGCroL+SvZ8dveGATu2ZdsPar9e1oTBnJ//w9/svZUkzgNXRtB V0V6fk2q5w1DVdpALyL38MiuQmPaGCIGmxkSvWSu1T6dd6qsOyi/KvSyrcAfgUZKMa5m Lln0Dsk7YkfmdleUDTFU2v/HpgdbncvIkoJ9lwGMvKvD6C561UqSedu8wfoF1+mCtAgQ ghkEFtgWVBoyB09LPADN+x2Ri9Al0b8IrLZc/R1a2+haOgnQ22THWlc1WyGNWcTLtrCi CcwyQqMqwXSHR3o/pF1T31mKV1EDyT8S35I3Iu19YW2/quSgpUGi/Fsfxf/Bv/TKVpj7 MvGg== X-Gm-Message-State: AOJu0Yx3pjMsJ3t9UZ1qW+842DF0R97/7YhdtBTI6mGoRPkORmOLDhvR z4y3Y9hAAh2HgiXa25eqT2ViHw== X-Google-Smtp-Source: AGHT+IE0Jl3QLEggdMt0xv2T8AyvhzkahJgD3VRGmfbhI7sqHJ8Aa/AdHKiYq6E8wbv77IBFZbLYmg== X-Received: by 2002:ad4:5dc6:0:b0:67a:21aa:6513 with SMTP id m6-20020ad45dc6000000b0067a21aa6513mr18119809qvh.17.1701204595440; Tue, 28 Nov 2023 12:49:55 -0800 (PST) Received: from soleen.c.googlers.com.com (55.87.194.35.bc.googleusercontent.com. [35.194.87.55]) by smtp.gmail.com with ESMTPSA id d11-20020a0cfe8b000000b0067a56b6adfesm1056863qvs.71.2023.11.28.12.49.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 12:49:54 -0800 (PST) From: Pasha Tatashin To: akpm@linux-foundation.org, alex.williamson@redhat.com, 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, jasowang@redhat.com, jernej.skrabec@gmail.com, jgg@ziepe.ca, jonathanh@nvidia.com, joro@8bytes.org, kevin.tian@intel.com, krzysztof.kozlowski@linaro.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.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, mst@redhat.com, m.szyprowski@samsung.com, netdev@vger.kernel.org, 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, virtualization@lists.linux.dev, wens@csie.org, will@kernel.org, yu-cheng.yu@intel.com Subject: [PATCH 15/16] vhost-vdpa: account iommu allocations Date: Tue, 28 Nov 2023 20:49:37 +0000 Message-ID: <20231128204938.1453583-16-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.43.0.rc2.451.g8631bc7472-goog In-Reply-To: <20231128204938.1453583-1-pasha.tatashin@soleen.com> References: <20231128204938.1453583-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 59hoso95bk6rbbb5o43smmh3tpwymx7q X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 4E34040021 X-HE-Tag: 1701204596-66054 X-HE-Meta: U2FsdGVkX186Bh8Oaxp01ssa3gq6jBP/wv1vyJP1NP2w05lt8gITGKLk5zY8YQCy5aTFRhA6+7tfj52OppHiwuQ1epU6RSO+SwrWOlU49w+UP6clpQaUuvY+Oel1pNW5c0qDqjqYINdl41EuUv0uwZ3+WJMRcVSqio+nGDfcH71a9Vq50O/0gzWNH9idl6RIb3HYAxgrJFcapxzf8QUDabBm7hp0GgLpS8N1A+5A7EQHl5GC8TC/djMwk/Y7lGogRw+Brv3uJ6dU4KqYv5ixrj1WXGE0uyBMkks8Rh5BuwOd1Tpil/WAQ2QxaExWeiIZ8xmO6kjr8lskhoSUFPimX1rC3Z/byNhEKzHH+0yoULPfnAs4k6BSKUo8428dKcBDF7BfOmillM75+99ciEN7khb91HcmtiFxH60bBJC1nPPIktRuTmUR5xZUqlVbmC6ygJJ1tLjkykEzv+P8kiFwzGqwHib+XOqp9497C2pwPojroUU29bOYI94Mnwe9py+nH7Xl+TJPEOARhVEmQwBL22g+Eux6DTnigJBuaBzyDNCPLSoi79zPENOKQnx5znd7x8XFu82nCIJZfQcm0PVj26udG5J6IHhpNHdw1g52cvLX4IAJJAOLeBdKmqW2baA4c4dOFIeBE3muiQplxEWVx+Kzddj34OgGMYYCyc+FT37nSSu5BJF5kHh1nK60Uc7Mehjk5WE7J1roFLqiuHQ5H3FpY6AldJiEMadkrdcaR/CZIG16u4uFx9Q0nf+KLqvElo1Qx20kxqvSxat6iVYacbXnH85Jt3G9chBEAnUQYaC4ANOWR7lQy3w9aeU7GQaU3CCoHD+8uACRVOI8zaP9E9VqNx2h4rH2zhW1jVZ3sUc3d7UkQ3TOff8hgl/LhS4cVTPxFtWrVgEuC8gfDmVaLrYXosSHe2RpA3gcumc8Q66wcx7oGlK9zolvWX1dKlPKbyzKR1ZV8JkP9GeS2sw auPtT6UP V2QSsz+SdrNYNQwFUsoMwB2bz325OWhV2QSBC8uXLA8NomXSYcifCp50OUinYi1pVgTUIHBjEiRwsA4i9rs2Rf7awUoyIYn1LPI/YGlPcZSpWswYWMdxK7vBVIovIVWWVYq9YMWhDGVFcW9wGOr4e1kt9BASTfjE1NEcqjqpbMSia9d/muG8iAxUnoLAL3ExbJkjPOVlRND3OniOB2rgT+J9r3o31GlXT3tjXz1CCsVW57raCLwkPvvxCODmXbdDk7CX0uSotWyeqVGcHvm4KlDceUYL66FN0YYQbH/a22QXhlIH+pKzqbc+83V+33MDlSF/thyApLnX2GTqyFOjKNMZhOqNVGNz/4mmdWEtmlBJp1FFP0BZLrZg6BeKT2+GDG0Mg9/CmwSMB+Hs7X+/j2FFLuC61v1qIL1w2MJLGIq44B4riX6JOZOk+jbTtpJ9b47aAfo+mdZbyBYBWEKmr+CCyQw== 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: iommu allocations should be accounted in order to allow admins to monitor and limit the amount of iommu memory. Signed-off-by: Pasha Tatashin Acked-by: Michael S. Tsirkin --- drivers/vhost/vdpa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index da7ec77cdaff..a51c69c078d9 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -968,7 +968,8 @@ static int vhost_vdpa_map(struct vhost_vdpa *v, struct vhost_iotlb *iotlb, r = ops->set_map(vdpa, asid, iotlb); } else { r = iommu_map(v->domain, iova, pa, size, - perm_to_iommu_flags(perm), GFP_KERNEL); + perm_to_iommu_flags(perm), + GFP_KERNEL_ACCOUNT); } if (r) { vhost_iotlb_del_range(iotlb, iova, iova + size - 1);