0

I've a question related to the use of ftrace on Linux kernel 4.15. ftrace is configured as follows:

mount -t debugfs nodev /sys/kernel/debug
echo funcgraph-proc > /sys/kernel/debug/tracing/trace_options
echo function_graph >/sys/kernel/debug/tracing/current_tracer
echo *gro_receive > /sys/kernel/debug/tracing/set_graph_function
echo > /sys/kernel/debug/tracing/trace
echo 1 >/sys/kernel/debug/tracing/tracing_on
sleep 2
echo 0 >/sys/kernel/debug/tracing/tracing_on
cat /sys/kernel/debug/tracing/trace > ./result.out

The following are two excerpts of the trace output (result.out).

0)  sleep-13890   =>    <idle>-0   
 ------------------------------------------

 0)    <idle>-0    |               |  napi_gro_receive() {
 0)    <idle>-0    |   0.255 us    |    skb_gro_reset_offset();
 0)    <idle>-0    |               |    dev_gro_receive() {
 0)    <idle>-0    |               |      inet_gro_receive() {
 0)    <idle>-0    |               |        tcp4_gro_receive() {
 0)    <idle>-0    |   0.307 us    |          tcp_gro_receive();
 0)    <idle>-0    |   1.007 us    |        }
 0)    <idle>-0    |   1.725 us    |      }
 0)    <idle>-0    |   2.396 us    |    }
 0)    <idle>-0    |               |    netif_receive_skb_internal() {
 0)    <idle>-0    |   0.171 us    |      ktime_get_with_offset();
 0)    <idle>-0    |   0.174 us    |      skb_defer_rx_timestamp();
 0)    <idle>-0    |               |      __netif_receive_skb() {
 0)    <idle>-0    |               |        __netif_receive_skb_core() {
 0)    <idle>-0    |               |          tpacket_rcv() {


 1)    <idle>-0    =>   ksoftir-17  
 ------------------------------------------

 1)   ksoftir-17   |   0.327 us    |  finish_task_switch();
 1)   ksoftir-17   |               |  napi_gro_receive() {
 1)   ksoftir-17   |   0.238 us    |    skb_gro_reset_offset();
 1)   ksoftir-17   |               |    dev_gro_receive() {
 1)   ksoftir-17   |   0.166 us    |      inet_gro_receive();
 1)   ksoftir-17   |   0.472 us    |    }
 1)   ksoftir-17   |               |    netif_receive_skb_internal() {
 1)   ksoftir-17   |   0.178 us    |      ktime_get_with_offset();
 1)   ksoftir-17   |   0.143 us    |      skb_defer_rx_timestamp();
 1)   ksoftir-17   |               |      __netif_receive_skb() {
 1)   ksoftir-17   |               |        __netif_receive_skb_core() {
 1)   ksoftir-17   |               |          tpacket_rcv() {

As you can see the calls to napi_gro_receive() are shown as in the context of different processes. From my understanding it should be always called in the context of a ksoftirq, but I can see it just in the 2nd occurrence in the trace.

Is the above the expected behavior ? Thanks.

1 Answer 1

0

napi_gro_receive is part of under BH context The portion of interrupt processing that is performed on the high priority work queue with interrupts enabled is referred to as Bottom Half Interrupt processing.

Sign up to request clarification or add additional context in comments.

2 Comments

Sorry, from this stackoverflow.com/questions/12258333/… Bottom Halves (BH) do not execute in interrupt context. So if napi_gro_receive was under BH it should be always executed under ksoftirq--xx kernel thread context.
I see some comment for source,I think I also need to spend some time understanding the relevant code and context /* called under BH context */ static int gro_cell_poll(struct napi_struct *napi, int budget) { struct gro_cell *cell = container_of(napi, struct gro_cell, napi); struct sk_buff *skb; int work_done = 0; while (work_done < budget) { skb = __skb_dequeue(&cell->napi_skbs); if (!skb) break; napi_gro_receive(napi, skb); work_done++; } if (work_done < budget) napi_complete_done(napi, work_done); return work_done; }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.