From mboxrd@z Thu Jan 1 00:00:00 1970 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 39908D10BE8 for ; Sat, 26 Oct 2024 07:33:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C5F986B0089; Sat, 26 Oct 2024 03:33:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C0F8A6B008A; Sat, 26 Oct 2024 03:33:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AD7156B008C; Sat, 26 Oct 2024 03:33:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 913426B0089 for ; Sat, 26 Oct 2024 03:33:35 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 7FD97C0DF7 for ; Sat, 26 Oct 2024 07:33:13 +0000 (UTC) X-FDA: 82714937718.21.2705491 Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by imf08.hostedemail.com (Postfix) with ESMTP id F2BEF160005 for ; Sat, 26 Oct 2024 07:33:18 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.32 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729927859; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Mz2PcLUlSIFdYw91KuSmilAUaG4yzI4uKlzjrQoH6PY=; b=s77aaaH/NpdzAzZZb98fOIWV0xfx7yYutYS1h4BiekP1Cf0duPTPdJHEChltAQLobophsA iA+BJfEGIPRJUo/wWu/i2RgV71my41muEmiZAoIfDXQu1UTH2sYfHm/KW/k0ZjVYxZ7a0u E3Lct4+I+2GCDNKtNhbbZkTYk5Cxa/U= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729927859; a=rsa-sha256; cv=none; b=i1ucZXmvyFzOGCTkWVxA9h7VuJ7soziSw9ZxeHBTW2hyUMxkytZUsiDodZ9J92Pfb/K4dh 4ZiFc2LNcS2SDBWkrC26NebJ0L59MT7HqnMf5nyHybiWv70AnYaMFjKo2kpDF13JE9/O7c Mfo5NUdvle7cTCPeunS7zw+S7N1usao= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.32 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4XbBGT00Zsz1ynN1; Sat, 26 Oct 2024 15:33:36 +0800 (CST) Received: from dggpemf200006.china.huawei.com (unknown [7.185.36.61]) by mail.maildlp.com (Postfix) with ESMTPS id 286BE1A016C; Sat, 26 Oct 2024 15:33:29 +0800 (CST) Received: from [10.67.120.129] (10.67.120.129) by dggpemf200006.china.huawei.com (7.185.36.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Sat, 26 Oct 2024 15:33:28 +0800 Message-ID: <204272e7-82c3-4437-bb0d-2c3237275d1f@huawei.com> Date: Sat, 26 Oct 2024 15:33:28 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v3 3/3] page_pool: fix IOMMU crash when driver has already unbound To: Jesper Dangaard Brouer , =?UTF-8?Q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , , , CC: , , , Robin Murphy , Alexander Duyck , IOMMU , Andrew Morton , Eric Dumazet , Ilias Apalodimas , , , , kernel-team References: <20241022032214.3915232-1-linyunsheng@huawei.com> <20241022032214.3915232-4-linyunsheng@huawei.com> <113c9835-f170-46cf-92ba-df4ca5dfab3d@huawei.com> <878qudftsn.fsf@toke.dk> <87r084e8lc.fsf@toke.dk> <0c146fb8-4c95-4832-941f-dfc3a465cf91@kernel.org> Content-Language: en-US From: Yunsheng Lin In-Reply-To: <0c146fb8-4c95-4832-941f-dfc3a465cf91@kernel.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.120.129] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemf200006.china.huawei.com (7.185.36.61) X-Rspamd-Queue-Id: F2BEF160005 X-Stat-Signature: cagns67qgf3fome9t8fsoekudq1prp4z X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1729927998-847033 X-HE-Meta: U2FsdGVkX180HnM0T26AP7wiFuJvifW+L1wAT8T2eShTNtImVuhCfE9XyEBbG0lwbaDTUjH9LUUJpoZYrzDF1SfBk/G0mdIAyTUidf6KV/pQE9kB8C3lRqtfei9ZQTg4XFCJtwmdXmY1noMPNatS5o+EPHcklVYhdv2wo1WEBF28TDrEFFzGBAwAbi40DJxww7eyHsr9gMK53KKCHMwttY36mYeAdv2volXejDjkXsaYobTWZzvuFZ1RAKHuBgIuJ/g7qlGNnb9LI3Rbf1BV5O4rH80NSQOXo3H/eoeXsksvOG9001teeM0askaYXTXLsbzx0SivVzzumZeMHdgEqMn9hwXxCGs/IUcOaFyMkVDWVDkunv0Txxx9d+Qf3uBC7ucU3wpZ9rN0XDA8PgnDaELz9zUnXYUk0tOh+LpXR6S0/Ti3BMcqx9TfhiGKeFMQ5jSZunt81IaUgiFpPPHsrVjFWhR7ry7Vp2aeJJQVKEwhbjwdYhy49/CmNyXAaJbg1N1/9ypQcJNOqpnfa2nm/Gc/mj+5g8UqCNCdfnQepuR72iZi+rduUHzJWv/xDmR1uQvFb+K2qe2XgHw40dAc4gIqw+/XGMonvjlGIyQz4IpHKdQb4pJBEdMkJpSI1vFRBEYi23tO0EwnnUTlpXMhWLXD6WU/EMbM5O0zO1jbF3zSn46sF88ml7D+yy0L4F4WATOeHFuysP/D/0VA92r1pPqUGPRWcAPv+ZaIPPLvBOoozqgcZ5kjoUYAnF4TLzsVHB+prA334rSr3qG197tqoTlhwrZxApB4PP/vijAx1UadecDX66Jn9jHwJNM/ARdsdGjDuQFEzaVWrCxu+MXHS4Vr7zz4/y4bpTIunZeE5AhHABIz25tKEXCW00YvSCs3t0bQIxsMa1ElS7yfsw2XNfh50seOCNK08BEOSFrV8Xqp3HQ0shD+qzv2n4ecHdF8M+3kLpSuPsb1Lmm8Sl/ x1lnIM+a ShLvkTsQUcmKYreyveHggt/3iUavJ4fty8yU59qeINJoRiyjxb8CNOjFIhVrRsIBCov7XdDR2+JNO3w7MFCWsuMgV6FOm16euGiaQAusYqGI+LjwB+RHeiqfqaWVomMAsT5q5YHsjMHsJY6GSDZwj8N30/bsjmDvhYXX1mFctmeow7WRUffub2HjjEf/3itmYQAbzDL2+UIcZ1ERMCKRa4x2QHmBVLopt9h5JVOft4iFBBq1vJXGqP8VOJixAw90HsHUVXMm2oEmokGcENq2sihlHxxJZ9toBJKpR+RhhYWHJ2TYDcdC8FqxDDmVDXLwj6h7w7a8E0b/okPI= 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: On 2024/10/25 22:07, Jesper Dangaard Brouer wrote: ... > >>> You and Jesper seems to be mentioning a possible fact that there might >>> be 'hundreds of gigs of memory' needed for inflight pages, it would be nice >>> to provide more info or reasoning above why 'hundreds of gigs of memory' is >>> needed here so that we don't do a over-designed thing to support recording >>> unlimited in-flight pages if the driver unbound stalling turns out impossible >>> and the inflight pages do need to be recorded. >> >> I don't have a concrete example of a use that will blow the limit you >> are setting (but maybe Jesper does), I am simply objecting to the >> arbitrary imposing of any limit at all. It smells a lot of "640k ought >> to be enough for anyone". >> > > As I wrote before. In *production* I'm seeing TCP memory reach 24 GiB > (on machines with 384GiB memory). I have attached a grafana screenshot > to prove what I'm saying. > > As my co-worker Mike Freemon, have explain to me (and more details in > blogposts[1]). It is no coincident that graph have a strange "sealing" > close to 24 GiB (on machines with 384GiB total memory).  This is because > TCP network stack goes into a memory "under pressure" state when 6.25% > of total memory is used by TCP-stack. (Detail: The system will stay in > that mode until allocated TCP memory falls below 4.68% of total memory). > >  [1] https://blog.cloudflare.com/unbounded-memory-usage-by-tcp-for-receive-buffers-and-how-we-fixed-it/ Thanks for the info. > > >>> I guess it is common sense to start with easy one until someone complains >>> with some testcase and detailed reasoning if we need to go the hard way as >>> you and Jesper are also prefering waiting over having to record the inflight >>> pages. >> >> AFAIU Jakub's comment on his RFC patch for waiting, he was suggesting >> exactly this: Add the wait, and see if the cases where it can stall turn >> out to be problems in practice. > > +1 > > I like Jakub's approach. As mentioned in Toke's comment, I am still not convinced that there is some easy way of waiting here, doing the kick in the kernel space is hard enough, I am not even sure if kick need to be done or how it can be done in the user space if some page_pool owned page is held from user space for the cases of zero rx copy, io_uring and devmem tcp? killing the userspace app? If you and Toke still think the waiting is the way out for the problem here, maybe we should wait for jakub's opinion and let him decide if he want to proceed with his waiting patch. > > --Jesper