Linux VM Integration Cleanup
Remove all instances of functions being reimplemented in the SPL. When the prototypes are available in the linux headers but the function address itself is not exported use kallsyms_lookup_name() to find the address. The function name itself can them become a define which calls a function pointer. This is preferable to reimplementing the function in the SPL because it ensures we get the correct version of the function for the running kernel. This is actually pretty safe because the prototype is defined in the headers so we know we are calling the function properly. This patch also includes a rhel5 kernel patch we exports the needed symbols so we don't need to use kallsyms_lookup_name(). There are autoconf checks to detect if the symbol is exported and if so to use it directly. We should add patches for stock upstream kernels as needed if for no other reason than so we can easily track which additional symbols we needed exported. Those patches can also be used by anyone willing to rebuild their kernel, but this should not be a requirement. The rhel5 version of the export-symbols patch has been applied to the chaos kernel. Additional fixes: 1) Implement vmem_size() function using get_vmalloc_info() 2) SPL_CHECK_SYMBOL_EXPORT macro updated to use $LINUX_OBJ instead of $LINUX because Module.symvers is a build product. When $LINUX_OBJ != $LINUX we will not properly detect exported symbols. 3) SPL_LINUX_COMPILE_IFELSE macro updated to add include2 and $LINUX/include search paths to allow proper compilation when the kernel target build directory is not the source directory.
This commit is contained in:
parent
4327ac3ff9
commit
d1ff2312b0
|
@ -221,8 +221,8 @@ AC_DEFUN([SPL_LINUX_COMPILE_IFELSE], [
|
|||
m4_ifvaln([$1], [SPL_LINUX_CONFTEST([$1])])dnl
|
||||
rm -f build/conftest.o build/conftest.mod.c build/conftest.ko build/Makefile
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
dnl AS_IF([AC_TRY_COMMAND(cp conftest.c build && make [$2] CC="$CC" -f $PWD/build/Makefile LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM SUBDIRS=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])],
|
||||
AS_IF([AC_TRY_COMMAND(cp conftest.c build && make [$2] CC="$CC" LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])],
|
||||
dnl AS_IF([AC_TRY_COMMAND(cp conftest.c build && make [$2] CC="$CC" -f $PWD/build/Makefile LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM SUBDIRS=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])],
|
||||
AS_IF([AC_TRY_COMMAND(cp conftest.c build && make [$2] CC="$CC" LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])],
|
||||
[$4],
|
||||
[_AC_MSG_LOG_CONFTEST
|
||||
m4_ifvaln([$5],[$5])dnl])dnl
|
||||
|
@ -268,12 +268,12 @@ dnl # check symbol exported or not
|
|||
dnl #
|
||||
AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT],
|
||||
[AC_MSG_CHECKING([whether symbol $1 is exported])
|
||||
grep -q -E '[[[:space:]]]$1[[[:space:]]]' $LINUX/Module.symvers 2>/dev/null
|
||||
grep -q -E '[[[:space:]]]$1[[[:space:]]]' $LINUX_OBJ/Module.symvers 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -ne 0; then
|
||||
export=0
|
||||
for file in $2; do
|
||||
grep -q -E "EXPORT_SYMBOL.*($1)" "$LINUX/$file" 2>/dev/null
|
||||
grep -q -E "EXPORT_SYMBOL.*($1)" "$LINUX_OBJ/$file" 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -eq 0; then
|
||||
export=1
|
||||
|
@ -707,7 +707,32 @@ AC_DEFUN([SPL_AC_3ARGS_ON_EACH_CPU], [
|
|||
])
|
||||
|
||||
dnl #
|
||||
dnl # Distro specific first_online_pgdat() symbol export.
|
||||
dnl # 2.6.18 API change,
|
||||
dnl # kallsyms_lookup_name no longer exported
|
||||
dnl #
|
||||
AC_DEFUN([SPL_AC_KALLSYMS_LOOKUP_NAME], [
|
||||
SPL_CHECK_SYMBOL_EXPORT(
|
||||
[kallsyms_lookup_name],
|
||||
[],
|
||||
[AC_DEFINE(HAVE_KALLSYMS_LOOKUP_NAME, 1,
|
||||
[kallsyms_lookup_name() is available])],
|
||||
[])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # Symbol only available in custom kernels
|
||||
dnl #
|
||||
AC_DEFUN([SPL_AC_GET_VMALLOC_INFO], [
|
||||
SPL_CHECK_SYMBOL_EXPORT(
|
||||
[get_vmalloc_info],
|
||||
[],
|
||||
[AC_DEFINE(HAVE_GET_VMALLOC_INFO, 1,
|
||||
[get_vmalloc_info() is available])],
|
||||
[])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # Symbol only available in custom kernels
|
||||
dnl #
|
||||
AC_DEFUN([SPL_AC_FIRST_ONLINE_PGDAT], [
|
||||
SPL_CHECK_SYMBOL_EXPORT(
|
||||
|
@ -719,7 +744,7 @@ AC_DEFUN([SPL_AC_FIRST_ONLINE_PGDAT], [
|
|||
])
|
||||
|
||||
dnl #
|
||||
dnl # Distro specific next_online_pgdat() symbol export.
|
||||
dnl # Symbol only available in custom kernels
|
||||
dnl #
|
||||
AC_DEFUN([SPL_AC_NEXT_ONLINE_PGDAT], [
|
||||
SPL_CHECK_SYMBOL_EXPORT(
|
||||
|
@ -731,7 +756,7 @@ AC_DEFUN([SPL_AC_NEXT_ONLINE_PGDAT], [
|
|||
])
|
||||
|
||||
dnl #
|
||||
dnl # Distro specific next_zone() symbol export.
|
||||
dnl # Symbol only available in custom kernels
|
||||
dnl #
|
||||
AC_DEFUN([SPL_AC_NEXT_ZONE], [
|
||||
SPL_CHECK_SYMBOL_EXPORT(
|
||||
|
@ -743,7 +768,7 @@ AC_DEFUN([SPL_AC_NEXT_ZONE], [
|
|||
])
|
||||
|
||||
dnl #
|
||||
dnl # Distro specific get_zone_counts() symbol export.
|
||||
dnl # Symbol only available in custom kernels
|
||||
dnl #
|
||||
AC_DEFUN([SPL_AC_GET_ZONE_COUNTS], [
|
||||
SPL_CHECK_SYMBOL_EXPORT(
|
||||
|
|
|
@ -19201,7 +19201,7 @@ _ACEOF
|
|||
|
||||
rm -f build/conftest.o build/conftest.mod.c build/conftest.ko build/Makefile
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
|
@ -19261,7 +19261,7 @@ _ACEOF
|
|||
|
||||
rm -f build/conftest.o build/conftest.mod.c build/conftest.ko build/Makefile
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
|
@ -19322,7 +19322,7 @@ _ACEOF
|
|||
|
||||
rm -f build/conftest.o build/conftest.mod.c build/conftest.ko build/Makefile
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
|
@ -19382,7 +19382,7 @@ _ACEOF
|
|||
|
||||
rm -f build/conftest.o build/conftest.mod.c build/conftest.ko build/Makefile
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
|
@ -19443,7 +19443,7 @@ _ACEOF
|
|||
|
||||
rm -f build/conftest.o build/conftest.mod.c build/conftest.ko build/Makefile
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
|
@ -19506,7 +19506,7 @@ _ACEOF
|
|||
|
||||
rm -f build/conftest.o build/conftest.mod.c build/conftest.ko build/Makefile
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
|
@ -19541,12 +19541,12 @@ rm -f build/conftest.o build/conftest.mod.c build/conftest.mod.o build/conftest.
|
|||
|
||||
echo "$as_me:$LINENO: checking whether symbol task_curr is exported" >&5
|
||||
echo $ECHO_N "checking whether symbol task_curr is exported... $ECHO_C" >&6
|
||||
grep -q -E '[[:space:]]task_curr[[:space:]]' $LINUX/Module.symvers 2>/dev/null
|
||||
grep -q -E '[[:space:]]task_curr[[:space:]]' $LINUX_OBJ/Module.symvers 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -ne 0; then
|
||||
export=0
|
||||
for file in kernel/sched.c; do
|
||||
grep -q -E "EXPORT_SYMBOL.*(task_curr)" "$LINUX/$file" 2>/dev/null
|
||||
grep -q -E "EXPORT_SYMBOL.*(task_curr)" "$LINUX_OBJ/$file" 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -eq 0; then
|
||||
export=1
|
||||
|
@ -19607,7 +19607,7 @@ _ACEOF
|
|||
|
||||
rm -f build/conftest.o build/conftest.mod.c build/conftest.ko build/Makefile
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
|
@ -19667,7 +19667,7 @@ _ACEOF
|
|||
|
||||
rm -f build/conftest.o build/conftest.mod.c build/conftest.ko build/Makefile
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
|
@ -19702,12 +19702,12 @@ rm -f build/conftest.o build/conftest.mod.c build/conftest.mod.o build/conftest.
|
|||
|
||||
echo "$as_me:$LINENO: checking whether symbol device_create is exported" >&5
|
||||
echo $ECHO_N "checking whether symbol device_create is exported... $ECHO_C" >&6
|
||||
grep -q -E '[[:space:]]device_create[[:space:]]' $LINUX/Module.symvers 2>/dev/null
|
||||
grep -q -E '[[:space:]]device_create[[:space:]]' $LINUX_OBJ/Module.symvers 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -ne 0; then
|
||||
export=0
|
||||
for file in drivers/base/core.c; do
|
||||
grep -q -E "EXPORT_SYMBOL.*(device_create)" "$LINUX/$file" 2>/dev/null
|
||||
grep -q -E "EXPORT_SYMBOL.*(device_create)" "$LINUX_OBJ/$file" 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -eq 0; then
|
||||
export=1
|
||||
|
@ -19741,12 +19741,12 @@ _ACEOF
|
|||
|
||||
echo "$as_me:$LINENO: checking whether symbol class_device_create is exported" >&5
|
||||
echo $ECHO_N "checking whether symbol class_device_create is exported... $ECHO_C" >&6
|
||||
grep -q -E '[[:space:]]class_device_create[[:space:]]' $LINUX/Module.symvers 2>/dev/null
|
||||
grep -q -E '[[:space:]]class_device_create[[:space:]]' $LINUX_OBJ/Module.symvers 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -ne 0; then
|
||||
export=0
|
||||
for file in drivers/base/class.c; do
|
||||
grep -q -E "EXPORT_SYMBOL.*(class_device_create)" "$LINUX/$file" 2>/dev/null
|
||||
grep -q -E "EXPORT_SYMBOL.*(class_device_create)" "$LINUX_OBJ/$file" 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -eq 0; then
|
||||
export=1
|
||||
|
@ -19780,12 +19780,12 @@ _ACEOF
|
|||
|
||||
echo "$as_me:$LINENO: checking whether symbol set_normalized_timespec is exported" >&5
|
||||
echo $ECHO_N "checking whether symbol set_normalized_timespec is exported... $ECHO_C" >&6
|
||||
grep -q -E '[[:space:]]set_normalized_timespec[[:space:]]' $LINUX/Module.symvers 2>/dev/null
|
||||
grep -q -E '[[:space:]]set_normalized_timespec[[:space:]]' $LINUX_OBJ/Module.symvers 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -ne 0; then
|
||||
export=0
|
||||
for file in kernel/time.c; do
|
||||
grep -q -E "EXPORT_SYMBOL.*(set_normalized_timespec)" "$LINUX/$file" 2>/dev/null
|
||||
grep -q -E "EXPORT_SYMBOL.*(set_normalized_timespec)" "$LINUX_OBJ/$file" 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -eq 0; then
|
||||
export=1
|
||||
|
@ -19845,7 +19845,7 @@ _ACEOF
|
|||
|
||||
rm -f build/conftest.o build/conftest.mod.c build/conftest.ko build/Makefile
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
|
@ -19907,7 +19907,7 @@ _ACEOF
|
|||
|
||||
rm -f build/conftest.o build/conftest.mod.c build/conftest.ko build/Makefile
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
|
@ -19968,7 +19968,7 @@ _ACEOF
|
|||
|
||||
rm -f build/conftest.o build/conftest.mod.c build/conftest.ko build/Makefile
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
|
@ -20029,7 +20029,7 @@ _ACEOF
|
|||
|
||||
rm -f build/conftest.o build/conftest.mod.c build/conftest.ko build/Makefile
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
|
@ -20098,7 +20098,7 @@ _ACEOF
|
|||
|
||||
rm -f build/conftest.o build/conftest.mod.c build/conftest.ko build/Makefile
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
|
@ -20159,7 +20159,7 @@ _ACEOF
|
|||
|
||||
rm -f build/conftest.o build/conftest.mod.c build/conftest.ko build/Makefile
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
|
@ -20223,7 +20223,7 @@ _ACEOF
|
|||
|
||||
rm -f build/conftest.o build/conftest.mod.c build/conftest.ko build/Makefile
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
|
@ -20258,12 +20258,12 @@ rm -f build/conftest.o build/conftest.mod.c build/conftest.mod.o build/conftest.
|
|||
|
||||
echo "$as_me:$LINENO: checking whether symbol monotonic_clock is exported" >&5
|
||||
echo $ECHO_N "checking whether symbol monotonic_clock is exported... $ECHO_C" >&6
|
||||
grep -q -E '[[:space:]]monotonic_clock[[:space:]]' $LINUX/Module.symvers 2>/dev/null
|
||||
grep -q -E '[[:space:]]monotonic_clock[[:space:]]' $LINUX_OBJ/Module.symvers 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -ne 0; then
|
||||
export=0
|
||||
for file in ; do
|
||||
grep -q -E "EXPORT_SYMBOL.*(monotonic_clock)" "$LINUX/$file" 2>/dev/null
|
||||
grep -q -E "EXPORT_SYMBOL.*(monotonic_clock)" "$LINUX_OBJ/$file" 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -eq 0; then
|
||||
export=1
|
||||
|
@ -20325,7 +20325,7 @@ _ACEOF
|
|||
|
||||
rm -f build/conftest.o build/conftest.mod.c build/conftest.ko build/Makefile
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
|
@ -20387,7 +20387,7 @@ _ACEOF
|
|||
|
||||
rm -f build/conftest.o build/conftest.mod.c build/conftest.ko build/Makefile
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
|
@ -20448,7 +20448,7 @@ _ACEOF
|
|||
|
||||
rm -f build/conftest.o build/conftest.mod.c build/conftest.ko build/Makefile
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
|
@ -20481,14 +20481,92 @@ rm -f build/conftest.o build/conftest.mod.c build/conftest.mod.o build/conftest.
|
|||
|
||||
|
||||
|
||||
echo "$as_me:$LINENO: checking whether symbol first_online_pgdat is exported" >&5
|
||||
echo $ECHO_N "checking whether symbol first_online_pgdat is exported... $ECHO_C" >&6
|
||||
grep -q -E '[[:space:]]first_online_pgdat[[:space:]]' $LINUX/Module.symvers 2>/dev/null
|
||||
echo "$as_me:$LINENO: checking whether symbol kallsyms_lookup_name is exported" >&5
|
||||
echo $ECHO_N "checking whether symbol kallsyms_lookup_name is exported... $ECHO_C" >&6
|
||||
grep -q -E '[[:space:]]kallsyms_lookup_name[[:space:]]' $LINUX_OBJ/Module.symvers 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -ne 0; then
|
||||
export=0
|
||||
for file in ; do
|
||||
grep -q -E "EXPORT_SYMBOL.*(first_online_pgdat)" "$LINUX/$file" 2>/dev/null
|
||||
grep -q -E "EXPORT_SYMBOL.*(kallsyms_lookup_name)" "$LINUX_OBJ/$file" 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -eq 0; then
|
||||
export=1
|
||||
break;
|
||||
fi
|
||||
done
|
||||
if test $export -eq 0; then
|
||||
echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6
|
||||
|
||||
else
|
||||
echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_KALLSYMS_LOOKUP_NAME 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
else
|
||||
echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_KALLSYMS_LOOKUP_NAME 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
echo "$as_me:$LINENO: checking whether symbol get_vmalloc_info is exported" >&5
|
||||
echo $ECHO_N "checking whether symbol get_vmalloc_info is exported... $ECHO_C" >&6
|
||||
grep -q -E '[[:space:]]get_vmalloc_info[[:space:]]' $LINUX_OBJ/Module.symvers 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -ne 0; then
|
||||
export=0
|
||||
for file in ; do
|
||||
grep -q -E "EXPORT_SYMBOL.*(get_vmalloc_info)" "$LINUX_OBJ/$file" 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -eq 0; then
|
||||
export=1
|
||||
break;
|
||||
fi
|
||||
done
|
||||
if test $export -eq 0; then
|
||||
echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6
|
||||
|
||||
else
|
||||
echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_GET_VMALLOC_INFO 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
else
|
||||
echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_GET_VMALLOC_INFO 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
echo "$as_me:$LINENO: checking whether symbol first_online_pgdat is exported" >&5
|
||||
echo $ECHO_N "checking whether symbol first_online_pgdat is exported... $ECHO_C" >&6
|
||||
grep -q -E '[[:space:]]first_online_pgdat[[:space:]]' $LINUX_OBJ/Module.symvers 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -ne 0; then
|
||||
export=0
|
||||
for file in ; do
|
||||
grep -q -E "EXPORT_SYMBOL.*(first_online_pgdat)" "$LINUX_OBJ/$file" 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -eq 0; then
|
||||
export=1
|
||||
|
@ -20522,12 +20600,12 @@ _ACEOF
|
|||
|
||||
echo "$as_me:$LINENO: checking whether symbol next_online_pgdat is exported" >&5
|
||||
echo $ECHO_N "checking whether symbol next_online_pgdat is exported... $ECHO_C" >&6
|
||||
grep -q -E '[[:space:]]next_online_pgdat[[:space:]]' $LINUX/Module.symvers 2>/dev/null
|
||||
grep -q -E '[[:space:]]next_online_pgdat[[:space:]]' $LINUX_OBJ/Module.symvers 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -ne 0; then
|
||||
export=0
|
||||
for file in ; do
|
||||
grep -q -E "EXPORT_SYMBOL.*(next_online_pgdat)" "$LINUX/$file" 2>/dev/null
|
||||
grep -q -E "EXPORT_SYMBOL.*(next_online_pgdat)" "$LINUX_OBJ/$file" 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -eq 0; then
|
||||
export=1
|
||||
|
@ -20561,12 +20639,12 @@ _ACEOF
|
|||
|
||||
echo "$as_me:$LINENO: checking whether symbol next_zone is exported" >&5
|
||||
echo $ECHO_N "checking whether symbol next_zone is exported... $ECHO_C" >&6
|
||||
grep -q -E '[[:space:]]next_zone[[:space:]]' $LINUX/Module.symvers 2>/dev/null
|
||||
grep -q -E '[[:space:]]next_zone[[:space:]]' $LINUX_OBJ/Module.symvers 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -ne 0; then
|
||||
export=0
|
||||
for file in ; do
|
||||
grep -q -E "EXPORT_SYMBOL.*(next_zone)" "$LINUX/$file" 2>/dev/null
|
||||
grep -q -E "EXPORT_SYMBOL.*(next_zone)" "$LINUX_OBJ/$file" 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -eq 0; then
|
||||
export=1
|
||||
|
@ -20600,12 +20678,12 @@ _ACEOF
|
|||
|
||||
echo "$as_me:$LINENO: checking whether symbol get_zone_counts is exported" >&5
|
||||
echo $ECHO_N "checking whether symbol get_zone_counts is exported... $ECHO_C" >&6
|
||||
grep -q -E '[[:space:]]get_zone_counts[[:space:]]' $LINUX/Module.symvers 2>/dev/null
|
||||
grep -q -E '[[:space:]]get_zone_counts[[:space:]]' $LINUX_OBJ/Module.symvers 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -ne 0; then
|
||||
export=0
|
||||
for file in ; do
|
||||
grep -q -E "EXPORT_SYMBOL.*(get_zone_counts)" "$LINUX/$file" 2>/dev/null
|
||||
grep -q -E "EXPORT_SYMBOL.*(get_zone_counts)" "$LINUX_OBJ/$file" 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -eq 0; then
|
||||
export=1
|
||||
|
|
|
@ -69,6 +69,8 @@ SPL_AC_MONOTONIC_CLOCK
|
|||
SPL_AC_INODE_I_MUTEX
|
||||
SPL_AC_DIV64_64
|
||||
SPL_AC_3ARGS_ON_EACH_CPU
|
||||
SPL_AC_KALLSYMS_LOOKUP_NAME
|
||||
SPL_AC_GET_VMALLOC_INFO
|
||||
SPL_AC_FIRST_ONLINE_PGDAT
|
||||
SPL_AC_NEXT_ONLINE_PGDAT
|
||||
SPL_AC_NEXT_ZONE
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef _SPL_KALLSYMS_COMPAT_H
|
||||
#define _SPL_KALLSYMS_COMPAT_H
|
||||
|
||||
#ifdef HAVE_KALLSYMS_LOOKUP_NAME
|
||||
|
||||
#include <linux/kallsyms.h>
|
||||
#define spl_kallsyms_lookup_name(name) kallsyms_lookup_name(name)
|
||||
|
||||
#else
|
||||
|
||||
typedef unsigned long (*kallsyms_lookup_name_t)(const char *);
|
||||
extern kallsyms_lookup_name_t spl_kallsyms_lookup_name_fn;
|
||||
#define spl_kallsyms_lookup_name(name) spl_kallsyms_lookup_name_fn(name)
|
||||
|
||||
#endif /* HAVE_KALLSYMS_LOOKUP_NAME */
|
||||
|
||||
#endif /* _SPL_KALLSYMS_COMPAT_H */
|
|
@ -325,6 +325,7 @@ extern void spl_kmem_cache_free(spl_kmem_cache_t *skc, void *obj);
|
|||
extern void spl_kmem_cache_reap_now(spl_kmem_cache_t *skc);
|
||||
extern void spl_kmem_reap(void);
|
||||
|
||||
int spl_kmem_init_kallsyms_lookup(void);
|
||||
int spl_kmem_init(void);
|
||||
void spl_kmem_fini(void);
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ extern "C" {
|
|||
#include <linux/bitops_compat.h>
|
||||
#include <linux/smp_compat.h>
|
||||
#include <linux/workqueue_compat.h>
|
||||
#include <linux/kallsyms_compat.h>
|
||||
|
||||
#ifndef HAVE_UINTPTR_T
|
||||
typedef unsigned long uintptr_t;
|
||||
|
|
|
@ -58,12 +58,71 @@ extern vmem_t *heap_arena; /* primary kernel heap arena */
|
|||
extern vmem_t *zio_alloc_arena; /* arena for zio caches */
|
||||
extern vmem_t *zio_arena; /* arena for allocating zio memory */
|
||||
|
||||
#define VMEM_ALLOC 0x01
|
||||
#define VMEM_FREE 0x02
|
||||
|
||||
extern pgcnt_t spl_kmem_availrmem(void);
|
||||
extern size_t vmem_size(vmem_t *vmp, int typemask);
|
||||
|
||||
/*
|
||||
* The following symbols are available for use within the kernel
|
||||
* itself, and they used to be available in older kernels. But it
|
||||
* looks like they have been removed perhaps due to lack of use.
|
||||
* For our purposes we need them to access the global memory state
|
||||
* of the system, which is even available to user space process
|
||||
* in /proc/meminfo. It's odd to me that there is no kernel API
|
||||
* to get the same information, minimally the proc handler for
|
||||
* the above mentioned /proc/meminfo file would make use of it.
|
||||
*/
|
||||
|
||||
/* Source linux/fs/proc/mmu.c */
|
||||
#ifndef HAVE_GET_VMALLOC_INFO
|
||||
#ifdef CONFIG_MMU
|
||||
|
||||
struct vmalloc_info {
|
||||
unsigned long used;
|
||||
unsigned long largest_chunk;
|
||||
};
|
||||
|
||||
typedef void (*get_vmalloc_info_t)(struct vmalloc_info *);
|
||||
extern get_vmalloc_info_t get_vmalloc_info_fn;
|
||||
|
||||
# define VMEM_ALLOC 0x01
|
||||
# define VMEM_FREE 0x02
|
||||
# define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START)
|
||||
# define get_vmalloc_info(vmi) get_vmalloc_info_fn(vmi)
|
||||
#else
|
||||
# error "CONFIG_MMU must be defined"
|
||||
#endif /* CONFIG_MMU */
|
||||
#endif /* HAVE_GET_VMALLOC_INFO */
|
||||
|
||||
/* Source linux/mm/mmzone.c */
|
||||
#ifndef HAVE_FIRST_ONLINE_PGDAT
|
||||
typedef struct pglist_data *(*first_online_pgdat_t)(void);
|
||||
extern first_online_pgdat_t first_online_pgdat_fn;
|
||||
#define first_online_pgdat() first_online_pgdat_fn()
|
||||
#endif /* HAVE_FIRST_ONLINE_PGDAT */
|
||||
|
||||
/* Source linux/mm/mmzone.c */
|
||||
#ifndef HAVE_NEXT_ONLINE_PGDAT
|
||||
typedef struct pglist_data *(*next_online_pgdat_t)(struct pglist_data *);
|
||||
extern next_online_pgdat_t next_online_pgdat_fn;
|
||||
#define next_online_pgdat(pgd) next_online_pgdat_fn(pgd)
|
||||
#endif /* HAVE_NEXT_ONLINE_PGDAT */
|
||||
|
||||
/* Source linux/mm/mmzone.c */
|
||||
#ifndef HAVE_NEXT_ZONE
|
||||
typedef struct zone *(*next_zone_t)(struct zone *);
|
||||
extern next_zone_t next_zone_fn;
|
||||
#define next_zone(zone) next_zone_fn(zone)
|
||||
#endif /* HAVE_NEXT_ZONE */
|
||||
|
||||
/* Source linux/mm/vmstat.c */
|
||||
#ifndef HAVE_GET_ZONE_COUNTS
|
||||
typedef void (*get_zone_counts_t)(unsigned long *, unsigned long *,
|
||||
unsigned long *);
|
||||
extern get_zone_counts_t get_zone_counts_fn;
|
||||
#define get_zone_counts(a,i,f) get_zone_counts_fn(a,i,f)
|
||||
#endif /* HAVE_GET_ZONE_COUNTS */
|
||||
|
||||
|
||||
#define xcopyin(from, to, size) copy_from_user(to, from, size)
|
||||
#define xcopyout(from, to, size) copy_to_user(to, from, size)
|
||||
|
||||
|
|
|
@ -54,6 +54,10 @@ EXPORT_SYMBOL(hw_serial);
|
|||
int p0 = 0;
|
||||
EXPORT_SYMBOL(p0);
|
||||
|
||||
#ifndef HAVE_KALLSYMS_LOOKUP_NAME
|
||||
kallsyms_lookup_name_t spl_kallsyms_lookup_name_fn = NULL;
|
||||
#endif
|
||||
|
||||
int
|
||||
highbit(unsigned long i)
|
||||
{
|
||||
|
@ -269,6 +273,42 @@ zone_get_hostid(void *zone)
|
|||
}
|
||||
EXPORT_SYMBOL(zone_get_hostid);
|
||||
|
||||
#ifdef HAVE_KALLSYMS_LOOKUP_NAME
|
||||
#define set_kallsyms_lookup_name() (0)
|
||||
#else
|
||||
/*
|
||||
* Because kallsyms_lookup_name() is no longer exported in the
|
||||
* mainline kernel we are forced to resort to somewhat drastic
|
||||
* measures. This function replaces the functionality by performing
|
||||
* an upcall to user space where /proc/kallsyms is consulted for
|
||||
* the requested address.
|
||||
*/
|
||||
#define GET_KALLSYMS_ADDR_CMD \
|
||||
"awk '{ if ( $3 == \"kallsyms_lookup_name\") { print $1 } }' " \
|
||||
"/proc/kallsyms >/proc/sys/kernel/spl/kallsyms_lookup_name"
|
||||
|
||||
static int
|
||||
set_kallsyms_lookup_name(void)
|
||||
{
|
||||
char sh_path[] = "/bin/sh";
|
||||
char *argv[] = { sh_path,
|
||||
"-c",
|
||||
GET_KALLSYMS_ADDR_CMD,
|
||||
NULL };
|
||||
char *envp[] = { "HOME=/",
|
||||
"TERM=linux",
|
||||
"PATH=/sbin:/usr/sbin:/bin:/usr/bin",
|
||||
NULL };
|
||||
int rc;
|
||||
|
||||
rc = call_usermodehelper(sh_path, argv, envp, 1);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
return spl_kmem_init_kallsyms_lookup();
|
||||
}
|
||||
#endif
|
||||
|
||||
static int __init spl_init(void)
|
||||
{
|
||||
int rc = 0;
|
||||
|
@ -297,6 +337,9 @@ static int __init spl_init(void)
|
|||
if ((rc = set_hostid()))
|
||||
GOTO(out7, rc = -EADDRNOTAVAIL);
|
||||
|
||||
if ((rc = set_kallsyms_lookup_name()))
|
||||
GOTO(out7, rc = -EADDRNOTAVAIL);
|
||||
|
||||
printk("SPL: Loaded Solaris Porting Layer v%s\n", VERSION);
|
||||
RETURN(rc);
|
||||
out7:
|
||||
|
|
|
@ -79,85 +79,29 @@ EXPORT_SYMBOL(zio_alloc_arena);
|
|||
vmem_t *zio_arena = NULL;
|
||||
EXPORT_SYMBOL(zio_arena);
|
||||
|
||||
#ifndef HAVE_GET_VMALLOC_INFO
|
||||
get_vmalloc_info_t get_vmalloc_info_fn = NULL;
|
||||
EXPORT_SYMBOL(get_vmalloc_info_fn);
|
||||
#endif /* HAVE_GET_VMALLOC_INFO */
|
||||
|
||||
#ifndef HAVE_FIRST_ONLINE_PGDAT
|
||||
struct pglist_data *
|
||||
first_online_pgdat(void)
|
||||
{
|
||||
return NODE_DATA(first_online_node);
|
||||
}
|
||||
EXPORT_SYMBOL(first_online_pgdat);
|
||||
first_online_pgdat_t first_online_pgdat_fn = NULL;
|
||||
EXPORT_SYMBOL(first_online_pgdat_fn);
|
||||
#endif /* HAVE_FIRST_ONLINE_PGDAT */
|
||||
|
||||
#ifndef HAVE_NEXT_ONLINE_PGDAT
|
||||
struct pglist_data *
|
||||
next_online_pgdat(struct pglist_data *pgdat)
|
||||
{
|
||||
int nid = next_online_node(pgdat->node_id);
|
||||
|
||||
if (nid == MAX_NUMNODES)
|
||||
return NULL;
|
||||
|
||||
return NODE_DATA(nid);
|
||||
}
|
||||
EXPORT_SYMBOL(next_online_pgdat);
|
||||
next_online_pgdat_t next_online_pgdat_fn = NULL;
|
||||
EXPORT_SYMBOL(next_online_pgdat_fn);
|
||||
#endif /* HAVE_NEXT_ONLINE_PGDAT */
|
||||
|
||||
#ifndef HAVE_NEXT_ZONE
|
||||
struct zone *
|
||||
next_zone(struct zone *zone)
|
||||
{
|
||||
pg_data_t *pgdat = zone->zone_pgdat;
|
||||
|
||||
if (zone < pgdat->node_zones + MAX_NR_ZONES - 1)
|
||||
zone++;
|
||||
else {
|
||||
pgdat = next_online_pgdat(pgdat);
|
||||
if (pgdat)
|
||||
zone = pgdat->node_zones;
|
||||
else
|
||||
zone = NULL;
|
||||
}
|
||||
return zone;
|
||||
}
|
||||
EXPORT_SYMBOL(next_zone);
|
||||
next_zone_t next_zone_fn = NULL;
|
||||
EXPORT_SYMBOL(next_zone_fn);
|
||||
#endif /* HAVE_NEXT_ZONE */
|
||||
|
||||
#ifndef HAVE_GET_ZONE_COUNTS
|
||||
void
|
||||
__get_zone_counts(unsigned long *active, unsigned long *inactive,
|
||||
unsigned long *free, struct pglist_data *pgdat)
|
||||
{
|
||||
struct zone *zones = pgdat->node_zones;
|
||||
int i;
|
||||
|
||||
*active = 0;
|
||||
*inactive = 0;
|
||||
*free = 0;
|
||||
for (i = 0; i < MAX_NR_ZONES; i++) {
|
||||
*active += zones[i].nr_active;
|
||||
*inactive += zones[i].nr_inactive;
|
||||
*free += zones[i].free_pages;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
get_zone_counts(unsigned long *active, unsigned long *inactive,
|
||||
unsigned long *free)
|
||||
{
|
||||
struct pglist_data *pgdat;
|
||||
|
||||
*active = 0;
|
||||
*inactive = 0;
|
||||
*free = 0;
|
||||
for_each_online_pgdat(pgdat) {
|
||||
unsigned long l, m, n;
|
||||
__get_zone_counts(&l, &m, &n, pgdat);
|
||||
*active += l;
|
||||
*inactive += m;
|
||||
*free += n;
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(get_zone_counts);
|
||||
get_zone_counts_t get_zone_counts_fn = NULL;
|
||||
EXPORT_SYMBOL(get_zone_counts_fn);
|
||||
#endif /* HAVE_GET_ZONE_COUNTS */
|
||||
|
||||
pgcnt_t
|
||||
|
@ -177,11 +121,20 @@ EXPORT_SYMBOL(spl_kmem_availrmem);
|
|||
size_t
|
||||
vmem_size(vmem_t *vmp, int typemask)
|
||||
{
|
||||
/* Arena's unsupported */
|
||||
struct vmalloc_info vmi;
|
||||
size_t size = 0;
|
||||
|
||||
ASSERT(vmp == NULL);
|
||||
ASSERT(typemask & (VMEM_ALLOC | VMEM_FREE));
|
||||
|
||||
return 0;
|
||||
get_vmalloc_info(&vmi);
|
||||
if (typemask & VMEM_ALLOC)
|
||||
size += (size_t)vmi.used;
|
||||
|
||||
if (typemask & VMEM_FREE)
|
||||
size += (size_t)(VMALLOC_TOTAL - vmi.used);
|
||||
|
||||
return size;
|
||||
}
|
||||
EXPORT_SYMBOL(vmem_size);
|
||||
|
||||
|
@ -1812,6 +1765,57 @@ spl_kmem_init_globals(void)
|
|||
swapfs_reserve = MIN(4*1024*1024 / PAGE_SIZE, physmem / 16);
|
||||
}
|
||||
|
||||
/*
|
||||
* Called at module init when it is safe to use spl_kallsyms_lookup_name()
|
||||
*/
|
||||
int
|
||||
spl_kmem_init_kallsyms_lookup(void)
|
||||
{
|
||||
#ifndef HAVE_GET_VMALLOC_INFO
|
||||
get_vmalloc_info_fn = (get_vmalloc_info_t)
|
||||
spl_kallsyms_lookup_name("get_vmalloc_info");
|
||||
if (!get_vmalloc_info_fn)
|
||||
return -EFAULT;
|
||||
#endif /* HAVE_GET_VMALLOC_INFO */
|
||||
|
||||
#ifndef HAVE_FIRST_ONLINE_PGDAT
|
||||
first_online_pgdat_fn = (first_online_pgdat_t)
|
||||
spl_kallsyms_lookup_name("first_online_pgdat");
|
||||
if (!first_online_pgdat_fn)
|
||||
return -EFAULT;
|
||||
#endif /* HAVE_FIRST_ONLINE_PGDAT */
|
||||
|
||||
#ifndef HAVE_NEXT_ONLINE_PGDAT
|
||||
next_online_pgdat_fn = (next_online_pgdat_t)
|
||||
spl_kallsyms_lookup_name("next_online_pgdat");
|
||||
if (!next_online_pgdat_fn)
|
||||
return -EFAULT;
|
||||
#endif /* HAVE_NEXT_ONLINE_PGDAT */
|
||||
|
||||
#ifndef HAVE_NEXT_ZONE
|
||||
next_zone_fn = (next_zone_t)
|
||||
spl_kallsyms_lookup_name("next_zone");
|
||||
if (!next_zone_fn)
|
||||
return -EFAULT;
|
||||
#endif /* HAVE_NEXT_ZONE */
|
||||
|
||||
#ifndef HAVE_GET_ZONE_COUNTS
|
||||
get_zone_counts_fn = (get_zone_counts_t)
|
||||
spl_kallsyms_lookup_name("get_zone_counts");
|
||||
if (!get_zone_counts_fn)
|
||||
return -EFAULT;
|
||||
#endif /* HAVE_GET_ZONE_COUNTS */
|
||||
|
||||
/*
|
||||
* It is now safe to initialize the global tunings which rely on
|
||||
* the use of the for_each_zone() macro. This macro in turns
|
||||
* depends on the *_pgdat symbols which are now available.
|
||||
*/
|
||||
spl_kmem_init_globals();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
spl_kmem_init(void)
|
||||
{
|
||||
|
@ -1820,7 +1824,6 @@ spl_kmem_init(void)
|
|||
|
||||
init_rwsem(&spl_kmem_cache_sem);
|
||||
INIT_LIST_HEAD(&spl_kmem_cache_list);
|
||||
spl_kmem_init_globals();
|
||||
|
||||
#ifdef HAVE_SET_SHRINKER
|
||||
spl_kmem_cache_shrinker = set_shrinker(KMC_DEFAULT_SEEKS,
|
||||
|
|
|
@ -68,6 +68,7 @@ struct proc_dir_entry *proc_spl_kstat = NULL;
|
|||
#define CTL_VERSION CTL_UNNUMBERED /* Version */
|
||||
#define CTL_HOSTID CTL_UNNUMBERED /* Host id by /usr/bin/hostid */
|
||||
#define CTL_HW_SERIAL CTL_UNNUMBERED /* HW serial number by hostid */
|
||||
#define CTL_KALLSYMS CTL_UNNUMBERED /* kallsyms_lookup_name addr */
|
||||
|
||||
#define CTL_DEBUG_SUBSYS CTL_UNNUMBERED /* Debug subsystem */
|
||||
#define CTL_DEBUG_MASK CTL_UNNUMBERED /* Debug mask */
|
||||
|
@ -123,6 +124,7 @@ enum {
|
|||
CTL_VERSION = 1, /* Version */
|
||||
CTL_HOSTID, /* Host id reported by /usr/bin/hostid */
|
||||
CTL_HW_SERIAL, /* Hardware serial number from hostid */
|
||||
CTL_KALLSYMS, /* Address of kallsyms_lookup_name */
|
||||
|
||||
CTL_DEBUG_SUBSYS, /* Debug subsystem */
|
||||
CTL_DEBUG_MASK, /* Debug mask */
|
||||
|
@ -489,6 +491,51 @@ proc_dohostid(struct ctl_table *table, int write, struct file *filp,
|
|||
RETURN(rc);
|
||||
}
|
||||
|
||||
#ifndef HAVE_KALLSYMS_LOOKUP_NAME
|
||||
static int
|
||||
proc_dokallsyms_lookup_name(struct ctl_table *table, int write,
|
||||
struct file *filp, void __user *buffer,
|
||||
size_t *lenp, loff_t *ppos) {
|
||||
int len, rc = 0;
|
||||
char *end, str[32];
|
||||
ENTRY;
|
||||
|
||||
if (write) {
|
||||
/* This may only be set once at module load time */
|
||||
if (spl_kallsyms_lookup_name_fn)
|
||||
RETURN(-EEXIST);
|
||||
|
||||
/* We can't use proc_doulongvec_minmax() in the write
|
||||
* case hear because the address while a hex value has no
|
||||
* leading 0x which confuses the helper function. */
|
||||
rc = proc_copyin_string(str, sizeof(str), buffer, *lenp);
|
||||
if (rc < 0)
|
||||
RETURN(rc);
|
||||
|
||||
spl_kallsyms_lookup_name_fn =
|
||||
(kallsyms_lookup_name_t)simple_strtoul(str, &end, 16);
|
||||
if (str == end)
|
||||
RETURN(-EINVAL);
|
||||
|
||||
*ppos += *lenp;
|
||||
} else {
|
||||
len = snprintf(str, sizeof(str), "%lx",
|
||||
(unsigned long)spl_kallsyms_lookup_name_fn);
|
||||
if (*ppos >= len)
|
||||
rc = 0;
|
||||
else
|
||||
rc = proc_copyout_string(buffer,*lenp,str+*ppos,"\n");
|
||||
|
||||
if (rc >= 0) {
|
||||
*lenp = rc;
|
||||
*ppos += rc;
|
||||
}
|
||||
}
|
||||
|
||||
RETURN(rc);
|
||||
}
|
||||
#endif /* HAVE_KALLSYMS_LOOKUP_NAME */
|
||||
|
||||
static int
|
||||
proc_doavailrmem(struct ctl_table *table, int write, struct file *filp,
|
||||
void __user *buffer, size_t *lenp, loff_t *ppos)
|
||||
|
@ -1018,6 +1065,16 @@ static struct ctl_table spl_table[] = {
|
|||
.mode = 0444,
|
||||
.proc_handler = &proc_dostring,
|
||||
},
|
||||
#ifndef HAVE_KALLSYMS_LOOKUP_NAME
|
||||
{
|
||||
.ctl_name = CTL_KALLSYMS,
|
||||
.procname = "kallsyms_lookup_name",
|
||||
.data = &spl_kallsyms_lookup_name_fn,
|
||||
.maxlen = sizeof(unsigned long),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dokallsyms_lookup_name,
|
||||
},
|
||||
#endif
|
||||
{
|
||||
.ctl_name = CTL_SPL_DEBUG,
|
||||
.procname = "debug",
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
Index: linux+rh+chaos/include/asm-x86_64/page.h
|
||||
===================================================================
|
||||
--- linux+rh+chaos.orig/include/asm-x86_64/page.h
|
||||
+++ linux+rh+chaos/include/asm-x86_64/page.h
|
||||
@@ -10,7 +10,7 @@
|
||||
#define PAGE_MASK (~(PAGE_SIZE-1))
|
||||
#define PHYSICAL_PAGE_MASK (~(PAGE_SIZE-1) & __PHYSICAL_MASK)
|
||||
|
||||
-#define THREAD_ORDER 1
|
||||
+#define THREAD_ORDER 2
|
||||
#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
|
||||
#define CURRENT_MASK (~(THREAD_SIZE-1))
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
Index: linux+rh+chaos/kernel/sched.c
|
||||
===================================================================
|
||||
--- linux+rh+chaos.orig/kernel/sched.c
|
||||
+++ linux+rh+chaos/kernel/sched.c
|
||||
@@ -1034,10 +1034,11 @@ static inline void resched_task(struct t
|
||||
* task_curr - is this task currently executing on a CPU?
|
||||
* @p: the task in question.
|
||||
*/
|
||||
-inline int task_curr(const struct task_struct *p)
|
||||
+int task_curr(const struct task_struct *p)
|
||||
{
|
||||
return cpu_curr(task_cpu(p)) == p;
|
||||
}
|
||||
+EXPORT_SYMBOL(task_curr); /* Request export upstream */
|
||||
|
||||
/* Used instead of source_load when we know the type == 0 */
|
||||
unsigned long weighted_cpuload(const int cpu)
|
||||
Index: linux+rh+chaos/kernel/time.c
|
||||
===================================================================
|
||||
--- linux+rh+chaos.orig/kernel/time.c
|
||||
+++ linux+rh+chaos/kernel/time.c
|
||||
@@ -605,6 +605,7 @@ void set_normalized_timespec(struct time
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = nsec;
|
||||
}
|
||||
+EXPORT_SYMBOL(set_normalized_timespec); /* Exported as of 2.6.26 */
|
||||
|
||||
/**
|
||||
* ns_to_timespec - Convert nanoseconds to timespec
|
||||
Index: linux+rh+chaos/kernel/kallsyms.c
|
||||
===================================================================
|
||||
--- linux+rh+chaos.orig/kernel/kallsyms.c
|
||||
+++ linux+rh+chaos/kernel/kallsyms.c
|
||||
@@ -154,6 +154,7 @@ unsigned long kallsyms_lookup_name(const
|
||||
}
|
||||
return module_kallsyms_lookup_name(name);
|
||||
}
|
||||
+EXPORT_SYMBOL(kallsyms_lookup_name); /* Exported prior to 2.6.19 */
|
||||
|
||||
/*
|
||||
* Lookup an address
|
||||
Index: linux+rh+chaos/fs/proc/mmu.c
|
||||
===================================================================
|
||||
--- linux+rh+chaos.orig/fs/proc/mmu.c
|
||||
+++ linux+rh+chaos/fs/proc/mmu.c
|
||||
@@ -75,3 +75,4 @@ void get_vmalloc_info(struct vmalloc_inf
|
||||
read_unlock(&vmlist_lock);
|
||||
}
|
||||
}
|
||||
+EXPORT_SYMBOL(get_vmalloc_info); /* Request clean upstream API for this */
|
||||
Index: linux+rh+chaos/mm/mmzone.c
|
||||
===================================================================
|
||||
--- linux+rh+chaos.orig/mm/mmzone.c
|
||||
+++ linux+rh+chaos/mm/mmzone.c
|
||||
@@ -14,7 +14,7 @@ struct pglist_data *first_online_pgdat(v
|
||||
return NODE_DATA(first_online_node);
|
||||
}
|
||||
|
||||
-EXPORT_UNUSED_SYMBOL(first_online_pgdat); /* June 2006 */
|
||||
+EXPORT_SYMBOL(first_online_pgdat); /* Exported prior to 2.6.18 */
|
||||
|
||||
struct pglist_data *next_online_pgdat(struct pglist_data *pgdat)
|
||||
{
|
||||
@@ -24,7 +24,7 @@ struct pglist_data *next_online_pgdat(st
|
||||
return NULL;
|
||||
return NODE_DATA(nid);
|
||||
}
|
||||
-EXPORT_UNUSED_SYMBOL(next_online_pgdat); /* June 2006 */
|
||||
+EXPORT_SYMBOL(next_online_pgdat); /* Exported prior to 2.6.18 */
|
||||
|
||||
|
||||
/*
|
||||
@@ -45,5 +45,5 @@ struct zone *next_zone(struct zone *zone
|
||||
}
|
||||
return zone;
|
||||
}
|
||||
-EXPORT_UNUSED_SYMBOL(next_zone); /* June 2006 */
|
||||
+EXPORT_SYMBOL(next_zone); /* Exported prior to 2.6.18 */
|
||||
|
||||
Index: linux+rh+chaos/mm/vmstat.c
|
||||
===================================================================
|
||||
--- linux+rh+chaos.orig/mm/vmstat.c
|
||||
+++ linux+rh+chaos/mm/vmstat.c
|
||||
@@ -45,6 +45,7 @@ void get_zone_counts(unsigned long *acti
|
||||
*free += n;
|
||||
}
|
||||
}
|
||||
+EXPORT_SYMBOL(get_zone_counts); /* Request clean upstream API for this */
|
||||
|
||||
#ifdef CONFIG_VM_EVENT_COUNTERS
|
||||
DEFINE_PER_CPU(struct vm_event_state, vm_event_states) = {{0}};
|
|
@ -1,12 +0,0 @@
|
|||
Index: linux+rh+chaos/kernel/sched.c
|
||||
===================================================================
|
||||
--- linux+rh+chaos.orig/kernel/sched.c
|
||||
+++ linux+rh+chaos/kernel/sched.c
|
||||
@@ -1038,6 +1038,7 @@ inline int task_curr(const struct task_s
|
||||
{
|
||||
return cpu_curr(task_cpu(p)) == p;
|
||||
}
|
||||
+EXPORT_SYMBOL(task_curr);
|
||||
|
||||
/* Used instead of source_load when we know the type == 0 */
|
||||
unsigned long weighted_cpuload(const int cpu)
|
|
@ -51,6 +51,9 @@
|
|||
/* fls64() is available */
|
||||
#undef HAVE_FLS64
|
||||
|
||||
/* get_vmalloc_info() is available */
|
||||
#undef HAVE_GET_VMALLOC_INFO
|
||||
|
||||
/* get_zone_counts() is available */
|
||||
#undef HAVE_GET_ZONE_COUNTS
|
||||
|
||||
|
@ -63,6 +66,9 @@
|
|||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* kallsyms_lookup_name() is available */
|
||||
#undef HAVE_KALLSYMS_LOOKUP_NAME
|
||||
|
||||
/* kmalloc_node() is available */
|
||||
#undef HAVE_KMALLOC_NODE
|
||||
|
||||
|
|
Loading…
Reference in New Issue