Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp570442rdb; Thu, 30 Nov 2023 12:05:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IGlCgbl5S0UPBShkJtR68XZMVOo89HOtkhvYIhvCC0QakbZnhf2yHVONiE4dHOTiwpNx7mQ X-Received: by 2002:a05:6358:7a0:b0:16e:2c64:7bb6 with SMTP id n32-20020a05635807a000b0016e2c647bb6mr19796430rwj.26.1701374709337; Thu, 30 Nov 2023 12:05:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701374709; cv=none; d=google.com; s=arc-20160816; b=q4wxuP6qhY/LGBz+nXWn1EoOJSQhXl9yxgvt46j9uPyxROUtofoP+hVvM4SLMGZehd L6DxkA2EsUktwQoqoaavGru0bZEbUC1XegR06aS58qzqgyekTyCIhWDZXYUXYVnclTy9 J0ME9i7zFpYvIny0/ZuFJcwl5k7KLPx2tfFXreaTAMrjNlq1x3D5AcWV18iKwKDcv/Gy +I0vFCc9m8kZdjTtEPa+MTYak8YZshSMFA/+oyXOzjAcKVAKucFmkFpISZnB7jHipN8o +esn54NYJpQAZHY3FI25cZDL1OXvm/vSDrzkUNa6rviKmX9GtIxIs7DjS80pGmxUtMfp WDSw== 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 :message-id:date:subject:to:from:dkim-signature; bh=fJ0QwjQQA2sBtrYbspl5aVVUOMzblP9BjaUBDTeLH4Y=; fh=5Ug9mwd9+23vdDA8pSlDeRAWEZJsGe5BE7FwDONaDYc=; b=cXMtUKk+eSTzu136Ea6REfMlVrd2fS9W6GzcoM7HpYcquM7GoWOdMj5LnQQNIEvZ+T X8oUNuZFC4/Ue9VgkWZkdGMGY0axMCU60chLAugMN0lXlczElaYPA6ayRbRrUUveFyAa WCsmVdd65h6M/mubeBst/nd1rVqvUVE1vHfqRvDYIYudzzGCLNG+0JsjN8kX4dnI3ITD 9NF3bnXaaa0i3yQMULmBJ0T+2iYuSnQ/uVirTj2ThlocOrFUufyeF7sCMfUmKu30t1Nh a5BFihVOMKrCb487LQUUzf4hs4jEqABQgnZVvUtmLwlSi4qTJzFZjH+BpqHSnd50g/z5 u9NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=JWvcC1pa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id a1-20020a656041000000b005c2791fedb4si2026734pgp.21.2023.11.30.12.05.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 12:05:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=JWvcC1pa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 777168031D4F; Thu, 30 Nov 2023 12:05:05 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376470AbjK3UEr (ORCPT + 99 others); Thu, 30 Nov 2023 15:04:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229623AbjK3UEp (ORCPT ); Thu, 30 Nov 2023 15:04:45 -0500 Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E94A10F9 for ; Thu, 30 Nov 2023 12:04:51 -0800 (PST) Received: by mail-qt1-x836.google.com with SMTP id d75a77b69052e-4239f5c1ec2so7943921cf.0 for ; Thu, 30 Nov 2023 12:04:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1701374690; x=1701979490; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=fJ0QwjQQA2sBtrYbspl5aVVUOMzblP9BjaUBDTeLH4Y=; b=JWvcC1pal6xpzSMiXVKZ3LQWZozJh6A68OUbhMc5HRIydkr2zGclYGsoJMJXTZz/xs wBvXNrKMp+st2rF2sSrc4rm64ugrwZ6ftqedxwvgQcvemmg79FRklmKg33ZLoCybcAah DZSHbV3+bEYb0cFvieT7waWSk8+wi90inMdP+q29IYSfY6KgOjSDqdiENr34B2XtYvtm yB2gTK51h0fqJ8z31ZAhb7BcO3laOA0FGB1xwfLTh2Y2aa3hxOjBdgjdTXVGkqcpu7d0 hDN/QRI+D7KA543aO91anP+nM0HHk5+pcVBuHKEDF0RgAohC9rYWJHld/+m1ZSoHeDiA bWQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701374690; x=1701979490; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fJ0QwjQQA2sBtrYbspl5aVVUOMzblP9BjaUBDTeLH4Y=; b=wQkciDjtulVZ/zYnL7BnIxaCdCR+VKiwfynhDbAaq0CNHlqQPoQi/rXwm044FRnYtC wI8yJO8hkDO6ngd88hmivmD61nk7C8oTJZgAn2c8waiNzakn29kmnr/S/IkkudrZDHDp GwXT2qqI1KYO+MUpfZ+GN96LCmWSRO3zErQ8RPML8oXvN1gmY8D9o7TyVfVKwfPke7Hg iw8xCnEH3TC7isWfx9BDctbFKZSkH3gdzP1eZGYUUpq8pKZgqK7IkX+baphTKeSA5gvz BcxUx01LR+ySLk0quSkDec2xTO5Cc8BkvIbS+xKOKpKf48NWlb57jk6atiIM+rqQqzfJ k6ZA== X-Gm-Message-State: AOJu0Yxd/lYdFTvLDJJkeLUCpACoY3ywlqQ/tUeOW7rHZUJviod+m6SF NcwkFt5+JagJHr+AaMuSSp7ChQ== X-Received: by 2002:ac8:7c46:0:b0:423:8e6a:f7a with SMTP id o6-20020ac87c46000000b004238e6a0f7amr26732427qtv.64.1701374690104; Thu, 30 Nov 2023 12:04:50 -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 f27-20020ac86edb000000b0041ea59e639bsm787447qtv.70.2023.11.30.12.04.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 12:04:49 -0800 (PST) From: Pasha Tatashin To: akpm@linux-foundation.org, linux-mm@kvack.org, pasha.tatashin@soleen.com, mst@redhat.com, jasowang@redhat.com, kvm@vger.kernel.org, virtualization@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] vhost-vdpa: account iommu allocations Date: Thu, 30 Nov 2023 20:04:47 +0000 Message-ID: <20231130200447.2319543-1-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.43.0.rc2.451.g8631bc7472-goog 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 fry.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 (fry.vger.email [0.0.0.0]); Thu, 30 Nov 2023 12:05:05 -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(-) This patch is spinned of from the series: https://lore.kernel.org/all/20231128204938.1453583-1-pasha.tatashin@soleen.com 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