dyndbg: fix usability bug by adding pr_errs for -EINVALs

A recent usability grumble on LKML prompted a review of error
reporting when writing dyndbg queries.  For each -EINVAL, this adds
pr_err()s to explain the error.

To: Jason Baron <jbaron@redhat.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CC: Jianpeng Ma <majianpeng@gmail.com>
dyndbg: spelling fix s/conrol/control/

fix name of control file in comment
dyndbg: add more info to -E2BIG log warning

tell user how big the attempted write was, in case its not obvious.
dyndbg: increase verbosity for proc-show, proc-next

catting /dbg/dynamic_debug/control creates reams of log entries under
verbose, add v2pr_info(), v3pr_info() macros, and use them in
proc-file-ish functions to reduce log clutter.
dyndbg-prob-demo: include jump_label.h, break compile

We want to add struct static_key key to struct _ddebug, so that
dynamic_debug can be optimized using jump-labels.

But adding #include <linux/jump_label.h> breaks the compile, by
causing an include loop.

[jimc@groucho build-dell]$ make
make[3]: Nothing to be done for `all'.
make[3]: Nothing to be done for `relocs'.
  Using /home/jimc/projects/lx/linux-2.6 as source for kernel
  GEN     /home/jimc/projects/lx/build-dell/Makefile
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      kernel/bounds.s
In file included from /home/jimc/projects/lx/linux-2.6/include/linux/cpumask.h:11:0,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/cpumask.h:4,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/msr.h:18,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/processor.h:20,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/thread_info.h:22,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/thread_info.h:54,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/preempt.h:9,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/spinlock.h:50,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/seqlock.h:29,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/time.h:8,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/ktime.h:24,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/timer.h:5,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/workqueue.h:8,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/jump_label.h:51,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/dynamic_debug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/kernel.h:23,
                 from /home/jimc/projects/lx/linux-2.6/include/asm-generic/bug.h:13,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/bug.h:38,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/bug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/page-flags.h:9,
                 from /home/jimc/projects/lx/linux-2.6/kernel/bounds.c:9:
/home/jimc/projects/lx/linux-2.6/include/linux/bitmap.h: In function ‘bitmap_zero’:
/home/jimc/projects/lx/linux-2.6/include/linux/bitmap.h:164:3: error: implicit declaration of function ‘DIV_ROUND_UP’ [-Werror=implicit-function-declaration]
In file included from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/cpumask.h:4:0,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/msr.h:18,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/processor.h:20,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/thread_info.h:22,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/thread_info.h:54,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/preempt.h:9,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/spinlock.h:50,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/seqlock.h:29,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/time.h:8,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/ktime.h:24,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/timer.h:5,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/workqueue.h:8,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/jump_label.h:51,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/dynamic_debug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/kernel.h:23,
                 from /home/jimc/projects/lx/linux-2.6/include/asm-generic/bug.h:13,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/bug.h:38,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/bug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/page-flags.h:9,
                 from /home/jimc/projects/lx/linux-2.6/kernel/bounds.c:9:
/home/jimc/projects/lx/linux-2.6/include/linux/cpumask.h: At top level:
/home/jimc/projects/lx/linux-2.6/include/linux/cpumask.h:14:26: error: variably modified ‘bits’ at file scope
/home/jimc/projects/lx/linux-2.6/include/linux/cpumask.h: In function ‘cpumask_check’:
/home/jimc/projects/lx/linux-2.6/include/linux/cpumask.h:108:2: error: implicit declaration of function ‘WARN_ON_ONCE’ [-Werror=implicit-function-declaration]
/home/jimc/projects/lx/linux-2.6/include/linux/cpumask.h: At top level:
/home/jimc/projects/lx/linux-2.6/include/linux/cpumask.h:700:14: error: variably modified ‘cpu_all_bits’ at file scope
/home/jimc/projects/lx/linux-2.6/include/linux/cpumask.h:746:2: error: variably modified ‘cpu_bit_bitmap’ at file scope
In file included from /home/jimc/projects/lx/linux-2.6/include/linux/thread_info.h:54:0,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/preempt.h:9,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/spinlock.h:50,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/seqlock.h:29,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/time.h:8,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/ktime.h:24,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/timer.h:5,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/workqueue.h:8,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/jump_label.h:51,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/dynamic_debug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/kernel.h:23,
                 from /home/jimc/projects/lx/linux-2.6/include/asm-generic/bug.h:13,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/bug.h:38,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/bug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/page-flags.h:9,
                 from /home/jimc/projects/lx/linux-2.6/kernel/bounds.c:9:
/home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/thread_info.h: In function ‘set_restore_sigmask’:
/home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/thread_info.h:249:2: error: implicit declaration of function ‘WARN_ON’ [-Werror=implicit-function-declaration]
In file included from /home/jimc/projects/lx/linux-2.6/include/linux/spinlock.h:263:0,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/seqlock.h:29,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/time.h:8,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/ktime.h:24,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/timer.h:5,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/workqueue.h:8,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/jump_label.h:51,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/dynamic_debug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/kernel.h:23,
                 from /home/jimc/projects/lx/linux-2.6/include/asm-generic/bug.h:13,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/bug.h:38,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/bug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/page-flags.h:9,
                 from /home/jimc/projects/lx/linux-2.6/kernel/bounds.c:9:
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h: In function ‘__raw_spin_trylock’:
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:90:3: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:90:3: note: each undeclared identifier is reported only once for each function it appears in
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h: In function ‘__raw_spin_lock_irqsave’:
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:110:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h: In function ‘__raw_spin_lock_irq’:
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:128:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h: In function ‘__raw_spin_lock_bh’:
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:136:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h: In function ‘__raw_spin_lock’:
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:143:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h: In function ‘__raw_spin_unlock’:
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:151:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h: In function ‘__raw_spin_unlock_irqrestore’:
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:159:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h: In function ‘__raw_spin_unlock_irq’:
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:167:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h: In function ‘__raw_spin_unlock_bh’:
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:175:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h: In function ‘__raw_spin_trylock_bh’:
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:186:3: error: ‘_RET_IP_’ undeclared (first use in this function)
In file included from /home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:194:0,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/spinlock.h:263,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/seqlock.h:29,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/time.h:8,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/ktime.h:24,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/timer.h:5,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/workqueue.h:8,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/jump_label.h:51,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/dynamic_debug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/kernel.h:23,
                 from /home/jimc/projects/lx/linux-2.6/include/asm-generic/bug.h:13,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/bug.h:38,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/bug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/page-flags.h:9,
                 from /home/jimc/projects/lx/linux-2.6/kernel/bounds.c:9:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_read_trylock’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:121:3: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_write_trylock’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:132:3: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_read_lock’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:149:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_read_lock_irqsave’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:159:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_read_lock_irq’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:169:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_read_lock_bh’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:177:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_write_lock_irqsave’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:187:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_write_lock_irq’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:197:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_write_lock_bh’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:205:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_write_lock’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:212:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_write_unlock’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:220:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_read_unlock’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:227:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_read_unlock_irqrestore’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:235:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_read_unlock_irq’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:243:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_read_unlock_bh’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:251:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_write_unlock_irqrestore’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:260:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_write_unlock_irq’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:268:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_write_unlock_bh’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:276:2: error: ‘_RET_IP_’ undeclared (first use in this function)
In file included from /home/jimc/projects/lx/linux-2.6/include/linux/jump_label.h:51:0,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/dynamic_debug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/kernel.h:23,
                 from /home/jimc/projects/lx/linux-2.6/include/asm-generic/bug.h:13,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/bug.h:38,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/bug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/page-flags.h:9,
                 from /home/jimc/projects/lx/linux-2.6/kernel/bounds.c:9:
/home/jimc/projects/lx/linux-2.6/include/linux/workqueue.h: In function ‘to_delayed_work’:
/home/jimc/projects/lx/linux-2.6/include/linux/workqueue.h:99:2: error: implicit declaration of function ‘container_of’ [-Werror=implicit-function-declaration]
/home/jimc/projects/lx/linux-2.6/include/linux/workqueue.h:99:28: error: expected expression before ‘struct’
cc1: some warnings being treated as errors
make[3]: *** [kernel/bounds.s] Error 1
make[2]: *** [prepare0] Error 2
make[1]: *** [sub-make] Error 2
make: *** [all] Error 2

bisect-skip: this breaks compile

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
dyndbg: use jump_label optimization where its available and configured

New function update_jump() is called by ddebug_change() when
_DPRINTK_FLAGS_PRINT flag is changed, or from ddebug_add_module() if
the flag for that callsite was enabled at compile time.

Make the static_key field and its initializer conditional on
HAVE_JUMP_LABEL, and avoid the storage when it provides no advantage.
compile err remains
more attempts