On Wed, Nov 13, 2019 at 11:28 PM Thomas Gleixner firstname.lastname@example.org wrote:
On Fri, 8 Nov 2019, Arnd Bergmann wrote:
@@ -321,12 +321,12 @@ TRACE_EVENT(itimer_state, __entry->which = which; __entry->expires = expires; __entry->value_sec = value->it_value.tv_sec;
__entry->value_usec = value->it_value.tv_usec;
__entry->value_usec = value->it_value.tv_nsec / NSEC_PER_USEC; __entry->interval_sec = value->it_interval.tv_sec;
__entry->interval_usec = value->it_interval.tv_usec;
__entry->interval_usec = value->it_interval.tv_nsec / NSEC_PER_USEC;
Hmm, having a division in a tracepoint is clearly suboptimal.
Ok, moving it to the TP_printk() as Steven suggested.
TP_printk("which=%d expires=%llu it_value=%ld.%ld it_interval=%ld.%ld",
TP_printk("which=%d expires=%llu it_value=%ld.%06ld it_interval=%ld.%06ld",
We print only 6 digits after the . so that would be even correct w/o a division. But it probably does not matter much.
This is just a cosmetic fix, it can be a separate patch if you care. The idea is to print the numbers as normal decimal representation, e.g. 0.001000 for a millisecond instead of the nonstandard 0.1000.
@@ -197,19 +207,13 @@ static void set_cpu_itimer(struct task_struct *tsk, unsigned int clock_id, #define timeval_valid(t) \ (((t)->tv_sec >= 0) && (((unsigned long) (t)->tv_usec) < USEC_PER_SEC))
Hrm, why do we have yet another incarnation of timeval_valid()?
No idea, you have to ask the author of commit 7d99b7d634d8 ("[PATCH] Validate and sanitze itimer timeval from userspace") ;-)
Can we please have only one (the inline version)?
I'm removing the inline version in a later patch along with most of the rest of include/linux/time32.h.
Having the macro version is convenient for this patch, since I'm using it on two different structures (itimerval/__kernel_old_timeval and old_itimerval32/old_timeval32), neither of which is the type used in the inline function.
I could use two local inline functions instead of the macro, or just open code both call sites if you prefer that.