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 <simona.vet...@ffwll.ch>
> Signed-off-by: Jocelyn Falempe <jfale...@redhat.com>
> ---
>  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 <t...@linutronix.de>

Thanks,

        tglx

Reply via email to