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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 C7FACC36010 for ; Fri, 4 Apr 2025 07:42:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3D73110E309; Fri, 4 Apr 2025 07:42:41 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; secure) header.d=linutronix.de header.i=@linutronix.de header.b="mlgQCiQu"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="f4D9D1uB"; dkim-atps=neutral X-Greylist: delayed 531 seconds by postgrey-1.36 at gabe; Fri, 04 Apr 2025 07:42:38 UTC Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by gabe.freedesktop.org (Postfix) with ESMTPS id 41ED410E309 for ; Fri, 4 Apr 2025 07:42:38 +0000 (UTC) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1743752015; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CORAwJdGdFJqSXpfBY2eBhV3jtyb7N9hwR1HOp2miIw=; b=mlgQCiQuOrsco+po4sSITtC11nph9KQwzE+DSpGJF+GzYbY1iOkm+3JPijRAA5OPBTYb6Q cVSO8otipo4wfZTMR9e4XBBy7+JZWjVU78K6a6RbI0La0EjxVpHCOfajgXBYkW9pF5mIXq MlOfJJTps1zAjYHYoUraLaIKshDoNKjvRocZeBCwdTQVYw4qZfIwfNdNvPStyBPsBA4mLl 34iqpxCz3hMPEH8Q1L2pQRcmKyoMQeBTVMkaLkZkmiM8/40W3mmcqN7vd10cylBbYoZ9bg uMqnQytDLVcIlT2rUK9A5IB9f59wnGpgcz8y0nYaOE2A3fDlx9Xnjr1IpgLgmw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1743752015; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CORAwJdGdFJqSXpfBY2eBhV3jtyb7N9hwR1HOp2miIw=; b=f4D9D1uBxpPnWMpsC1nrSzp/rcZLMY6vogYgkx7/pYNMe8b3tUWHHdgp5rXAqD/prNL9o3 0oyADrspMYRwtfBQ== To: Jocelyn Falempe , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Ryosuke Yasuoka , Javier Martinez Canillas , Wei Yang , Andrew Morton , David Hildenbrand , John Ogness , linux-mm@kvack.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Jocelyn Falempe , Simona Vetter Subject: Re: [PATCH v2 1/2] mm/kmap: Add kmap_local_page_try_from_panic() In-Reply-To: <20250321112436.1739876-2-jfalempe@redhat.com> References: <20250321112436.1739876-1-jfalempe@redhat.com> <20250321112436.1739876-2-jfalempe@redhat.com> Date: Fri, 04 Apr 2025 09:33:35 +0200 Message-ID: <87mscwv0s0.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Fri, Mar 21 2025 at 12:16, Jocelyn Falempe wrote: > kmap_local_page() can be unsafe to call from a panic handler, if > CONFIG_HIGHMEM is set, and the page is in the highmem zone. > So add kmap_local_page_try_from_panic() to handle this case. I think this is a reasonable solution and the highmem case can suffer from not getting the reliable panic output. > Suggested-by: Simona Vetter > Signed-off-by: Jocelyn Falempe > --- > include/linux/highmem-internal.h | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/include/linux/highmem-internal.h b/include/linux/highmem-internal.h > index dd100e849f5e0..5d089b0ca56de 100644 > --- a/include/linux/highmem-internal.h > +++ b/include/linux/highmem-internal.h > @@ -73,6 +73,13 @@ static inline void *kmap_local_page(struct page *page) > return __kmap_local_page_prot(page, kmap_prot); > } > > +static inline void *kmap_local_page_try_from_panic(struct page *page) > +{ > + if (!PageHighMem(page)) > + return page_address(page); > + return NULL; A comment explaining the reason why the highmem mapping cannot work here would be appreciated. Aside of that: Reviewed-by: Thomas Gleixner Thanks, tglx