{"id":183,"date":"2007-10-22T22:31:03","date_gmt":"2007-10-23T02:31:03","guid":{"rendered":"http:\/\/benjamin.smedbergs.us\/blog\/2007-10-22\/dont-dig-deeper-than-you-have-to\/"},"modified":"2007-10-22T22:31:03","modified_gmt":"2007-10-23T02:31:03","slug":"dont-dig-deeper-than-you-have-to","status":"publish","type":"post","link":"http:\/\/benjamin.smedbergs.us\/blog\/2007-10-22\/dont-dig-deeper-than-you-have-to\/","title":{"rendered":"Don&#8217;t dig deeper than you have to&#8230;"},"content":{"rendered":"<p>I <a href=\"http:\/\/benjamin.smedbergs.us\/blog\/2007-10-11\/do-i-want-a-mac-pro\/\">replaced Windows XP with FC7<\/a> on my fast machine last week. Compiling and linking is much faster than on Windows, and I&#8217;ve managed to get 32-bit builds out of a 64-bit OS. But every once in a while I have problems with processes randomly hanging on startup at 100% CPU. I&#8217;m guessing about 1 out of every 1000 processes. It was all kinds of processes: \/bin\/sh, \/usr\/bin\/perl, nsinstall for mozilla. There was nothing going on in strace, so I attached a hanging process in gdb:<\/p>\n<pre>#0  0x0000003ee327d323 in init_cacheinfo () from \/lib64\/libc.so.6\r\n#1  0x0000003ee321d8e6 in __libc_global_ctors () from \/lib64\/libc.so.6\r\n#2  0x0000003ee2e0d11b in call_init () from \/lib64\/ld-linux-x86-64.so.2\r\n#3  0x0000003ee2e0d225 in _dl_init_internal () from \/lib64\/ld-linux-x86-64.so.2\r\n#4  0x0000003ee2e00a9a in _dl_start_user () from \/lib64\/ld-linux-x86-64.so.2<\/pre>\n<p>Stepping through the assembly, it&#8217;s repeating this loop infinitely:<\/p>\n<pre>0x0000003ee327d31d &lt;init_cacheinfo+141&gt;:        mov    %esi,%eax\r\n0x0000003ee327d31f &lt;init_cacheinfo+143&gt;:        mov    %edi,%ecx\r\n0x0000003ee327d321 &lt;init_cacheinfo+145&gt;:        cpuid  \r\n0x0000003ee327d323 &lt;init_cacheinfo+147&gt;:        mov    %eax,%r8d\r\n0x0000003ee327d326 &lt;init_cacheinfo+150&gt;:        shr    $0x5,%eax\r\n0x0000003ee327d329 &lt;init_cacheinfo+153&gt;:        add    $0x1,%edi\r\n0x0000003ee327d32c &lt;init_cacheinfo+156&gt;:        and    $0x7,%eax\r\n0x0000003ee327d32f &lt;init_cacheinfo+159&gt;:        cmp    %r10d,%eax\r\n0x0000003ee327d332 &lt;init_cacheinfo+162&gt;:        jne    0x3ee327d31d &lt;init_cacheinfo+141&gt;<\/pre>\n<p>I eventually tracked down an interesting comment\/patch <a href=\"http:\/\/sources.redhat.com\/cgi-bin\/cvsweb.cgi\/libc\/sysdeps\/x86_64\/cacheinfo.c.diff?r1=1.6&#038;r2=1.7&#038;cvsroot=glibc&#038;f=h\">here<\/a>. Now all I need to do is figure out how to get this fix onto my machine with the least amount of pain and suffering.<\/p>\n<p>If you are a glass-half-full person, this is why open-source is cool: you have the ability to see all the relevant code, find the problem, and fix it (or at least find the person who already fixed it). If you are a glass-half-empty, you&#8217;d be complaining that FC7 just <em>sucks<\/em> and why haven&#8217;t they deployed this fix already. And you&#8217;d also complain that it&#8217;s really hard to figure out how to apply a patch to a system package and rebuild it. I&#8217;m just happy it was happening to me and not my wife. And I&#8217;m still a little confused why it only happens occasionally.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I replaced Windows XP with FC7 on my fast machine last week. Compiling and linking is much faster than on Windows, and I&#8217;ve managed to get 32-bit builds out of a 64-bit OS. But every once in a while I have problems with processes randomly hanging on startup at 100% CPU. I&#8217;m guessing about 1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[59],"class_list":["post-183","post","type-post","status-publish","format-standard","hentry","category-mozilla","tag-code-reading"],"_links":{"self":[{"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/posts\/183","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/comments?post=183"}],"version-history":[{"count":0,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/posts\/183\/revisions"}],"wp:attachment":[{"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/media?parent=183"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/categories?post=183"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/tags?post=183"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}