Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp848794rdb; Fri, 23 Feb 2024 01:43:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXR7rtqqH8TYfUgToIElAEWA1wjwe1E58qzKBMhgIb8ODNw9GFSwg42Bb9m8xRyzkCnvmsipVaptuFOZiSxkGnyCFJxPC/i1Dr8UgOo1w== X-Google-Smtp-Source: AGHT+IG7cbni/utHjzbYiC/tG7rsNJkZric11qgD/TCbTiyr+6wZqnvvK5I2kaLdfCZaTrJtMSAY X-Received: by 2002:a05:6358:d044:b0:17b:85ff:8fe6 with SMTP id jb4-20020a056358d04400b0017b85ff8fe6mr1052896rwb.25.1708681387401; Fri, 23 Feb 2024 01:43:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708681387; cv=pass; d=google.com; s=arc-20160816; b=LUkI3xaDBUYurvHV+ksWv6gFjs3nOJyvZrX/+6c+xRY2At+8dV7fsSPTKmM42pRD5C SJm+vspRSU4F+1NI5BRSZdsDh7fA237I6FNRstt60A9eTIio8cPvron/SXE7YDMui9ws nvYNjc352CL899+MbWXSh46h6ljYsWWAuFZkUPFpB8NFtRA3BcEXweVFC20AfF1u0zS4 TEinUjaICHADG8MkLeSR1zpaEfG4T8kSU+/mQY2yrEZTRHYXMseylO+VpfRBpx8G6Uz/ elYKZfxsbJBhcZqZJhNyJVQjg5+V4SVmkMfeMbNqXfdnWJnRYO2K1QCbrtNKHeyz9CoW y7JQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=JeGMCdaCDD7BHdfywFTOPLnwnnbru3LEGQbmIcb6KjM=; fh=Ps0Cof9PguBEmx44Stkor1FC0yK1HegTkh7cJZIT5rk=; b=rNfJfjfsrO016VznpAXItJp42XqZPAqEDKt0rcdCdlLX0pK6swiufBbI59BSRjjyMC Jj2ghY3qNO3utm2URukEOAV0VLkUMJvt+LA4L3sUmmkX39SEwzB84xpBem3/miCnNJxg hVbB/DBSkkh6K628VdbbgMpbR7MrQaKkaJb5FtVAMjujQS5RTjH8plV+oeFJ8/TVycut uodBo+ivOIUsJ/s3UtT4k4PoMj2WK4HkNyeoQvxF3MGZg/J5v6IOVQZMdeWhFmaFTOSB hGMWIUsy7xHr/4NPFGdojUv2d8wWw4H/7xs02XJBX6hxwMNvimlok+Gqd/yV7Nad5plL B0xg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@szeredi.hu header.s=google header.b=H1KgZBBc; arc=pass (i=1 spf=pass spfdomain=szeredi.hu dkim=pass dkdomain=szeredi.hu dmarc=pass fromdomain=szeredi.hu); spf=pass (google.com: domain of linux-kernel+bounces-78047-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78047-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=szeredi.hu Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q22-20020a656a96000000b005dc7fe155aesi11455042pgu.443.2024.02.23.01.43.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 01:43:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78047-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@szeredi.hu header.s=google header.b=H1KgZBBc; arc=pass (i=1 spf=pass spfdomain=szeredi.hu dkim=pass dkdomain=szeredi.hu dmarc=pass fromdomain=szeredi.hu); spf=pass (google.com: domain of linux-kernel+bounces-78047-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78047-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=szeredi.hu 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 19A7B286EE1 for ; Fri, 23 Feb 2024 09:43:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0DF085C91F; Fri, 23 Feb 2024 09:42:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=szeredi.hu header.i=@szeredi.hu header.b="H1KgZBBc" Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69FE422EF5 for ; Fri, 23 Feb 2024 09:42:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708681374; cv=none; b=IvYczLuHRM+VTFAEzhU2Qzhe31CppyboIV0/YKWD7new7imhf7X1ZxH9VftcEXsEFDxQfBngw0W01u8NyuDLzhLom9hH+t+GWZjWNqM1w1/lahvTa8EXzrvobDL4Uh77DEe/kc+vd5V3Qh7THca5lJdZypRZJlkF+G4Hq8++oYI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708681374; c=relaxed/simple; bh=LfBvV5ftt5p5wwwqFBLDPSUdEXzAXS6aKdqDAKHrVSs=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=uEfz8jBACRwbirDTH8BpLSrEwgNFcbng/eVvOJoFtH7+bHczBGIbmvPd3XxR/kcB0K1P2ESMRn6xghvWO8icfWclhLeo3xHf0OigN2IA+QRLVTSQXRSTfvfsn/u0+rlfN0oneC65RL3czft+ehRxaXal653ot9Vn+fhO9KcCl8g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=szeredi.hu; spf=pass smtp.mailfrom=szeredi.hu; dkim=pass (1024-bit key) header.d=szeredi.hu header.i=@szeredi.hu header.b=H1KgZBBc; arc=none smtp.client-ip=209.85.218.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=szeredi.hu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=szeredi.hu Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a3e4765c86eso26111466b.0 for ; Fri, 23 Feb 2024 01:42:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; t=1708681370; x=1709286170; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=JeGMCdaCDD7BHdfywFTOPLnwnnbru3LEGQbmIcb6KjM=; b=H1KgZBBc00OGeN9yXQ4/8mZ9jDPny/9wT7OZnL1jZcBdhoD6DkuTSy6OBLxn48HYCU 2XpuJyOTb2An1ISi6Si2EUnW4D+j7m28Pp0cF0ftXDCXoAiwDgmJ+dG+sTgEa9v4lMIC hxRB0mWU6lsDk0WupJr08y6JJUcnYwDtLY+es= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708681370; x=1709286170; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JeGMCdaCDD7BHdfywFTOPLnwnnbru3LEGQbmIcb6KjM=; b=nIHG0AXBkf8WH6AqC1fukb3oSwI/darhtSczOsPEj/Ygj0zqDKxa/de9WHe0D7G6mJ 9ipOmLGI0YvDdYnQkx6dzd7y/nnHpDKEhtzvpFz7RNYiyhdgEVFc8yBQmOrn3O0wMxDW SlEdaSSiPKgMuM3jHnYO/Nd5AzYJmoT+ByRN/BKzNqDdinhq4tlnSl09B+ksUMw/L9Ql 7MjJn0VRtrLQ7C3V1xopT4l18Sev/vUz/opcanNCKOoCKosLX5uSQrX0O8lGOYWjdHO6 2oCQVfgI+ghnNkUcuImoAC3UsiQRmX74Qu8o7W8xn7CjJSv58fFDf09guXKHIZaK9Ubd wbyw== X-Forwarded-Encrypted: i=1; AJvYcCUytVk4t+y/3XPfTxZcR+dMaU3hPwYIs7ZCw1E4R73VcEj1z8OVrD2s2K8TI9LeSjjaY+wkU7vx3WoYotSYwT12MZgIkVFMY0ZftO0i X-Gm-Message-State: AOJu0Yx3yR1ZGXhv2a1QTGRbQ+FqH23bC6RvraFNZMV60yAlG5D0Un3M BimMsbG6mhXK+w7Qv8x8r6tDk35YbwGKAKgV135cUFi4PXkzr1wxJHgvjKCOHDHgJ4qPip7U8Zl /ANS4jpHsGZq9NJInfOTLrrjWu37BC+evG8II9g== X-Received: by 2002:a17:906:cb94:b0:a3e:c818:b7f with SMTP id mf20-20020a170906cb9400b00a3ec8180b7fmr815276ejb.29.1708681369617; Fri, 23 Feb 2024 01:42:49 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240103105929.1902658-1-houtao@huaweicloud.com> In-Reply-To: <20240103105929.1902658-1-houtao@huaweicloud.com> From: Miklos Szeredi Date: Fri, 23 Feb 2024 10:42:37 +0100 Message-ID: Subject: Re: [PATCH] virtiofs: limit the length of ITER_KVEC dio by max_nopage_rw To: Hou Tao Cc: linux-fsdevel@vger.kernel.org, Vivek Goyal , Stefan Hajnoczi , "Michael S . Tsirkin" , linux-kernel@vger.kernel.org, virtualization@lists.linux.dev, houtao1@huawei.com Content-Type: text/plain; charset="UTF-8" On Wed, 3 Jan 2024 at 11:58, Hou Tao wrote: > > From: Hou Tao > > When trying to insert a 10MB kernel module kept in a virtiofs with cache > disabled, the following warning was reported: > > ------------[ cut here ]------------ > WARNING: CPU: 2 PID: 439 at mm/page_alloc.c:4544 ...... > Modules linked in: > CPU: 2 PID: 439 Comm: insmod Not tainted 6.7.0-rc7+ #33 > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), ...... > RIP: 0010:__alloc_pages+0x2c4/0x360 > ...... > Call Trace: > > ? __warn+0x8f/0x150 > ? __alloc_pages+0x2c4/0x360 > __kmalloc_large_node+0x86/0x160 > __kmalloc+0xcd/0x140 > virtio_fs_enqueue_req+0x240/0x6d0 > virtio_fs_wake_pending_and_unlock+0x7f/0x190 > queue_request_and_unlock+0x58/0x70 > fuse_simple_request+0x18b/0x2e0 > fuse_direct_io+0x58a/0x850 > fuse_file_read_iter+0xdb/0x130 > __kernel_read+0xf3/0x260 > kernel_read+0x45/0x60 > kernel_read_file+0x1ad/0x2b0 > init_module_from_file+0x6a/0xe0 > idempotent_init_module+0x179/0x230 > __x64_sys_finit_module+0x5d/0xb0 > do_syscall_64+0x36/0xb0 > entry_SYSCALL_64_after_hwframe+0x6e/0x76 > ...... > > ---[ end trace 0000000000000000 ]--- > > The warning happened as follow. In copy_args_to_argbuf(), virtiofs uses > kmalloc-ed memory as bound buffer for fuse args, but So this seems to be the special case in fuse_get_user_pages() when the read/write requests get a piece of kernel memory. I don't really understand the comment in virtio_fs_enqueue_req(): /* Use a bounce buffer since stack args cannot be mapped */ Stefan, can you explain? What's special about the arg being on the stack? What if the arg is not on the stack (as is probably the case for big args like this)? Do we need the bounce buffer in that case? Thanks, Miklos