--- zzzz-none-000/linux-4.9.279/kernel/softirq.c 2021-08-08 06:38:54.000000000 +0000 +++ puma7-atom-6591-750/linux-4.9.279/kernel/softirq.c 2023-02-08 11:43:43.000000000 +0000 @@ -26,6 +26,8 @@ #include #include #include +#include +#include #define CREATE_TRACE_POINTS #include @@ -264,6 +266,7 @@ __local_bh_disable_ip(_RET_IP_, SOFTIRQ_OFFSET); in_hardirq = lockdep_softirq_start(); + avm_sum_softirq_enter(); restart: /* Reset the pending bitmask before enabling irqs */ @@ -274,6 +277,7 @@ h = softirq_vec; while ((softirq_bit = ffs(pending))) { + struct _runtime_stat *pts; unsigned int vec_nr; int prev_count; @@ -284,9 +288,15 @@ kstat_incr_softirqs_this_cpu(vec_nr); + avm_simple_profiling_log(avm_profile_data_type_sw_irq_begin, + (unsigned long)(h->action), (unsigned int)h); trace_softirq_entry(vec_nr); + pts = avm_softirq_enter(vec_nr); h->action(h); + avm_softirq_leave(pts); trace_softirq_exit(vec_nr); + avm_simple_profiling_log(avm_profile_data_type_sw_irq_end, + (unsigned long)(h->action), (unsigned int)h); if (unlikely(prev_count != preempt_count())) { pr_err("huh, entered softirq %u %s %p with preempt_count %08x, exited with %08x?\n", vec_nr, softirq_to_name[vec_nr], h->action, @@ -309,6 +319,7 @@ wakeup_softirqd(); } + avm_sum_softirq_leave(); lockdep_softirq_end(in_hardirq); account_irq_exit_time(current); __local_bh_enable(SOFTIRQ_OFFSET); @@ -472,6 +483,8 @@ t->next = NULL; *__this_cpu_read(tasklet_vec.tail) = t; __this_cpu_write(tasklet_vec.tail, &(t->next)); + avm_simple_profiling_log(avm_profile_data_type_trigger_tasklet_begin, + (unsigned long)(t->func), TASKLET_SOFTIRQ); raise_softirq_irqoff(TASKLET_SOFTIRQ); local_irq_restore(flags); } @@ -485,6 +498,8 @@ t->next = NULL; *__this_cpu_read(tasklet_hi_vec.tail) = t; __this_cpu_write(tasklet_hi_vec.tail, &(t->next)); + avm_simple_profiling_log(avm_profile_data_type_trigger_tasklet_begin, + (unsigned long)(t->func), HI_SOFTIRQ); raise_softirq_irqoff(HI_SOFTIRQ); local_irq_restore(flags); } @@ -511,6 +526,7 @@ local_irq_enable(); while (list) { + struct _runtime_stat *pfunc_stat; struct tasklet_struct *t = list; list = list->next; @@ -520,7 +536,16 @@ if (!test_and_clear_bit(TASKLET_STATE_SCHED, &t->state)) BUG(); + avm_simple_profiling_log(avm_profile_data_type_trigger_tasklet_end, + (unsigned long)(t->func), TASKLET_SOFTIRQ); + avm_simple_profiling_log(avm_profile_data_type_tasklet_begin, + (unsigned long)(t->func), (unsigned int)(t->data)); + pfunc_stat = avm_taskletfunc_enter(t->func, TASKLET_SOFTIRQ); t->func(t->data); + avm_taskletfunc_leave(pfunc_stat); + avm_simple_profiling_log(avm_profile_data_type_tasklet_end, + (unsigned long)(t->func), (unsigned int)(t->data)); + tasklet_unlock(t); continue; } @@ -547,6 +572,7 @@ local_irq_enable(); while (list) { + struct _runtime_stat *pfunc_stat; struct tasklet_struct *t = list; list = list->next; @@ -556,7 +582,15 @@ if (!test_and_clear_bit(TASKLET_STATE_SCHED, &t->state)) BUG(); + avm_simple_profiling_log(avm_profile_data_type_trigger_tasklet_end, + (unsigned long)(t->func), HI_SOFTIRQ); + avm_simple_profiling_log(avm_profile_data_type_hi_tasklet_begin, + (unsigned long)(t->func), (unsigned int)(t->data)); + pfunc_stat = avm_taskletfunc_enter(t->func, HI_SOFTIRQ); t->func(t->data); + avm_taskletfunc_leave(pfunc_stat); + avm_simple_profiling_log(avm_profile_data_type_hi_tasklet_end, + (unsigned long)(t->func), (unsigned int)(t->data)); tasklet_unlock(t); continue; }