Skip to content

Some fixes to debug_kmap_atomic()

Soeren Sandmann linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2Fix race in debug_kmap_atomic() which could cause warn_count to underflowmm/highmem.c+2 -21 reply
2/2Fix debug_kmap_atomic() to also handle KM_IRQ_PTE, KM_NMI, and KM_NMI_PTEmm/highmem.c+10 -31 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] Some fixes to debug_kmap_atomic()

Hi,

Here are two patches that fix an issue with debug_kmap_atomic().

The first one is a pretty straightforward fix for a race that can cause an underflow, which in turn causes the stream of warnings to never end.

The second patch extends debug_kmap_atomic() to deal with KM_IRQ_PTE, KM_NMI, and KM_NMI_PTE.

I was seeing this because the __get_user_pages_fast() in arch/x86/kernel/cpu/perf_events.c ends up eventually calling kmap_atomic() with KM_PTE, which, with CONFIG_HIGHPTE enabled, ends up expanding to:

#define __KM_PTE                        \
        (in_nmi() ? KM_NMI_PTE :        \
         in_irq() ? KM_IRQ_PTE :        \
         KM_PTE0)

and those KM_* types are not handled

For the second patch, I am basically pattern matching, so I might be completely wrong.

Thanks,
Soren