lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 09 Nov 2012 14:07:26 -0700
From:	Stephen Warren <swarren@...dotorg.org>
To:	Ryan Mallon <rmallon@...il.com>
CC:	Russell King <linux@....linux.org.uk>,
	Olof Johansson <olof@...om.net>, Arnd Bergmann <arnd@...db.de>,
	John Stultz <johnstul@...ibm.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	linux-arch@...r.kernel.org, Stephen Warren <swarren@...dia.com>,
	Andrew Victor <linux@...im.org.za>,
	Nicolas Ferre <nicolas.ferre@...el.com>,
	Jean-Christophe Plagniol-Villard <plagnioj@...osoft.com>,
	Hartley Sweeten <hsweeten@...ionengravers.com>,
	Ben Dooks <ben-linux@...ff.org>,
	Kukjin Kim <kgene.kim@...sung.com>
Subject: Re: [PATCH 04/11] ARM: set arch_gettimeoffset directly

On 11/08/2012 04:06 PM, Ryan Mallon wrote:
> On 09/11/12 08:01, Stephen Warren wrote:
>> remove ARM's struct sys_timer .offset function pointer, and instead
>> directly set the arch_gettimeoffset function pointer when the timer
>> driver is initialized. This requires multiplying all function results
>> by 1000, since the removed arm_gettimeoffset() did this. Also,
>> s/unsigned long/u32/ just to make the function prototypes exactly
>> match that of arch_gettimeoffset.

>> +static u32 ep93xx_gettimeoffset(void)
>> +{
>> +	int offset;
>> +
>> +	offset = __raw_readl(EP93XX_TIMER4_VALUE_LOW) - last_jiffy_time;
>> +
>> +	/* Calculate (1000000 / 983040) * offset.  */
> 
> This comment is now incorrect, it should say:
> 
> 	/* Calculate (1000000000 / 983040) * offset */
> 
> or perhaps to better explain what is being done:
> 
> 	/*
> 	 * Timer 4 is based on a 983.04 kHz reference clock,
> 	 * so dividing by 983040 gives a milli-second value.
> 	 * Refactor the calculation to avoid overflow.
> 	 */
> 
>> +	return (offset + (53 * offset / 3072)) * 1000;

Thanks. I expanded on that slightly and went for:

	/*
	 * Timer 4 is based on a 983.04 kHz reference clock,
	 * so dividing by 983040 gives the fraction of a second,
	 * so dividing by 0.983040 converts to uS.
	 * Refactor the calculation to avoid overflow.
	 * Finally, multiply by 1000 to give nS.
	 */

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ