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
| ||
|
Date: Thu, 2 Aug 2012 18:28:47 -0700 From: Colin Cross <ccross@...roid.com> To: Russell King - ARM Linux <linux@....linux.org.uk> Cc: Linus Walleij <linus.walleij@...aro.org>, linux-arm-kernel@...ts.infradead.org, Barry Song <21cnbao@...il.com>, Vaibhav Bedia <vaibhav.bedia@...com>, Krzysztof Halasa <khc@...waw.pl>, Nicolas Pitre <nico@...aro.org>, Marc Zyngier <marc.zyngier@....com>, linux-kernel@...r.kernel.org Subject: Re: [RFC v2] ARM: sched_clock: update epoch_cyc on resume On Fri, Jul 27, 2012 at 8:30 PM, Colin Cross <ccross@...roid.com> wrote: > On Fri, Jul 27, 2012 at 6:15 PM, Colin Cross <ccross@...roid.com> wrote: >> That patch was merged in 3.4, and my patch is on top of it. Your >> patch updates epoch_cyc and epoch_ns in suspend, but if the first call >> to cyc_to_sched_clock after resume gets cyc = 0, cyc - epoch_cyc can >> be negative, although it will be cast back to a large positive number. >> >> With my patch, epoch_cyc is updated in resume to whatever >> read_sched_clock() returns, and epoch_ns is still set to the suspend >> value, so it appears that sched_clock has not changed between >> sched_clock_suspend and sched_clock_resume. It will work with any >> timer behavior (reset to 0, reset to random value, or continuing >> counting). The old setup_sched_clock function maintains the old >> behavior to appease those who like their 32kHz sched clock to continue >> ticking in suspend, although I think it is more correct for all sched >> clocks to be faster than 32 kHz (when possible) and stop in suspend. > > I think the existing code can cause sched_clock to go backwards if the > register read by the read function resets to 0 in suspend: > > In sched_clock_suspend epoch_cyc is updated to 0x00002000. > > The first sched_clock call after resume gets cyc = 0, returning > epoch_ns + cyc_to_ns(0xffffe000) > > Later, sched_clock gets cyc = 0x5000, returning epoch_ns + > cyc_to_ns(0x3000), which will be much smaller than the previous > sched_clock value. Russell, any update on this? Should sched_clock.c handle read functions that go backwards in suspend, or should I modify the read function to track an offset in suspend and always return a monotonically increasing value across suspend? -- 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