Page MenuHomeFreeBSD

Define RB parent assignment macros
ClosedPublic

Authored by dougm on Jun 14 2020, 7:57 AM.

Details

Summary

Define RB_SET_PARENT to do all assignments to rb parent pointers. Define RB_SWAP_CHILD to replace the child of a parent with its twin, and use it in 4 places, including rbtree.h. Use RB_SET in rb_link_node to remove the only linuxkpi reference to color, and then drop color- and parent-related definitions that are defined and used only in rbtree.h.

This is intended to be entirely cosmetic, with no impact on program behavior.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

dougm requested review of this revision.Jun 14 2020, 7:57 AM
dougm added reviewers: markj, hselasky.
dougm added a subscriber: pho.
===> linuxkpi (all)
cc  -O2 -pipe -fno-common  -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -DKLD_TIED -nostdinc  -I/usr/src/sys/compat/linuxkpi/common/include -I/usr/src/sys/contrib/ck/include -DHAVE_KERNEL_OPTION_HEADERS -include /usr/src/sys/amd64/compile/PHO/opt_global.h -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common -g -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include -I/usr/src/sys/amd64/compile/PHO     -MD  -MF.depend.linux_compat.o -MTlinux_compat.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -gdwarf-2 -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error-tautological-compare -Wno-error-empty-body -Wno-error-parentheses-equality -Wno-error-unused-function -Wno-error-pointer-sign -Wno-error-shift-negative-value -Wno-address-of-packed-member -Wno-format-zero-length   -mno-aes -mno-avx  -std=iso9899:1999 -c /usr/src/sys/compat/linuxkpi/common/src/linux_compat.c -o linux_compat.o
In file included from /usr/src/sys/compat/linuxkpi/common/src/linux_compat.c:103:
/usr/src/sys/compat/linuxkpi/common/include/linux/rbtree.h:87:2: error: no member named 'rbh_root' in 'struct rb_root'
        RB_SWAP_CHILD(root, victim, new, __entry);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/sys/tree.h:354:3: note: expanded from macro 'RB_SWAP_CHILD'
                RB_ROOT(head) = (in);                                   \
                ^~~~~~~~~~~~~
/usr/src/sys/sys/tree.h:325:33: note: expanded from macro 'RB_ROOT'
#define RB_ROOT(head)                   (head)->rbh_root
                                        ~~~~~~  ^
1 error generated.
*** Error code 1

Stop.
make[2]: stopped in /usr/src/sys/modules/linuxkpi
*** Error code 1

Stop.
make[1]: stopped in /usr/src/sys/modules
*** Error code 1

Stop.
make: stopped in /usr/src/sys/amd64/compile/PHO
[root@mercat1 /usr/src/sys/amd64/compile/PHO]# uname -a
FreeBSD mercat1.netperf.freebsd.org 13.0-CURRENT FreeBSD 13.0-CURRENT #0 r362171: Sun Jun 14 09:06:12 CEST 2020     pho@mercat1.netperf.freebsd.org:/usr/src/sys/amd64/compile/PHO  amd64
[root@mercat1 /usr/src/sys/amd64/compile/PHO]# ls -lrt /tmp/*.diff | tail -1
-rw-r--r--  1 pho   wheel   6105 Jun 14 10:23 /tmp/D25264.73097.diff
[root@mercat1 /usr/src/sys/amd64/compile/PHO]#

Add a cast to (struct linux_root *).

Take RB_SET_PARENT out of RB_SWAP_CHILD; it doesn't belong when the incoming child is NULL.

I completed a full stress2 test with D25264.73113.diff.
No problems seen.

Let me give this a spin on Monday with a mellanox.

You can also try to build the kernel like this:

make buildkernel WITH_OFED=YES

This revision is now accepted and ready to land.Jun 20 2020, 1:41 PM

Let me give this a spin on Monday with a mellanox.

How did the mellanox test come out?