Sync with linux/drivers/staging/ktap

ktap is already merged into Linux kernel staging tree,
sync it to make a same code base.

- update email name from "zhangwei(Jovi)" to "Jovi Zhangwei"
- move lua copyright notice to individual files
- remove docs target in Makefile, because css file was also removed

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
update email name in README.md

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
remove unused <asm/syscall.h> header file

Fengguang Wu reported that ktap compile failed in mips,
the reason is it cannot found <asm/syscall.h> in mips arch.

Due to the code serviced by <asm/syscall.h> already removed,
so just simply remove the according header file to avoid
compiler failure.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
Remove redundant #define in ktap_opcodes.h

Signed-off-by: Yicheng Qin <qycqycqycqycqyc@gmail.com>
Add comments on ktap types

Signed-off-by: Yicheng Qin <qycqycqycqycqyc@gmail.com>
Make dump_function support OP_CLOSURE and LNGSTR

Signed-off-by: Yicheng Qin <qycqycqycqycqyc@gmail.com>
Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
kill KTAP_TCCL

KTAP_TCCL was purposed use for C closure in lua,
that kind of C closure usage is not needed in ktap,
so kill it.

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
Revert "only mainthread can call table pairs and histogram"

Sometime we have to call histogram or pairs in timer context,
so allow non-mainthread to do that.

This is still a temp solution, because using pairs and histogram
in non-mainthread have a little unsafe, find a more safe way
to fix it.

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
update comments of perf overflow callback

make comments to be more accurate.

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
kill unused function event_regstr

register dump functionality in ktap should be implemented
by some kind of FFI support(implement in future), don't dump
the register vaule one by one manually.

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
add skip and max_entries option arguments into print_backtrace()/backtrace()

Normally skip and max_entries both set to 10 when dump stack,
but sometimes stack entries exceed 10, or skip 10 entries is
not enough, so allow user dump stack with specific skip and
max_entries.

print_backtrace (skip, max_entries)
backtrace (skip, max_entries)

If user don't add skip or max_entries arguments, use 10 defaultly.

Note the max number of max_entries is 100.

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
skip 12 stack entries in dumpstack() for stack_profile.kp

Skip 12 stack entries to hide some timer interrupt function,
make stack dump more accurate.

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
fix error handling in kp_lib_printf function

add missed preempt_enable_notrace.

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
make kp_init_state a little faster

Use memset to init all stack value to nil, instead of
for-loop many times, memset would be more efficient.

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
disallow stack growing in ktap

Set a stack size limit for ktap, if thread exceed the limit,
ktapvm will report "stack overflow".

The default stack size is 120, enlarge this value if script
need more stack.

Make this value to be configurable in future.

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
add test/stack_overflow.kp

This testcase is purpose for stack overflow checking.

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
support dump more instructions

Below instructions can be dump now by "ktap -b *.kp"
1. SETTABUP
2. NEWTABLE
3. GETUPVAL
4. MOVE

Signed-off-by: Qingping Hou <qingping.hou@gmail.com>
Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
change printk to kp_error

The error info should be printed by kp_error, not printk.

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
add memory and events statistics into ktapvm

Support memory allocated/free and events hits/missed stats,
statistics is stored in percpu data.

The statistics data will report after execute script finished.

Usage:

	#./ktap -v scripts/tracepoints/eventcount.kp
	...
	[verbose] ktap stats:
	[verbose] memory allocated size: 473157
	[verbose] memory allocate num: 11039
	[verbose] memory free num: 11039
	[verbose] events_hits: 376981
	[verbose] events_missed: 0

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>
kill unused kp_newuserdata function and ktap_udata strucutre

There have no user for kp_newuserdata and ktap_udata, so kill it.

Signed-off-by: Jovi Zhangwei <jovi.zhangwei@gmail.com>