From patchwork Thu Nov 30 20:04:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 172091 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp651510vqy; Thu, 30 Nov 2023 12:05:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IGr+iGKbtG/OUsgmojWd2PcqYMDyU39IwPTzZWfTwaBTAFHpScoz0yjMSmUlRsJODhnH6bz X-Received: by 2002:a05:6a20:8f10:b0:18c:285f:c07c with SMTP id b16-20020a056a208f1000b0018c285fc07cmr21471470pzk.12.1701374703031; Thu, 30 Nov 2023 12:05:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701374703; cv=none; d=google.com; s=arc-20160816; b=GZzo6/fpFAaTXFXuwNb3db7MXN0eLlQuhZJ8eG4dwpUwV9shlRDOjgubW2g13N8jcn gUvK2fUmIO/wXt3L3vKsvV4Q7ZXBmR5ymil0GEnGTxBmeUASidilC71lxZXx321S5t1z VeOXnKvk3QOZz48YFjFiRDkEEgmbq7DYgs9PAt9xQ4GE5KVRU5BPEe7fH+iDp2mXo64D EdAtz8HD92jonmOEbC4AqyWnMZ85rz6O/iCBt2iWPRBvoOwT+dPy1qXpJM7sMVaeUeN2 FhR0kCqpfjrJwO/QYsb3h4w1j+1hv5yZhSjRdbhN3KNc1vNtIvNaROUhOvi3vTzG3pww ELWw== 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 Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id z14-20020a63e54e000000b005c21d7d1114si1998406pgj.818.2023.11.30.12.05.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 12:05:03 -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 A1A3C8031D4D; Thu, 30 Nov 2023 12:04:55 -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 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:04:55 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784020680447837251 X-GMAIL-MSGID: 1784020680447837251 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);