Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1475904

Re: [RFC v5 21/23] clockevents: initial support for mono to raw time conversion

From Nicolai Stange <nicstange@gmail.com>
Newsgroups linux.kernel
Subject Re: [RFC v5 21/23] clockevents: initial support for mono to raw time conversion
Date 2016-09-04 12:00 +0200
Message-ID <sdCnw-3za-13@gated-at.bofh.it> (permalink)
References <sdugh-4kW-3@gated-at.bofh.it> <sduzD-4qS-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Nicolai Stange <nicstange@gmail.com> writes:

> +static u32 __clockevents_calc_adjust_freq(u32 mult_ce_raw, u32 mult_cs_mono,
> +					u32 mult_cs_raw)
> +{
> +	u64 adj;
> +	int sign;
> +
> +	if (mult_cs_raw >= mult_cs_mono) {
> +		sign = 0;
> +		adj = mult_cs_raw - mult_cs_mono;
> +	} else {
> +		sign = 1;
> +		adj = mult_cs_mono - mult_cs_raw;
> +	}
> +
> +	adj *= mult_ce_raw;
> +	adj += mult_cs_mono / 2;
> +	do_div(adj, mult_cs_mono);
> +
> +	if (!sign) {
> +		/*
> +		 * Never increase mult by more than 12.5%,
> +		 * c.f. __clockevents_update_bounds().
> +		 */
> +		adj = max_t(u64, adj, mult_ce_raw / 8);

This is wrong and should read as min_t(...), of course -- it's an upper
bound.


> +		if (U32_MAX - mult_ce_raw < adj)
> +			return U32_MAX;
> +		return mult_ce_raw + (u32)adj;
> +	}
> +	if (adj >= mult_ce_raw)
> +		return 1;
> +	return mult_ce_raw - (u32)adj;
> +}

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC v5 00/23] adapt clockevents frequencies to mono clock Nicolai Stange <nicstange@gmail.com> - 2016-09-04 03:30 +0200
  [RFC v5 01/23] clocksource: sh_cmt: compute rate before registration again Nicolai Stange <nicstange@gmail.com> - 2016-09-04 03:30 +0200
  [RFC v5 04/23] clocksource: em_sti: compute rate before registration Nicolai Stange <nicstange@gmail.com> - 2016-09-04 03:30 +0200
  [RFC v5 13/23] clockevents: introduce CLOCK_EVT_FEAT_NO_ADJUST flag Nicolai Stange <nicstange@gmail.com> - 2016-09-04 03:30 +0200
  [RFC v5 09/23] arch/x86/platform/uv/uv_time: set ->min_delta_ticks and ->max_delta_ticks Nicolai Stange <nicstange@gmail.com> - 2016-09-04 03:30 +0200
  [RFC v5 02/23] clocksource: sh_tmu: compute rate before registration again Nicolai Stange <nicstange@gmail.com> - 2016-09-04 03:30 +0200
  [RFC v5 12/23] many clockevent drivers: don't set ->min_delta_ns and ->max_delta_ns Nicolai Stange <nicstange@gmail.com> - 2016-09-04 03:30 +0200
  [RFC v5 07/23] many clockevent drivers: set ->min_delta_ticks and ->max_delta_ticks Nicolai Stange <nicstange@gmail.com> - 2016-09-04 03:30 +0200
  [RFC v5 17/23] clockevents: use ->min_delta_ticks_adjusted to program minimum delta Nicolai Stange <nicstange@gmail.com> - 2016-09-04 03:40 +0200
  [RFC v5 14/23] clockevents: decouple ->max_delta_ns from ->max_delta_ticks Nicolai Stange <nicstange@gmail.com> - 2016-09-04 03:40 +0200
  [RFC v5 15/23] clockevents: do comparison of delta against minimum in terms of cycles Nicolai Stange <nicstange@gmail.com> - 2016-09-04 03:40 +0200
  [RFC v5 16/23] clockevents: clockevents_program_min_delta(): don't set ->next_event Nicolai Stange <nicstange@gmail.com> - 2016-09-04 03:40 +0200
  [RFC v5 18/23] clockevents: min delta increment: calculate min_delta_ns from ticks Nicolai Stange <nicstange@gmail.com> - 2016-09-04 03:40 +0200
  [RFC v5 19/23] timer_list: print_tickdevice(): calculate ->min_delta_ns dynamically Nicolai Stange <nicstange@gmail.com> - 2016-09-04 03:40 +0200
  [RFC v5 22/23] clockevents: make setting of ->mult and ->mult_adjusted atomic Nicolai Stange <nicstange@gmail.com> - 2016-09-04 03:40 +0200
  [RFC v5 20/23] clockevents: purge ->min_delta_ns Nicolai Stange <nicstange@gmail.com> - 2016-09-04 03:40 +0200
  [RFC v5 21/23] clockevents: initial support for mono to raw time conversion Nicolai Stange <nicstange@gmail.com> - 2016-09-04 03:40 +0200
    Re: [RFC v5 21/23] clockevents: initial support for mono to raw time conversion Nicolai Stange <nicstange@gmail.com> - 2016-09-04 12:00 +0200
  [RFC v5 23/23] timekeeping: inform clockevents about freq adjustments Nicolai Stange <nicstange@gmail.com> - 2016-09-04 03:40 +0200

csiph-web