• Jesse Brandeburg's avatar
    lib: make a test module with set/clear bit · c348c163
    Jesse Brandeburg authored
    Test some bit clears/sets to make sure assembly doesn't change, and that
    the set_bit and clear_bit functions work and don't cause sparse warnings.
    
    Instruct Kbuild to build this file with extra warning level -Wextra, to
    catch new issues, and also doesn't hurt to build with C=1.
    
    This was used to test changes to arch/x86/include/asm/bitops.h.
    
    In particular, sparse (C=1) was very concerned when the last bit before a
    natural boundary, like 7, or 31, was being tested, as this causes sign
    extension (0xffffff7f) for instance when clearing bit 7.
    
    Recommended usage:
    
      make defconfig
      scripts/config -m CONFIG_TEST_BITOPS
      make modules_prepare
      make C=1 W=1 lib/test_bitops.ko
      objdump -S -d lib/test_bitops.ko
      insmod lib/test_bitops.ko
      rmmod lib/test_bitops.ko
    
    <check dmesg>, there should be no compiler/sparse warnings and no
    error messages in log.
    
    Link: http://lkml.kernel.org/r/20200310221747.2848474-2-jesse.brandeburg@intel.comSigned-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
    Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@intel.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    CcL Ingo Molnar <mingo@redhat.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Wei Yang <richard.weiyang@gmail.com>
    Cc: Christian Brauner <christian.brauner@ubuntu.com>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    c348c163
Makefile 10.3 KB