Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2550553lqt; Mon, 22 Apr 2024 14:12:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWznCJ1TDTz86HEDRUAPSAZpb88+UAf438QSwPuy8aUUQxavMIPjvadOSC14JbWrAMEjrMtPUvtnEwHQ8KsYAdyBRIN9IyNaSOFmYGHWg== X-Google-Smtp-Source: AGHT+IFLtkOy2loMWSJcY2FtamS7QwoIbrPLteIoKzkELhOa4pvgFlIhuxMUNY2VQ2ETK84dkuCZ X-Received: by 2002:a05:6a20:9682:b0:1a7:802d:f67c with SMTP id hp2-20020a056a20968200b001a7802df67cmr12403068pzc.53.1713820346972; Mon, 22 Apr 2024 14:12:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713820346; cv=pass; d=google.com; s=arc-20160816; b=YtnyrBzvES/TDYaZZMMEvhCpTQUlKBV9+GV43TYmRGV2jLeKiFwS3Dhq+MwsOzRyDe cKrWDbByBx79GFI0WDZgKs0LmzBDaf0ciltYYs0eLaImzW/AbTMZR1pIzQNYGP3QyCLi eV6dAwQV/oteSApnyKn7Yug3o0TXMIOTM7GVlLCCyZYdgOo81RXRJdAlqy2QCOJQoiAl Eil5wdTOwLhVvcwnW7FBhTFwUH0iDAiq3/yWziHfZYUv5RKz1QPW5yR0kT5wMdDxRwM9 iFsQlQOC7+nynnI4jujbR9OIyrNQvraANN6fHrdoaIPxHBTWb2rc48CC3yIUDpH8envc 5tsg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:feedback-id :dkim-signature:dkim-signature; bh=zynBXuiznSHueeqTUMZQW6b1yBwXJrIR8wvuZJWgyZw=; fh=WA+9K5/W24nyLJ+ikwFtOsPjStJ6IsNGmDzd8nH5ls8=; b=Qw118ybal+szb96amnrGwLTw653hpM9EDKGiS2p2lNLEja9vABYG4/pY8AQ5s6AFFN Q8FbYGl+fxJblg+BTDHm0NQUWlKMfKz2Vy4Q778OHIsn3zOHN+2eXmvGkBT+AAAeS81j NPUhlVWvAutSaFQQzP541ZKwUbz5u94siZemcGw/2wNvhYMCjMi+++gkzdrTYeu2SGoa TjQPgFX2q2+fwlWp5Fv7TxDE7Gxd1Iev5udsHbCTTGua5p3hAgZklV2rnopp7Xku3n5i F5ViqbTTQVj4qtUtMfNgD64QM6a6JPW0Bji53IAfqdb8AsrU6uNfljWvdgNYEADyBNmo nhoQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fastmail.fm header.s=fm3 header.b="ovU/hRCR"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=CSmuglbr; arc=pass (i=1 spf=pass spfdomain=fastmail.fm dkim=pass dkdomain=fastmail.fm dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=fastmail.fm); spf=pass (google.com: domain of linux-kernel+bounces-154031-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154031-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fastmail.fm Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id ld14-20020a056a004f8e00b006ecf1c1746bsi8715698pfb.56.2024.04.22.14.12.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 14:12:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-154031-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@fastmail.fm header.s=fm3 header.b="ovU/hRCR"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=CSmuglbr; arc=pass (i=1 spf=pass spfdomain=fastmail.fm dkim=pass dkdomain=fastmail.fm dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=fastmail.fm); spf=pass (google.com: domain of linux-kernel+bounces-154031-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154031-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fastmail.fm Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 6A518B21C41 for ; Mon, 22 Apr 2024 21:11:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 022561CAB7; Mon, 22 Apr 2024 21:11:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fastmail.fm header.i=@fastmail.fm header.b="ovU/hRCR"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="CSmuglbr" Received: from wfout1-smtp.messagingengine.com (wfout1-smtp.messagingengine.com [64.147.123.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 13D421C286; Mon, 22 Apr 2024 21:11:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.144 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713820286; cv=none; b=Pf9RRZfb2x8AwmC70+z/JUI+Dld65QaYg3EF7BUtKxbwYP0woQEwhwMomiCOVTKvL/uCDif4lZNDsBdgVZ5a27afDcsPAXTQXI074FzXMGu6U4I0E1M+njl+WQi1YY3P5XH1jL3dzaPXVZDueGTQuay4oHFUW5cRAVwQhzj7ero= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713820286; c=relaxed/simple; bh=JremFJQlcOycUj3IWF8+0zR7mZGxiktyLy+sOHQkuRI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=QKawCTFu3wq1wSeCeqEadX7RVdOCC1ozb0/QiOIFZZXUmTqIhyHogjtLfUEQjNTSFl1qNx/vyiNVVbT273mN66/TZcW4tejX2FjwX6pgl1fPtiKwykq+PkJdYYO5G5e+A+BN3PAHPfW6K0WVBtmeQl5PndjtK/KbPzKKJ4qBC9A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=fastmail.fm; spf=pass smtp.mailfrom=fastmail.fm; dkim=pass (2048-bit key) header.d=fastmail.fm header.i=@fastmail.fm header.b=ovU/hRCR; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=CSmuglbr; arc=none smtp.client-ip=64.147.123.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=fastmail.fm Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fastmail.fm Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfout.west.internal (Postfix) with ESMTP id 83D371C0013A; Mon, 22 Apr 2024 17:11:23 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 22 Apr 2024 17:11:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1713820283; x=1713906683; bh=zynBXuiznSHueeqTUMZQW6b1yBwXJrIR8wvuZJWgyZw=; b= ovU/hRCRt6s3phg2P+miYakfvB98/CrKECAybIJZ+kVhxN/L6CkGX0kypfRue0gf 8nEy3VQdGoYZGylYcjMSzGCPwTByIayGsk3tHAucPgcrgbQIrdoErOBJ26nsW/+h 11+onvSh8cIhaz7Rp7VUKM8oVl7Xd1GJDbbey9BpnaHnG8p2Fw2u/eK9HbwFrjzh vroEfSIqGZ7Gq5UBDurRogQITbAnSiQO6oR26BQs3MiVJfExJTdevMBSjVl0SBfx 3q/OQDdx/uqIULxZBogHmFe+Yw9x31hhPULfk4RuoqaOORMQ0fg0R7dMGS6xdRLp PuFMOlVx4QG2tNFSLW9IWg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1713820283; x= 1713906683; bh=zynBXuiznSHueeqTUMZQW6b1yBwXJrIR8wvuZJWgyZw=; b=C Smuglbr/MqGuFnxmxOIvyMD4c7ZiCmP99cjG/V39e2b2j5y34AoNnqxz/6T1oj4m aH68Od4rauo0U+T14nRULmNbSPD9Chk0uc8KZ5FKcoPavR8Lufxtf1mSGTXROWQb HSMiHxjziHmu/xE7I2ukiMov1dGbZbdfywVtdoapePacS3V04LQG/qdOY7YFqkLs nUTgY5OcvrhgnNQhQ4fpvGWvAF70KahCCLx2u3i8vO5X+FPENw0+mhUU3NcoYImN 0OtAqW3PE0i89yPG6kYNAekHz6pWqgR3llNXCzvpjiH/y1o9YaoQy+b2fuii4fYm l04d+HobPxCGVBBiQFXdw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudekledgudehlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddvjeenucfhrhhomhepuegv rhhnugcuufgthhhusggvrhhtuceosggvrhhnugdrshgthhhusggvrhhtsehfrghsthhmrg hilhdrfhhmqeenucggtffrrghtthgvrhhnpeevhffgvdeltddugfdtgfegleefvdehfeei veejieefveeiteeggffggfeulefgjeenucevlhhushhtvghrufhiiigvpedtnecurfgrrh grmhepmhgrihhlfhhrohhmpegsvghrnhgurdhstghhuhgsvghrthesfhgrshhtmhgrihhl rdhfmh X-ME-Proxy: Feedback-ID: id8a24192:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 22 Apr 2024 17:11:20 -0400 (EDT) Message-ID: Date: Mon, 22 Apr 2024 23:11:18 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 0/6] virtiofs: fix the warning for ITER_KVEC dio To: "Michael S. Tsirkin" , Hou Tao Cc: linux-fsdevel@vger.kernel.org, Miklos Szeredi , Vivek Goyal , Stefan Hajnoczi , Matthew Wilcox , Benjamin Coddington , linux-kernel@vger.kernel.org, virtualization@lists.linux.dev, houtao1@huawei.com References: <20240228144126.2864064-1-houtao@huaweicloud.com> <20240408034514-mutt-send-email-mst@kernel.org> <413bd868-a16b-f024-0098-3c70f7808d3c@huaweicloud.com> <20240422160615-mutt-send-email-mst@kernel.org> From: Bernd Schubert Content-Language: en-US, de-DE, fr In-Reply-To: <20240422160615-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 4/22/24 22:06, Michael S. Tsirkin wrote: > On Tue, Apr 09, 2024 at 09:48:08AM +0800, Hou Tao wrote: >> Hi, >> >> On 4/8/2024 3:45 PM, Michael S. Tsirkin wrote: >>> On Wed, Feb 28, 2024 at 10:41:20PM +0800, Hou Tao wrote: >>>> From: Hou Tao >>>> >>>> Hi, >>>> >>>> The patch set aims to fix the warning related to an abnormal size >>>> parameter of kmalloc() in virtiofs. The warning occurred when attempting >>>> to insert a 10MB sized kernel module kept in a virtiofs with cache >>>> disabled. As analyzed in patch #1, the root cause is that the length of >>>> the read buffer is no limited, and the read buffer is passed directly to >>>> virtiofs through out_args[0].value. Therefore patch #1 limits the >>>> length of the read buffer passed to virtiofs by using max_pages. However >>>> it is not enough, because now the maximal value of max_pages is 256. >>>> Consequently, when reading a 10MB-sized kernel module, the length of the >>>> bounce buffer in virtiofs will be 40 + (256 * 4096), and kmalloc will >>>> try to allocate 2MB from memory subsystem. The request for 2MB of >>>> physically contiguous memory significantly stress the memory subsystem >>>> and may fail indefinitely on hosts with fragmented memory. To address >>>> this, patch #2~#5 use scattered pages in a bio_vec to replace the >>>> kmalloc-allocated bounce buffer when the length of the bounce buffer for >>>> KVEC_ITER dio is larger than PAGE_SIZE. The final issue with the >>>> allocation of the bounce buffer and sg array in virtiofs is that >>>> GFP_ATOMIC is used even when the allocation occurs in a kworker context. >>>> Therefore the last patch uses GFP_NOFS for the allocation of both sg >>>> array and bounce buffer when initiated by the kworker. For more details, >>>> please check the individual patches. >>>> >>>> As usual, comments are always welcome. >>>> >>>> Change Log: >>> Bernd should I just merge the patchset as is? >>> It seems to fix a real problem and no one has the >>> time to work on a better fix .... WDYT? >> >> Sorry for the long delay. I am just start to prepare for v3. In v3, I >> plan to avoid the unnecessary memory copy between fuse args and bio_vec. >> Will post it before next week. > > Didn't happen before this week apparently. Hi Michael, sorry for my later reply, I had been totally busy for the last weeks as well. Also I can't decide to merge it - I'm not the official fuse maintainer... From my point of view, patch 1 is just missing to set the actual limit and then would be clear and easy back-portable bug fix. Not promised, I will try it out if I find a bit time tomorrow. Bernd