Message ID | bccd2311-79fa-9d88-3c10-067c2438574d@mojatatu.com |
---|---|
State | RFC |
Delegated to: | David Miller |
Headers | show |
Series | rcu build on bug | expand |
More clarification - this: --- diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c index ec945294626a..06510c8c8281 100644 --- a/net/sched/cls_fw.c +++ b/net/sched/cls_fw.c @@ -22,12 +22,12 @@ #include <net/pkt_cls.h> #include <net/sch_generic.h> -#define HTSIZE 256 +#define HTSIZE 4096 struct fw_head { + struct rcu_head rcu; u32 mask; struct fw_filter __rcu *ht[HTSIZE]; - struct rcu_head rcu; }; ---- Does not fix it.. cheers, jamal On 2020-08-07 11:16 a.m., Jamal Hadi Salim wrote: > > Made this small change: > > ------ > diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c > index ec945294626a..75d43ed10cd8 100644 > --- a/net/sched/cls_fw.c > +++ b/net/sched/cls_fw.c > @@ -22,7 +22,7 @@ > #include <net/pkt_cls.h> > #include <net/sch_generic.h> > > -#define HTSIZE 256 > +#define HTSIZE 4096 > > struct fw_head { > u32 mask; > --------- > > Generated compile errors as follows: > > ------------ > DESCEND objtool > CALL scripts/atomic/check-atomics.sh > CALL scripts/checksyscalls.sh > CHK include/generated/compile.h > CC net/sched/cls_fw.o > In file included from ./include/linux/export.h:43:0, > from ./include/linux/linkage.h:7, > from ./include/linux/kernel.h:8, > from ./include/linux/list.h:9, > from ./include/linux/module.h:12, > from net/sched/cls_fw.c:13: > net/sched/cls_fw.c: In function ‘fw_destroy’: > ./include/linux/compiler.h:392:38: error: call to > ‘__compiletime_assert_415’ declared with attribute error: BUILD_BUG_ON > failed: !__is_kfree_rcu_offset(__builtin_offsetof(typeof(*(head)), rcu)) > _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) > ^ > ./include/linux/compiler.h:373:4: note: in definition of macro > ‘__compiletime_assert’ > prefix ## suffix(); \ > ^~~~~~ > ./include/linux/compiler.h:392:2: note: in expansion of macro > ‘_compiletime_assert’ > _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) > ^~~~~~~~~~~~~~~~~~~ > ./include/linux/build_bug.h:39:37: note: in expansion of macro > ‘compiletime_assert’ > #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) > ^~~~~~~~~~~~~~~~~~ > ./include/linux/build_bug.h:50:2: note: in expansion of macro > ‘BUILD_BUG_ON_MSG’ > BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) > ^~~~~~~~~~~~~~~~ > ./include/linux/rcupdate.h:840:3: note: in expansion of macro > ‘BUILD_BUG_ON’ > BUILD_BUG_ON(!__is_kfree_rcu_offset(offset)); \ > ^~~~~~~~~~~~ > ./include/linux/rcupdate.h:875:3: note: in expansion of macro ‘__kfree_rcu’ > __kfree_rcu(&((___p)->rhf), offsetof(typeof(*(ptr)), rhf)); \ > ^~~~~~~~~~~ > net/sched/cls_fw.c:151:2: note: in expansion of macro ‘kfree_rcu’ > kfree_rcu(head, rcu); > ^~~~~~~~~ > scripts/Makefile.build:280: recipe for target 'net/sched/cls_fw.o' failed > make[2]: *** [net/sched/cls_fw.o] Error 1 > scripts/Makefile.build:497: recipe for target 'net/sched' failed > make[1]: *** [net/sched] Error 2 > Makefile:1771: recipe for target 'net' failed > make: *** [net] Error 2 > make: *** Waiting for unfinished jobs.... > > ---------------- > > Gets fixed if i reduce the hash buckets of course. > Looking at include/linux/rcupdate.h I see: > > ------ > /* > * Does the specified offset indicate that the corresponding rcu_head > * structure can be handled by kfree_rcu()? > */ > #define __is_kfree_rcu_offset(offset) ((offset) < 4096) > > ------ > > I am guessing the hash table got too large. > Smells like hard coded expectation? > > How to fix? > > cheers, > jamal
On Fri, Aug 7, 2020 at 8:16 AM Jamal Hadi Salim <jhs@mojatatu.com> wrote: > > I am guessing the hash table got too large. > Smells like hard coded expectation? Yeah, that is literally how kfree_rcu() works. > > How to fix? I guess you just have to wrap up kfree() and pass it to call_rcu(). Thanks.
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c index ec945294626a..75d43ed10cd8 100644 --- a/net/sched/cls_fw.c +++ b/net/sched/cls_fw.c @@ -22,7 +22,7 @@ #include <net/pkt_cls.h> #include <net/sch_generic.h> -#define HTSIZE 256 +#define HTSIZE 4096 struct fw_head { u32 mask;