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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5F225D3CCA6 for ; Thu, 15 Jan 2026 02:40:51 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4ds6fn5ZWPz2xqj; Thu, 15 Jan 2026 13:40:49 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip="2600:3c04:e001:324:0:1991:8:25" ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1768444849; cv=none; b=Iu9tYcq/3zQa0/fT3jivYbIBD92z+UdWEviM/E+AaUSJmD98s4idjr2PMvO0+ijMKXdgGY+EBVgp+06XxEWZ2Y42X5+LBErQsD2BrCiSkEnpPNukis4vcdCOug+TYQWLUyBszn+D8R0tMObfreeZlM4ZohYtzABwTm+rykHT1/LHtno/qQ5BQOzA+bZbetgSB8APkUbVIL56K/D+pQgNMflRnviqOb2XfVshDFeeiYvUrnAxsN7XxdDjaVF0o6zPxKfsPeNNQEQjr7qvUSfSRVHpA+I8wtrOQFDluLziBheYHSCC2qpXDE+AMbFkDcecC5wkXc0Ll9GGvew1C8MaxQ== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1768444849; c=relaxed/relaxed; bh=wPg1Rmvkx3e8pTULbrjUB1f5F5lTCXFNy35V+rVVRpY=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=BfT0g0lBNEH2stUmJeYAFdg8+lgNSRh3aGOsEebtwhqPZTtHj1dS4rgTgn47D4xpFwytKXtftvw1QWgt7b94hsAW+OXRrA9GLfy6n2FKXQQ1GZdxTJcZCBDJqs5twV0Da9Vmux3pM8UqId36hRt339MPfrfBpPakfg2+jkgrQ2EdcQqEDoMMMnvVsJjzzDumnUkdIPbXuuW3jT7WygtrrFhFG0aYF4YuPweAHlktk/zzNNGG0zOj0hvDe1doWErPxK4U66aOlPMgvBipZDE9ZJOy1muqNF6pa+T1ixEXUaVRDw5o6BVT8fYy5oYs4JLr3otiM8xOAZAUNg4ER1SOMg== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org; dkim=pass (1024-bit key; unprotected) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=Vfb3gBTf; dkim-atps=neutral; spf=pass (client-ip=2600:3c04:e001:324:0:1991:8:25; helo=tor.source.kernel.org; envelope-from=akpm@linux-foundation.org; receiver=lists.ozlabs.org) smtp.mailfrom=linux-foundation.org Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=Vfb3gBTf; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux-foundation.org (client-ip=2600:3c04:e001:324:0:1991:8:25; helo=tor.source.kernel.org; envelope-from=akpm@linux-foundation.org; receiver=lists.ozlabs.org) X-Greylist: delayed 17537 seconds by postgrey-1.37 at boromir; Thu, 15 Jan 2026 13:40:48 AEDT Received: from tor.source.kernel.org (tor.source.kernel.org [IPv6:2600:3c04:e001:324:0:1991:8:25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4ds6fm10NSz2xHW for ; Thu, 15 Jan 2026 13:40:47 +1100 (AEDT) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 1036C60144; Thu, 15 Jan 2026 02:40:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D4C2C4CEF7; Thu, 15 Jan 2026 02:40:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1768444844; bh=kEIihbTO7hsA7HfHf64JRGq8WxboK1l9W0XcXEHbfeo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Vfb3gBTf+rsrpPAPcJ/Dig6SSOOLelLK4b09yec6FTVrBjTNJT3KBH/W/IuyCOUUG rWCMabju6IaOer0i0XS9FstGNEW6IG96OZlxk9eDNmuYljuhHuOo2Q6G5GIosWUK/o TtHClSrBGTI6P5GEFzOrr+RjoUt0V7nWJ0JUctS8= Date: Wed, 14 Jan 2026 18:40:42 -0800 From: Andrew Morton To: Matthew Brost Cc: Francois Dugast , , , Zi Yan , Alistair Popple , adhavan Srinivasan , Nicholas Piggin , Michael Ellerman , "Christophe Leroy (CS GROUP)" , Felix Kuehling , Alex Deucher , Christian =?UTF-8?B?S8O2bmln?= , David Airlie , Simona Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Lyude Paul , Danilo Krummrich , "David Hildenbrand" , Oscar Salvador , "Jason Gunthorpe" , Leon Romanovsky , Lorenzo Stoakes , "Liam R . Howlett" , Vlastimil Babka , Mike Rapoport , "Suren Baghdasaryan" , Michal Hocko , "Balbir Singh" , , , , , , , Subject: Re: [PATCH v5 1/5] mm/zone_device: Reinitialize large zone device private folios Message-Id: <20260114184042.64fc3df3e43e6e62870bb705@linux-foundation.org> In-Reply-To: References: <20260114192111.1267147-1-francois.dugast@intel.com> <20260114192111.1267147-2-francois.dugast@intel.com> <20260114134825.8bf1cb3e897c8e41c73dc8ae@linux-foundation.org> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Wed, 14 Jan 2026 15:51:16 -0800 Matthew Brost wrote: > On Wed, Jan 14, 2026 at 03:34:21PM -0800, Matthew Brost wrote: > > On Wed, Jan 14, 2026 at 01:48:25PM -0800, Andrew Morton wrote: > > > On Wed, 14 Jan 2026 20:19:52 +0100 Francois Dugast wrote: > > > > > > > Reinitialize metadata for large zone device private folios in > > > > zone_device_page_init prior to creating a higher-order zone device > > > > private folio. This step is necessary when the folio’s order changes > > > > dynamically between zone_device_page_init calls to avoid building a > > > > corrupt folio. As part of the metadata reinitialization, the dev_pagemap > > > > must be passed in from the caller because the pgmap stored in the folio > > > > page may have been overwritten with a compound head. > > > > > > Thanks. What are the worst-case userspace-visible effects of the bug? > > > > If you reallocate a subset of pages from what was originally a large > > device folio, the pgmap mapping becomes invalid because it was > > overwritten by the compound head, and this can crash the kernel. > > > > Alternatively, consider the case where the original folio had an order > > of 9 and _nr_pages was set. If you then reallocate the folio plus one as > > s/_nr_pages/the order was encoded the page flags. > > ... > > s/best to have kernel/best to not have kernels > Great, thanks. I pasted all the above into the changelog to help explain our reasons. I'll retain the patch in mm-hotfixes, targeting 6.19-rcX. The remainder of the series is DRM stuff, NotMyProblem. I assume that getting this into 6.19-rcX is helpful to DRM - if not, and if taking this via the DRM tree is preferable then let's discuss. Can reviewers please take a look at this reasonably promptly? btw, this patch uses + struct folio *new_folio = (struct folio *)new_page; Was page_folio() unsuitable?