Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4147832rdh; Tue, 28 Nov 2023 13:12:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IE36AHJyenUDU7n8tRvgVPlsmnCfsikbM3rvYicbmj5Fv4oc6LyITv+j3doPOldt/y8ywdC X-Received: by 2002:a05:6e02:12e5:b0:35b:4731:15f3 with SMTP id l5-20020a056e0212e500b0035b473115f3mr19758812iln.10.1701205962713; Tue, 28 Nov 2023 13:12:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701205962; cv=none; d=google.com; s=arc-20160816; b=XZE9vNp85k/g+BMaYYVVzVsdbrRK/diiCjJyVOE4imP3SgTt83kIn94awsKdH3x40R 6O6lhYyy68KfTspzwo2bOYg+mMSYAmfzvyIPhGQJIU6W9Y7IdN2HmlGEuL6cv4m39hWc lOkZwPViBJiDvnvmT73F4SgMyI7wfYVAYpYkx7+nIWgf+5cF+gEWqQ8jkzOUnDOJMxNR wxhy14NKWcFrudMBkxQDZ9OwxhfRqypxivXgflmnqz08py+FuGKezN7FIQcsC5tUvvIm oOs85kgBr8S5NM3LBb1PLFHtFwC4MPO3AVh/f0VoAdH/+b/TYB90/uhZiGIcNf+r1nkS bcEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=iygGvNb1KE298FiVkmeH8gdBVxeTTuJw4eGKIF/nIuM=; fh=z7CihAYYs+frw4g3uL4utEDJXxOOJDcFFsLsywo+fzs=; b=lAJlzNZ0zEDz+bP7mIHLvXvWKdlsj8NSvwzjZTq3LsMzLWti+7AP3zhrqywVQGDWwH zI3h453/LhoWqfbT+/qSp2J/p62qQ9wSFZ793aK0cRBj5LXjWN8D5ZnkG03BXob/+O0k jqfoixKxh4/zOrdgeMGiQCWdbmb2SrLcGfLPa2QNt8ndRz61J/vZ4MuXVtIzCTPpHBp7 JUCOYckbVBqEtNGq+iHuga2GvsN1gvDas2C+2Sq+uFcTZ+pRoTX2K0BMnbGMfnPPdqW3 9W0B46/MdkGBVRu8emXm05LJSfDhWUpu3v2e4407GbDL9zqT6hmIpApEgx0mTVSrcXNx 62Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=TWRnXEVX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id b18-20020a056a000cd200b006cc07022e9fsi8201050pfv.57.2023.11.28.13.12.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 13:12:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=TWRnXEVX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 7AC4380ABDF1; Tue, 28 Nov 2023 12:50:50 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346611AbjK1Uu2 (ORCPT + 99 others); Tue, 28 Nov 2023 15:50:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346271AbjK1Uty (ORCPT ); Tue, 28 Nov 2023 15:49:54 -0500 Received: from mail-qv1-xf2d.google.com (mail-qv1-xf2d.google.com [IPv6:2607:f8b0:4864:20::f2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E4A52102 for ; Tue, 28 Nov 2023 12:49:56 -0800 (PST) Received: by mail-qv1-xf2d.google.com with SMTP id 6a1803df08f44-67a338dfca7so21119846d6.2 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=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=iygGvNb1KE298FiVkmeH8gdBVxeTTuJw4eGKIF/nIuM=; b=TWRnXEVXJruv36LJOKHOhLjpODPbkfmbkFVGiyOwKEshA3y7p2vwRpd/5C7W+qNM23 D6nv4XMHyxnItPBrp6yg8UyDYHblV+lzf/h7za7iL8ugRhzV9JfxwzHqKyxe7Xk8Uh/q PfP1iVJT2M4KQ7WfHjfApsQ4nZZ5x/pPJmPNH0lUx2TYkwjM3yON0sY4b8BF3B3MuZSB Qt9E/+FEDDPITVyILclLHYXmH6fhFO7Gd2aA+9IIMCVoLtHGobMgBqUWIWUXm9UbZ2uR 3PNpdpfkE6bslU98p/cRIQNaPtkG0vRMRtFyvh7U6nqZ2q0hT6WszqpUe9YACfO1iDi/ Dbqg== 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=ExkWjVhgMW3WysRcKlFNLyJ8y93iVW0rjQ0hqW6tMN04fD2+OM7EndlSdO6YvE5PiF 9f1PHyJdJme2fWg40xBVC29onnKdJw2zdM/EYsxdrBNuSTArdUnJbx+equUEBcf6xEPS 5tEFA6lbtdHsM8+ao8CsAn5l1rRB9rlI1Yze75znuoJCmdH//mjE/Hibc+CkAy7JP9y1 z1AR++Xpns1Yb78PJMvQp07JJcDlyIChbnPkuWMPJpDCoQOUb6+oao4XEI0wQefoh4dZ E1IBV+710+EzATFgYAhSrQQpFyCm474Z8JUe7VDQH7QcyKEe0kzkFea6UtE52rny9Z1q edZw== X-Gm-Message-State: AOJu0YwUv3Z7qwUeEJQtKRKDWEryN/TmUDha6cBl3os8Z+nY4G0CvtiA t9Vn4GbT9oIpmgbcXQnzw/2ydg== 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 28 Nov 2023 12:50:50 -0800 (PST) iommu allocations should be accounted in order to allow admins to monitor and limit the amount of iommu memory. Signed-off-by: Pasha Tatashin --- 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); -- 2.43.0.rc2.451.g8631bc7472-goog