CINXE.COM

LKML: "Jan Beulich": Re: 2.6.15-rc5-mm1 (x86_64-hpet-overflow.patch breaks resume from disk)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>LKML: "Jan Beulich": Re: 2.6.15-rc5-mm1 (x86_64-hpet-overflow.patch breaks resume from disk)</title><link href="/css/message.css" rel="stylesheet" type="text/css" /><link href="/css/wrap.css" rel="alternate stylesheet" type="text/css" title="wrap" /><link href="/css/nowrap.css" rel="stylesheet" type="text/css" title="nowrap" /><link href="/favicon.ico" rel="shortcut icon" /><script src="/js/simple-calendar.js" type="text/javascript"></script><script src="/js/styleswitcher.js" type="text/javascript"></script><link rel="alternate" type="application/rss+xml" title="lkml.org : last 100 messages" href="/rss.php" /><link rel="alternate" type="application/rss+xml" title="lkml.org : last messages by &quot;Jan Beulich&quot;" href="/groupie.php?aid=22718" /><!--Matomo--><script> var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ _paq.push(["setDoNotTrack", true]); _paq.push(["disableCookies"]); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="//m.lkml.org/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', '1']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); </script><!--End Matomo Code--></head><body onload="es.jasper.simpleCalendar.init();" itemscope="itemscope" itemtype="http://schema.org/BlogPosting"><table border="0" cellpadding="0" cellspacing="0"><tr><td width="180" align="center"><a href="/"><img style="border:0;width:135px;height:32px" src="/images/toprowlk.gif" alt="lkml.org" /></a></td><td width="32">聽</td><td class="nb"><div><a class="nb" href="/lkml"> [lkml]</a> 聽 <a class="nb" href="/lkml/2005"> [2005]</a> 聽 <a class="nb" href="/lkml/2005/12"> [Dec]</a> 聽 <a class="nb" href="/lkml/2005/12/9"> [9]</a> 聽 <a class="nb" href="/lkml/last100"> [last100]</a> 聽 <a href="/rss.php"><img src="/images/rss-or.gif" border="0" alt="RSS Feed" /></a></div><div>Views: <a href="#" class="nowrap" onclick="setActiveStyleSheet('wrap');return false;">[wrap]</a><a href="#" class="wrap" onclick="setActiveStyleSheet('nowrap');return false;">[no wrap]</a> 聽 <a class="nb" href="/lkml/mheaders/2005/12/9/18" onclick="this.href='/lkml/headers'+'/2005/12/9/18';">[headers]</a>聽 <a href="/lkml/bounce/2005/12/9/18">[forward]</a>聽 </div></td><td width="32">聽</td></tr><tr><td valign="top"><div class="es-jasper-simpleCalendar" baseurl="/lkml/"></div><div class="threadlist">Messages in this thread</div><ul class="threadlist"><li class="root"><a href="/lkml/2005/12/5/15">First message in thread</a></li><li><a href="/lkml/2005/12/8/54">"Rafael J. Wysocki"</a><ul><li><a href="/lkml/2005/12/8/242">"Rafael J. Wysocki"</a><ul><li class="origin"><a href="/lkml/2005/12/9/19">"Jan Beulich"</a><ul><li><a href="/lkml/2005/12/9/19">Andi Kleen</a></li><li><a href="/lkml/2005/12/9/40">"Rafael J. Wysocki"</a><ul><li><a href="/lkml/2005/12/9/69">"Jan Beulich"</a></li></ul></li></ul></li></ul></li></ul></li></ul><div class="threadlist">Patch in this message</div><ul class="threadlist"><li><a href="/lkml/diff/2005/12/9/18/1">Get diff 1</a></li></ul></td><td width="32" rowspan="2" class="c" valign="top"><img src="/images/icornerl.gif" width="32" height="32" alt="/" /></td><td class="c" rowspan="2" valign="top" style="padding-top: 1em"><table><tr><td><table><tr><td class="lp">Date</td><td class="rp" itemprop="datePublished">Fri, 09 Dec 2005 10:15:51 +0100</td></tr><tr><td class="lp">From</td><td class="rp" itemprop="author">"Jan Beulich" &lt;&gt;</td></tr><tr><td class="lp">Subject</td><td class="rp" itemprop="name">Re: 2.6.15-rc5-mm1 (x86_64-hpet-overflow.patch breaks resume from disk)</td></tr></table></td><td></td></tr></table><pre itemprop="articleBody">It's a possible way to address this, but I'd rather just set a flag<br />indicating that the last-whatever values should not be considered (to<br />get into a state just like after initial boot). Jan<br /><br />&gt;&gt;&gt; "Rafael J. Wysocki" &lt;rjw&#64;sisk.pl&gt; 08.12.05 23:35:49 &gt;&gt;&gt;<br />Update:<br /><br />On Thursday, 8 December 2005 11:53, Rafael J. Wysocki wrote:<br />&gt; On Thursday, 8 December 2005 09:43, Jan Beulich wrote:<br />&gt; &gt; I don't know how resume normally handles the re-syncing of the<br />wall<br />&gt; &gt; clock, but the problem here is obvious: do_timer runs a loop to<br />&gt; &gt; increment jiffies, which may require significant amounts of time<br />&gt; &gt; (depending how long the system was sleeping).<br />&gt; &gt; <br />&gt; &gt; Whatever mechanism was previously used to adjust the wall clock<br />during<br />&gt; &gt; resume, this (a) has to happen before enabling interrupts and (b)<br />has to<br />&gt; &gt; communicate to the timer interrupt handler to adjust its last time<br />stamp<br />&gt; &gt; taken (to compare against in the next run). Clearly, the code was<br />broken<br />&gt; &gt; already before, as it doesn't handle the resume case (where the<br />HPET<br />&gt; &gt; value read is entirely unrelated to the one read during the last<br />timer<br />&gt; &gt; interrupt before suspend) at all, and even in the TSC timer case<br />it<br />&gt; &gt; simply checks whether the TSC delta is negative (which is not a<br />valid<br />&gt; &gt; condition, as, between the booting of the system and the OS resume<br />there<br />&gt; &gt; may elapse more time than the system was running altogether prior<br />to<br />&gt; &gt; suspend).<br />&gt; <br />&gt; Well, I'm not an expert, but I think I understand your<br />argumentation.<br />&gt; However, the problem is that resume _works_ without the patch<br />&gt; and doesn't work with it, which is a regression. (BTW, without<br />&gt; the patch the wall clock is evidently correct after resume.)<br />&gt; <br />&gt; Frankly I don't know who should fix the broken code,<br /><br />FWIW, I have tried to fix it myself.<br /><br />The appended patch seems to work on my box, but I'm afraid<br />it's not the right fix (at least in general). Please advise.<br /><br />Greetings,<br />Rafael<br /><br /><br /> arch/x86_64/kernel/time.c | 15 +++++++++++++++<br /> 1 files changed, 15 insertions(+)<br /><br />Index: linux-2.6.15-rc5-mm1/arch/x86_64/kernel/time.c<br />===================================================================<br />---<br />linux-2.6.15-rc5-mm1.orig/arch/x86_64/kernel/time.c 2005-12-08<br />21:39:29.000000000 +0100<br />+++ linux-2.6.15-rc5-mm1/arch/x86_64/kernel/time.c 2005-12-08<br />22:44:48.000000000 +0100<br />&#64;&#64; -1117,6 +1117,7 &#64;&#64;<br /> unsigned long sec;<br /> unsigned long ctime = get_cmos_time();<br /> unsigned long sleep_length = (ctime - sleep_start) * HZ;<br />+ long offset = 0;<br /> <br /> if (vxtime.hpet_address)<br /> hpet_reenable();<br />&#64;&#64; -1125,6 +1126,20 &#64;&#64;<br /> <br /> sec = ctime + clock_cmos_diff;<br /> write_seqlock_irqsave(&amp;xtime_lock,flags);<br />+ if (vxtime.hpet_address)<br />+ offset = hpet_readl(HPET_COUNTER);<br />+ if (hpet_use_timer) {<br />+ unsigned int hi1 = hpet64 &gt; 0 ?<br />hpet_readl(HPET_COUNTER+4) : 0;<br />+<br />+ offset = hpet_readl(HPET_T0_CMP) - hpet_tick;<br />+ if (hpet64 &gt; 0)<br />+ offset += (long)(offset &gt;= 0 ? hi1 :<br />hpet_readl(HPET_COUNTER+4)) &lt;&lt; 32;<br />+ else<br />+ offset = (unsigned int)offset;<br />+ }<br />+ if (vxtime.mode == VXTIME_HPET)<br />+ vxtime.last = offset;<br />+ rdtscll_sync(&amp;vxtime.last_tsc);<br /> xtime.tv_sec = sec;<br /> xtime.tv_nsec = 0;<br /> write_sequnlock_irqrestore(&amp;xtime_lock,flags);<br />-<br />To unsubscribe from this list: send the line "unsubscribe linux-kernel" in<br />the body of a message to majordomo&#64;vger.kernel.org<br />More majordomo info at <a href="http://vger.kernel.org/majordomo-info.html">http://vger.kernel.org/majordomo-info.html</a><br />Please read the FAQ at <a href="http://www.tux.org/lkml/">http://www.tux.org/lkml/</a><br /></pre></td><td width="32" rowspan="2" class="c" valign="top"><img src="/images/icornerr.gif" width="32" height="32" alt="\" /></td></tr><tr><td align="right" valign="bottom"> 聽 </td></tr><tr><td align="right" valign="bottom">聽</td><td class="c" valign="bottom" style="padding-bottom: 0px"><img src="/images/bcornerl.gif" width="32" height="32" alt="\" /></td><td class="c">聽</td><td class="c" valign="bottom" style="padding-bottom: 0px"><img src="/images/bcornerr.gif" width="32" height="32" alt="/" /></td></tr><tr><td align="right" valign="top" colspan="2"> 聽 </td><td class="lm">Last update: 2005-12-09 10:18 聽聽 [from the cache]<br />漏2003-2020 <a href="http://blog.jasper.es/"><span itemprop="editor">Jasper Spaans</span></a>|hosted at <a href="https://www.digitalocean.com/?refcode=9a8e99d24cf9">Digital Ocean</a> and my Meterkast|<a href="http://blog.jasper.es/categories.html#lkml-ref">Read the blog</a></td><td>聽</td></tr></table><script language="javascript" src="/js/styleswitcher.js" type="text/javascript"></script></body></html>

Pages: 1 2 3 4 5 6 7 8 9 10