linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Nicolai Stange <nicstange@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, John Stultz <john.stultz@linaro.org>,
	Borislav Petkov <bp@suse.de>, Paolo Bonzini <pbonzini@redhat.com>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	"Christopher S. Hall" <christopher.s.hall@intel.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/4] kernel/time/clockevents: compensate for monotonic clock's dynamic frequency
Date: Mon, 11 Jul 2016 10:32:04 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.11.1607111029360.4083@nanos> (raw)
In-Reply-To: <87inwcd6s7.fsf@gmail.com>

On Mon, 11 Jul 2016, Nicolai Stange wrote:
> > +	raw = ((u64)interval >> 32) * raw_mult; /* Upper half of interval */
> > +	if (raw >> 32)
> > +		return KTIME_MAX;
> > +	raw <<= 32;
> > +	tmp = ((u64)interval & U32_MAX) * raw_mult; /* Lower half of interval */
> > +	if (U64_MAX - raw < tmp)
> > +		return KTIME_MAX;
> > +	raw += tmp;
> > +
> > +	/* Finally, do raw /= mono_mult with proper rounding. */
> > +	if (U64_MAX - raw < mono_mult / 2)
> > +		return KTIME_MAX;
> > +	raw += mono_mult / 2;
> > +	do_div(raw, mono_mult);
> > +
> > +	return (s64)raw;

That's a complete insanity. No way that we are going to do all this math in
the CE programming path.

If you want to address the issue, then you need to find a way to adjust the
mult/shift factors of the clock event device occasionally.

Thanks,

	tglx

  reply	other threads:[~2016-07-11  8:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-10 19:30 [PATCH v2 0/4] avoid double timer interrupt with nohz and Intel TSC Nicolai Stange
2016-07-10 19:30 ` [PATCH v2 1/4] arch, x86, tsc deadline clockevent dev: reduce frequency roundoff error Nicolai Stange
2016-07-10 19:30 ` [PATCH v2 2/4] arch, x86, tsc deadline clockevent dev: reduce TSC_DIVISOR to 2 Nicolai Stange
2016-07-10 19:30 ` [PATCH v2 3/4] arch, x86, tsc: inform TSC deadline clockevent device about recalibration Nicolai Stange
2016-07-10 19:30 ` [PATCH v2 4/4] kernel/time/clockevents: compensate for monotonic clock's dynamic frequency Nicolai Stange
2016-07-11  6:32   ` Nicolai Stange
2016-07-11  8:32     ` Thomas Gleixner [this message]
2016-07-12 11:10       ` Nicolai Stange
2016-07-12 15:04         ` Thomas Gleixner
2016-07-13 13:08           ` Nicolai Stange

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.11.1607111029360.4083@nanos \
    --to=tglx@linutronix.de \
    --cc=adrian.hunter@intel.com \
    --cc=bp@suse.de \
    --cc=christopher.s.hall@intel.com \
    --cc=hidehiro.kawai.ez@hitachi.com \
    --cc=hpa@zytor.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nicstange@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=viresh.kumar@linaro.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).