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 DB188C369A7 for ; Tue, 8 Apr 2025 18:51:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 62D93280001; Tue, 8 Apr 2025 14:51:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5DD2B6B00CD; Tue, 8 Apr 2025 14:51:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4A5EE280001; Tue, 8 Apr 2025 14:51:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 2A8306B00CC for ; Tue, 8 Apr 2025 14:51:17 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E1ACEBB323 for ; Tue, 8 Apr 2025 18:51:17 +0000 (UTC) X-FDA: 83311769394.01.282FF54 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf12.hostedemail.com (Postfix) with ESMTP id EE9DD4000C for ; Tue, 8 Apr 2025 18:51:15 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=VFqLiaqT; spf=none (imf12.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1744138276; 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:dkim-signature; bh=dGXZXPhKoociiuci5ixZu5eBgeCDmzv+oG1pcsW8GV4=; b=swq6Vr74yYhW+J7Sd5+myaAiw06+xWfk8f1a4TiEOK+Ot2nbwkcCijPujPNJ8NYvT5JcSY TuGbXgvj0+5/KaL9UVZx3bg+dNMekziIQ7mIEnvnJKEccO1cJvk2rzPYwikHvMqTpcstYF zf5zMlplZzoYmaPQT03nJwdbKtFlrNE= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=VFqLiaqT; spf=none (imf12.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1744138276; a=rsa-sha256; cv=none; b=AmjxZVBsniEZp9yoxwa7xukteZT+XMXnboJtAZPXwCw4HUf7WQh2N5Kp0+1b+CxiwynupH x8OcZPGYO/+rZY3U0Mv0g6yhyuBSclzbfogOxvEMYfRfkUrguj48wzBilD8iFap65CANxP maLgJkLwAZ428Jn5u5uatsqkqR1UCYo= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=dGXZXPhKoociiuci5ixZu5eBgeCDmzv+oG1pcsW8GV4=; b=VFqLiaqTw8f6tco2SORsdJWtgu A5OH0bv6WxDDDP3nV1dDvIhWpx9JgDZGSCPJ5DOp2s5MjxFSDkdKlWcdSxg8tKcnnfXLewT4tgnF7 vQTgFjBX0pb14srq9b5LjU58Bg8j1wjeSn8yQVmYllw8BjlCD3WxwLFtilsRhY2H6J9Bl6EY92Lbt U+B9S1JAE5I/7x/VR6SqkEbpveJ7T8zLVdQVapIVfSf0nmDs498RgINuPSAw+c53BapppK8eJJVbY SlUe9Y1Dgke/Ij8VjTeZqXLSYgy4GK2nipp8qUiC1QqJ/VgNm8qyJPvb3+3xWNXFfgCt0XXU5CE6y Ubsgg21Q==; Received: from willy by casper.infradead.org with local (Exim 4.98.1 #2 (Red Hat Linux)) id 1u2E2J-00000000LgK-45gI; Tue, 08 Apr 2025 18:51:04 +0000 Date: Tue, 8 Apr 2025 19:51:03 +0100 From: Matthew Wilcox To: "Darrick J. Wong" Cc: Luis Chamberlain , David Bueso , Jan Kara , Kefeng Wang , Tso Ted , Ritesh Harjani , Johannes Weiner , Oliver Sang , David Hildenbrand , Alistair Popple , linux-mm@kvack.org, Christian Brauner , Hannes Reinecke , oe-lkp@lists.linux.dev, lkp@intel.com, John Garry , linux-block@vger.kernel.org, ltp@lists.linux.it, Pankaj Raghav , Daniel Gomez , Dave Chinner , gost.dev@samsung.com, linux-fsdevel Subject: Re: [linux-next:master] [block/bdev] 3c20917120: BUG:sleeping_function_called_from_invalid_context_at_mm/util.c Message-ID: References: <20250331074541.gK4N_A2Q@linutronix.de> <20250408164307.GK6266@frogsfrogsfrogs> <20250408174855.GI6307@frogsfrogsfrogs> <20250408180240.GM6266@frogsfrogsfrogs> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20250408180240.GM6266@frogsfrogsfrogs> X-Rspamd-Queue-Id: EE9DD4000C X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: tpyfwmr3gmiuiaqph63yjrz4p54so3xq X-HE-Tag: 1744138275-938222 X-HE-Meta: U2FsdGVkX19yn7x1TFq5oMctytYLCk6R05iBwBkJ3le37gm+5OLQIUwfuICt6WrnU3c5C6m0+6H3ds+K364/O+bkWTovGsdHFMRYRZD5DPLbP8+xpFxWgx2g5P8ZH3H8btaZaidujHz/EQwky42F9AgBsKDIcvm3xjuzk4URjtn9bbLiQ5x1eJBcXDPF6r6otbg9/xSCiCmc3p+DatKk5M9yTInxcrnlqfaOpb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7fMVb4YV+kkqt8nHFWiVZoO766d5UfdgsWVxtwe2UyIMfW+1Y3D/OnPuH45k4uRwSmgmPj+iQ7ySCyFqrVbH4= 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 Tue, Apr 08, 2025 at 11:02:40AM -0700, Darrick J. Wong wrote: > On Tue, Apr 08, 2025 at 06:51:14PM +0100, Matthew Wilcox wrote: > > On Tue, Apr 08, 2025 at 10:48:55AM -0700, Darrick J. Wong wrote: > > > On Tue, Apr 08, 2025 at 10:24:40AM -0700, Luis Chamberlain wrote: > > > > On Tue, Apr 8, 2025 at 10:06 AM Luis Chamberlain wrote: > > > > > Fun > > > > > puzzle for the community is figuring out *why* oh why did a large folio > > > > > end up being used on buffer-heads for your use case *without* an LBS > > > > > device (logical block size) being present, as I assume you didn't have > > > > > one, ie say a nvme or virtio block device with logical block size > > > > > > PAGE_SIZE. The area in question would trigger on folio migration *only* > > > > > if you are migrating large buffer-head folios. We only create those > > > > > > > > To be clear, large folios for buffer-heads. > > > > > if > > > > > you have an LBS device and are leveraging the block device cache or a > > > > > filesystem with buffer-heads with LBS (they don't exist yet other than > > > > > the block device cache). > > > > > > My guess is that udev or something tries to read the disk label in > > > response to some uevent (mkfs, mount, unmount, etc), which creates a > > > large folio because min_order > 0, and attaches a buffer head. There's > > > a separate crash report that I'll cc you on. > > > > But you said: > > > > > the machine is arm64 with 64k basepages and 4k fsblock size: > > > > so that shouldn't be using large folios because you should have set the > > order to 0. Right? Or did you mis-speak and use a 4K PAGE_SIZE kernel > > with a 64k fsblocksize? > > This particular kernel warning is arm64 with 64k base pages and a 4k > fsblock size, and my suspicion is that udev/libblkid are creating the > buffer heads or something weird like that. > > On x64 with 4k base pages, xfs/032 creates a filesystem with 64k sector > size and there's an actual kernel crash resulting from a udev worker: > https://lore.kernel.org/linux-fsdevel/20250408175125.GL6266@frogsfrogsfrogs/T/#u > > So I didn't misspeak, I just have two problems. I actually have four > problems, but the others are loop device behavior changes. Right, but this warning only triggers for large folios. So somehow we've got a multi-page folio in the bdev's page cache. Ah. I see. block/bdev.c: mapping_set_folio_min_order(BD_INODE(bdev)->i_mapping, so we're telling the bdev that it can go up to MAX_PAGECACHE_ORDER. And then we call readahead, which will happily put order-2 folios in the pagecache because of my bug that we've never bothered fixing. We should probably fix that now, but as a temporary measure if you'd like to put: mapping_set_folio_order_range(BD_INODE(bdev)->i_mapping, min, min) instead of the mapping_set_folio_min_order(), that would make the bug no longer appear for you.