Message ID | 20231130200900.2320829-1-pasha.tatashin@soleen.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp654068vqy; Thu, 30 Nov 2023 12:09:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IHuyqZfqReJ8YFsdXHT4WMyaFflLgDV6b5A6Xg1IQO4NowXVsGekEY1VUCsn+pY3B/Zbmf+ X-Received: by 2002:a17:90b:2b50:b0:285:9e58:1bac with SMTP id rr16-20020a17090b2b5000b002859e581bacmr22282936pjb.27.1701374954010; Thu, 30 Nov 2023 12:09:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701374953; cv=none; d=google.com; s=arc-20160816; b=bWFrl7Na5Also16PnrUB2Hy29DC5neUpj/csRoxgoldOj5SNsF81k5FbjehO3tMqhu zJapeTXn3c/SOmRqCJIxYrLB2/squuApUcHBrhTn194ayL3aG7zWOU1wFDbHRdyIaH1+ hvIis3Dobci4kJ+lxS63Y16zHCk42JXVySkYl2I6gnwXUbRk/tJOiKRl/d+6KfNhQ2EB vNSI2lLB8Hg/gdYuCYsJWKjXwW9cR+BRFSiRpUzptd2gHGPSE20wWUdHmJohRyeci3lw YB7ZVYSGfU1DN/Q56lJrQ4HaZmG6vojSFBERiKRZtpvU2T7GrVljaBx61A58RSbr1sug 9e8w== 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=Be1KAg53A/Objdu3EOp617iDWrhswh7WogUdBagnrZg=; fh=Pk1gAwJ9gS4bETXEWkUIqWgrXnicpEh0VpKzU+pb8OQ=; b=YehugdOo4vhQtSK5UB0KsrcShDB9vmBOrTEcJBndfgVcbIXDNIrj1X1qWVLK60ZgAi VFn56rHDUhsE/PlkgEsTvnjtETjjwMeWjUSPpP8COd9I0ZkPlGMM1182aqQjKRAegx3n UZ7EfDSfZJn428RnmBjvm58wz5uxRKnlfe61nPNRt4xfXYuZCw+wXCA6PRW5/LmL7yLJ 5etQ6gywcguOiLSIbnOhcWxYzublcKQsGL5AyE5V34i6ESzu9O1KwbTPGIyvbj9RVk7D xhjX3S+4gbbqUSlygyEOYVh6V7vz6i68Y73BejvD7aNwxO0v5yCh3utf4KF5dZ1ytO1g 32lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=b5FIJOpV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id sr7-20020a17090b4e8700b0028023efb800si2122021pjb.18.2023.11.30.12.09.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 12:09:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=b5FIJOpV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 534A8801B89C; Thu, 30 Nov 2023 12:09:07 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376597AbjK3UI7 (ORCPT <rfc822;ruipengqi7@gmail.com> + 99 others); Thu, 30 Nov 2023 15:08:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376564AbjK3UI6 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 30 Nov 2023 15:08:58 -0500 Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 728EB1AD for <linux-kernel@vger.kernel.org>; Thu, 30 Nov 2023 12:09:04 -0800 (PST) Received: by mail-qt1-x82d.google.com with SMTP id d75a77b69052e-41cba6e8e65so7776431cf.2 for <linux-kernel@vger.kernel.org>; Thu, 30 Nov 2023 12:09:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1701374943; x=1701979743; 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=Be1KAg53A/Objdu3EOp617iDWrhswh7WogUdBagnrZg=; b=b5FIJOpVYc3V2YCNIasCpGTREL3vAWocW8+79kcTkTMx0nfDV+HD1T2xJmBet1i9pu rVyOq8XG7n6Y/YO4R9V6zuM9DjmwvNKMyeMoWrsmjDuN3tINbzflZJPjwVf+jr4PbdZa yukFQo/OaZti3gowl5KJ5X3bJHheD0ukYFVwvOlxjgip4PrdFNyJAZajeCT1qRgZHCpo Ria6nd/mH3TdWGxB+WsXFnBUSNOLBMzlkjOF4waX+eeEAC6dcHAA1b9aylAVkWsGekpC 4/LqhrdnoCeNX27w376QS/KneCBtzpm67TgBRyPc1Un7CiwmwzpDC9OHN+EaTjmTqEm7 9mBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701374943; x=1701979743; 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=Be1KAg53A/Objdu3EOp617iDWrhswh7WogUdBagnrZg=; b=knhTxD7uodUcuq18n/25PoI7/KyoZYeYnKBqnmvU5FNA2RHQxAAyebmPjEkTJHv/Dl wdxdNFbg4JedkjQ86b3v3faeTLcv8m27wFsFhOatyq0ylogiODk/xmCMPgjX7vzczkGq EyBW9mqCSIzSOV+FOPmbjj0stXmMnSwx4RSF+G6GUVAmL7tl2VVsuoHYSJ8RzMYCQgQn qRNt33XBKZ1BUaVhSEH80WYT1MMShWbg6MA3MeXjBE/Q+xPWucWNqnS1tajatW1bDOhm ETBu3lT/+BrgmtICn7ALILSz+4e8xD0mZcNCF3Rf9zoNK/TN/jhB7JDxXV0XZgmZmKSs PLFA== X-Gm-Message-State: AOJu0YzU+HxEIx6MZMTE5g8UVHxut+wL4tI2mCrW9Jm7hO2+Qk5tTG7e JOc1/ToQLdfvkwUqqi0ydXYRuBtIhpKYmj+L9MM= X-Received: by 2002:a05:622a:1389:b0:41e:1d15:69a6 with SMTP id o9-20020a05622a138900b0041e1d1569a6mr28803241qtk.31.1701374943507; Thu, 30 Nov 2023 12:09:03 -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 c7-20020ac86e87000000b0041cb8947ed2sm786258qtv.26.2023.11.30.12.09.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 12:09:03 -0800 (PST) From: Pasha Tatashin <pasha.tatashin@soleen.com> To: akpm@linux-foundation.org, linux-mm@kvack.org, pasha.tatashin@soleen.com, alex.williamson@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] vfio: account iommu allocations Date: Thu, 30 Nov 2023 20:09:00 +0000 Message-ID: <20231130200900.2320829-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 groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 30 Nov 2023 12:09:07 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784020944017590960 X-GMAIL-MSGID: 1784020944017590960 |
Series |
vfio: account iommu allocations
|
|
Commit Message
Pasha Tatashin
Nov. 30, 2023, 8:09 p.m. UTC
iommu allocations should be accounted in order to allow admins to
monitor and limit the amount of iommu memory.
Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
---
drivers/vfio/vfio_iommu_type1.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
This patch is spinned of from the series:
https://lore.kernel.org/all/20231128204938.1453583-1-pasha.tatashin@soleen.com
Comments
On Thu, Nov 30, 2023 at 08:09:00PM +0000, Pasha Tatashin wrote: > iommu allocations should be accounted in order to allow admins to > monitor and limit the amount of iommu memory. > > Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com> > --- > drivers/vfio/vfio_iommu_type1.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > This patch is spinned of from the series: > >https://lore.kernel.org/all/20231128204938.1453583-1-pasha.tatashin@soleen.com Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Jason
On Mon, Dec 4, 2023 at 10:46 AM Jason Gunthorpe <jgg@ziepe.ca> wrote: > > On Thu, Nov 30, 2023 at 08:09:00PM +0000, Pasha Tatashin wrote: > > iommu allocations should be accounted in order to allow admins to > > monitor and limit the amount of iommu memory. > > > > Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com> > > --- > > drivers/vfio/vfio_iommu_type1.c | 8 +++++--- > > 1 file changed, 5 insertions(+), 3 deletions(-) > > > > This patch is spinned of from the series: > > > >https://lore.kernel.org/all/20231128204938.1453583-1-pasha.tatashin@soleen.com > > Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Thank you, Pasha > > Jason
On Thu, 30 Nov 2023 20:09:00 +0000 Pasha Tatashin <pasha.tatashin@soleen.com> wrote: > iommu allocations should be accounted in order to allow admins to > monitor and limit the amount of iommu memory. > > Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com> > --- > drivers/vfio/vfio_iommu_type1.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > This patch is spinned of from the series: > https://lore.kernel.org/all/20231128204938.1453583-1-pasha.tatashin@soleen.com > > diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c > index eacd6ec04de5..b2854d7939ce 100644 > --- a/drivers/vfio/vfio_iommu_type1.c > +++ b/drivers/vfio/vfio_iommu_type1.c > @@ -1436,7 +1436,7 @@ static int vfio_iommu_map(struct vfio_iommu *iommu, dma_addr_t iova, > list_for_each_entry(d, &iommu->domain_list, next) { > ret = iommu_map(d->domain, iova, (phys_addr_t)pfn << PAGE_SHIFT, > npage << PAGE_SHIFT, prot | IOMMU_CACHE, > - GFP_KERNEL); > + GFP_KERNEL_ACCOUNT); > if (ret) > goto unwind; > > @@ -1750,7 +1750,8 @@ static int vfio_iommu_replay(struct vfio_iommu *iommu, > } > > ret = iommu_map(domain->domain, iova, phys, size, > - dma->prot | IOMMU_CACHE, GFP_KERNEL); > + dma->prot | IOMMU_CACHE, > + GFP_KERNEL_ACCOUNT); > if (ret) { > if (!dma->iommu_mapped) { > vfio_unpin_pages_remote(dma, iova, > @@ -1845,7 +1846,8 @@ static void vfio_test_domain_fgsp(struct vfio_domain *domain, struct list_head * > continue; > > ret = iommu_map(domain->domain, start, page_to_phys(pages), PAGE_SIZE * 2, > - IOMMU_READ | IOMMU_WRITE | IOMMU_CACHE, GFP_KERNEL); > + IOMMU_READ | IOMMU_WRITE | IOMMU_CACHE, > + GFP_KERNEL_ACCOUNT); > if (!ret) { > size_t unmapped = iommu_unmap(domain->domain, start, PAGE_SIZE); > Applied to vfio next branch for v6.8. Thanks, Alex
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index eacd6ec04de5..b2854d7939ce 100644 --- a/drivers/vfio/vfio_iommu_type1.c +++ b/drivers/vfio/vfio_iommu_type1.c @@ -1436,7 +1436,7 @@ static int vfio_iommu_map(struct vfio_iommu *iommu, dma_addr_t iova, list_for_each_entry(d, &iommu->domain_list, next) { ret = iommu_map(d->domain, iova, (phys_addr_t)pfn << PAGE_SHIFT, npage << PAGE_SHIFT, prot | IOMMU_CACHE, - GFP_KERNEL); + GFP_KERNEL_ACCOUNT); if (ret) goto unwind; @@ -1750,7 +1750,8 @@ static int vfio_iommu_replay(struct vfio_iommu *iommu, } ret = iommu_map(domain->domain, iova, phys, size, - dma->prot | IOMMU_CACHE, GFP_KERNEL); + dma->prot | IOMMU_CACHE, + GFP_KERNEL_ACCOUNT); if (ret) { if (!dma->iommu_mapped) { vfio_unpin_pages_remote(dma, iova, @@ -1845,7 +1846,8 @@ static void vfio_test_domain_fgsp(struct vfio_domain *domain, struct list_head * continue; ret = iommu_map(domain->domain, start, page_to_phys(pages), PAGE_SIZE * 2, - IOMMU_READ | IOMMU_WRITE | IOMMU_CACHE, GFP_KERNEL); + IOMMU_READ | IOMMU_WRITE | IOMMU_CACHE, + GFP_KERNEL_ACCOUNT); if (!ret) { size_t unmapped = iommu_unmap(domain->domain, start, PAGE_SIZE);