* Re: [PATCH net-next v6 0/4] net/sched: retpoline wrappers for tc [not found] <20221206135513.1904815-1-pctammela@mojatatu.com> @ 2022-12-27 8:33 ` Rudi Heitbaum 2022-12-27 12:24 ` Pedro Tammela 0 siblings, 1 reply; 3+ messages in thread From: Rudi Heitbaum @ 2022-12-27 8:33 UTC (permalink / raw) To: Pedro Tammela, netdev Cc: davem, edumazet, kuba, pabeni, jhs, xiyou.wangcong, jiri, kuniyu, linux-kernel Hi Pedro, Compiling kernel 6.2-rc1 fails on x86_64 when CONFIG_NET_CLS or CONFIG_NET_CLS_ACT is not set, when CONFIG_RETPOLINE=y is set. Does tc_wrapper RETPOLINE need a dependency on NET_CLS/NET_CLS_ACT to be added? Or a default? net/sched/sch_api.c: In function 'pktsched_init': net/sched/sch_api.c:2306:9: error: implicit declaration of function 'tc_wrapper_init' [-Werror=implicit-function-declaration] 2306 | tc_wrapper_init(); | ^~~~~~~~~~~~~~~ cc1: some warnings being treated as errors make[3]: *** [scripts/Makefile.build:252: net/sched/sch_api.o] Error 1 make[2]: *** [scripts/Makefile.build:504: net/sched] Error 2 make[1]: *** [scripts/Makefile.build:504: net] Error 2 below is the relevent lines from the .config file. $ grep -e RETPOLINE -e NET_CLS projects/Generic/linux/linux.x86_64.conf CONFIG_RETPOLINE=y # CONFIG_NET_CLS_BASIC is not set # CONFIG_NET_CLS_TCINDEX is not set # CONFIG_NET_CLS_ROUTE4 is not set # CONFIG_NET_CLS_FW is not set # CONFIG_NET_CLS_U32 is not set # CONFIG_NET_CLS_RSVP is not set # CONFIG_NET_CLS_RSVP6 is not set # CONFIG_NET_CLS_FLOW is not set # CONFIG_NET_CLS_CGROUP is not set # CONFIG_NET_CLS_BPF is not set # CONFIG_NET_CLS_FLOWER is not set # CONFIG_NET_CLS_MATCHALL is not set # CONFIG_NET_CLS_ACT is not set On Tue, Dec 06, 2022 at 10:55:09AM -0300, Pedro Tammela wrote: > In tc all qdics, classifiers and actions can be compiled as modules. > This results today in indirect calls in all transitions in the tc hierarchy. > Due to CONFIG_RETPOLINE, CPUs with mitigations=on might pay an extra cost on > indirect calls. For newer Intel cpus with IBRS the extra cost is > nonexistent, but AMD Zen cpus and older x86 cpus still go through the > retpoline thunk. > > Known built-in symbols can be optimized into direct calls, thus > avoiding the retpoline thunk. So far, tc has not been leveraging this > build information and leaving out a performance optimization for some > CPUs. In this series we wire up 'tcf_classify()' and 'tcf_action_exec()' > with direct calls when known modules are compiled as built-in as an > opt-in optimization. > > We measured these changes in one AMD Zen 4 cpu (Retpoline), one AMD Zen 3 cpu (Retpoline), > one Intel 10th Gen CPU (IBRS), one Intel 3rd Gen cpu (Retpoline) and one > Intel Xeon CPU (IBRS) using pktgen with 64b udp packets. Our test setup is a > dummy device with clsact and matchall in a kernel compiled with every > tc module as built-in. We observed a 3-8% speed up on the retpoline CPUs, > when going through 1 tc filter, and a 60-100% speed up when going through 100 filters. > For the IBRS cpus we observed a 1-2% degradation in both scenarios, we believe > the extra branches check introduced a small overhead therefore we added > a static key that bypasses the wrapper on kernels not using the retpoline mitigation, > but compiled with CONFIG_RETPOLINE. ... ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v6 0/4] net/sched: retpoline wrappers for tc 2022-12-27 8:33 ` [PATCH net-next v6 0/4] net/sched: retpoline wrappers for tc Rudi Heitbaum @ 2022-12-27 12:24 ` Pedro Tammela 2022-12-27 13:47 ` Rudi Heitbaum 0 siblings, 1 reply; 3+ messages in thread From: Pedro Tammela @ 2022-12-27 12:24 UTC (permalink / raw) To: Rudi Heitbaum, netdev Cc: davem, edumazet, kuba, pabeni, jhs, xiyou.wangcong, jiri, kuniyu, linux-kernel On 27/12/2022 05:33, Rudi Heitbaum wrote: > Hi Pedro, > > Compiling kernel 6.2-rc1 fails on x86_64 when CONFIG_NET_CLS or > CONFIG_NET_CLS_ACT is not set, when CONFIG_RETPOLINE=y is set. > > Does tc_wrapper RETPOLINE need a dependency on NET_CLS/NET_CLS_ACT > to be added? Or a default? > > net/sched/sch_api.c: In function 'pktsched_init': > net/sched/sch_api.c:2306:9: error: implicit declaration of function > 'tc_wrapper_init' [-Werror=implicit-function-declaration] > 2306 | tc_wrapper_init(); > | ^~~~~~~~~~~~~~~ > cc1: some warnings being treated as errors > make[3]: *** [scripts/Makefile.build:252: net/sched/sch_api.o] Error 1 > make[2]: *** [scripts/Makefile.build:504: net/sched] Error 2 > make[1]: *** [scripts/Makefile.build:504: net] Error 2 > > below is the relevent lines from the .config file. > > $ grep -e RETPOLINE -e NET_CLS projects/Generic/linux/linux.x86_64.conf > CONFIG_RETPOLINE=y > # CONFIG_NET_CLS_BASIC is not set > # CONFIG_NET_CLS_TCINDEX is not set > # CONFIG_NET_CLS_ROUTE4 is not set > # CONFIG_NET_CLS_FW is not set > # CONFIG_NET_CLS_U32 is not set > # CONFIG_NET_CLS_RSVP is not set > # CONFIG_NET_CLS_RSVP6 is not set > # CONFIG_NET_CLS_FLOW is not set > # CONFIG_NET_CLS_CGROUP is not set > # CONFIG_NET_CLS_BPF is not set > # CONFIG_NET_CLS_FLOWER is not set > # CONFIG_NET_CLS_MATCHALL is not set > # CONFIG_NET_CLS_ACT is not set > Hi Rudi, Thanks for the report. Could you try the following patch? diff --git a/include/net/tc_wrapper.h b/include/net/tc_wrapper.h index ceed2fc089ff..d323fffb839a 100644 --- a/include/net/tc_wrapper.h +++ b/include/net/tc_wrapper.h @@ -216,6 +216,8 @@ static inline int tc_classify(struct sk_buff *skb, const struct tcf_proto *tp, return tp->classify(skb, tp, res); } +#endif /* CONFIG_NET_CLS */ + static inline void tc_wrapper_init(void) { #ifdef CONFIG_X86 @@ -224,8 +226,6 @@ static inline void tc_wrapper_init(void) #endif } -#endif /* CONFIG_NET_CLS */ - #else #define TC_INDIRECT_SCOPE static ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v6 0/4] net/sched: retpoline wrappers for tc 2022-12-27 12:24 ` Pedro Tammela @ 2022-12-27 13:47 ` Rudi Heitbaum 0 siblings, 0 replies; 3+ messages in thread From: Rudi Heitbaum @ 2022-12-27 13:47 UTC (permalink / raw) To: Pedro Tammela Cc: netdev, davem, edumazet, kuba, pabeni, jhs, xiyou.wangcong, jiri, kuniyu, linux-kernel On Tue, Dec 27, 2022 at 09:24:22AM -0300, Pedro Tammela wrote: > On 27/12/2022 05:33, Rudi Heitbaum wrote: > > Hi Pedro, > > > > Compiling kernel 6.2-rc1 fails on x86_64 when CONFIG_NET_CLS or > > CONFIG_NET_CLS_ACT is not set, when CONFIG_RETPOLINE=y is set. ... > Hi Rudi, > > Thanks for the report. > Could you try the following patch? > > diff --git a/include/net/tc_wrapper.h b/include/net/tc_wrapper.h > index ceed2fc089ff..d323fffb839a 100644 > --- a/include/net/tc_wrapper.h > +++ b/include/net/tc_wrapper.h > @@ -216,6 +216,8 @@ static inline int tc_classify(struct sk_buff *skb, const > struct tcf_proto *tp, > return tp->classify(skb, tp, res); > } > > +#endif /* CONFIG_NET_CLS */ > + > static inline void tc_wrapper_init(void) > { > #ifdef CONFIG_X86 > @@ -224,8 +226,6 @@ static inline void tc_wrapper_init(void) > #endif > } > > -#endif /* CONFIG_NET_CLS */ > - > #else > > #define TC_INDIRECT_SCOPE static Hi Pedro, I had to adjust it slightly to apply cleanly. But works correctly with my .config now. Thanks Rudi Tested-by: Rudi Heitbaum <rudi@heitbaum.com> diff --git a/include/net/tc_wrapper.h b/include/net/tc_wrapper.h index ceed2fc089ff..d323fffb839a 100644 --- a/include/net/tc_wrapper.h +++ b/include/net/tc_wrapper.h @@ -216,6 +216,8 @@ return tp->classify(skb, tp, res); } +#endif /* CONFIG_NET_CLS */ + static inline void tc_wrapper_init(void) { #ifdef CONFIG_X86 @@ -224,8 +226,6 @@ #endif } -#endif /* CONFIG_NET_CLS */ - #else #define TC_INDIRECT_SCOPE static ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-27 13:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20221206135513.1904815-1-pctammela@mojatatu.com>
2022-12-27 8:33 ` [PATCH net-next v6 0/4] net/sched: retpoline wrappers for tc Rudi Heitbaum
2022-12-27 12:24 ` Pedro Tammela
2022-12-27 13:47 ` Rudi Heitbaum
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox