lkml.org 
[lkml]   [2012]   [Jun]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [tip:perf/core] perf/x86: Add generic Intel uncore PMU support
On Thu, 21 Jun 2012 15:47:49 -0700
"H. Peter Anvin" <hpa@zytor.com> wrote:

> On 06/21/2012 03:43 PM, Andrew Morton wrote:
> >
> > Regardless of that, we have some head-scratching to do:
> >
> >
> > #define UNCORE_PMU_HRTIMER_INTERVAL (60 * NSEC_PER_SEC)
> >
> > and
> >
> > #define NSEC_PER_SEC 1000000000L
> >
> > and 60 billion doesn't fit in 32 bits. So do we fix the
> > perf_event_intel_uncore.c callsites? Or do we fix the
> > UNCORE_PMU_HRTIMER_INTERVAL definition? Or do we fix the NSEC_PER_SEC
> > definition?
> >
> > I'm thinking perhaps the latter. What *is* the type of a nanosecond in
> > Linux? include/linux/ktime.h is pretty insistent that it is u64. If
> > so, NSEC_PER_SEC should logically have type ULL. But changing both its
> > size and signedness is a pretty big change.
>
> We could change the size only. The range from 9223372036.854775808 to
> 18446744073.709551615 seconds (292-584 years) isn't really that significant.
>

What *is* significant is the effect of a signedness change upon
arithmetic, conversions, warnings, etc. And whether such a change
might actually introduce bugs.


Back away and ask the broader questions: why did ktime_t choose
unsigned? Is time a signed concept? What is the right thing to do
here, from a long-term design perspective?


\
 
 \ /
  Last update: 2012-06-22 01:41    [W:0.095 / U:2.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site