Tag: Patch
Hi,
I bumped into this issue on Alpine Linux. It appears that the sysfs not
always report the cpu cache size on arm (both 32bit and 64 bit). It
reports size to be -1 and haveged does not handle that case.
I have seen the case on xgene and thunderx machines.
I have attached a patch that should fix the issue.
Thanks!
-nc
<!DOCTYPE html>
<html lang='en'>
<head>
<title>fix-cpu-cache-size-detection.patch\haveged\main - aports - Main aports tree
</title>
<meta name='generator' content='cgit v1.1'/>
<meta name='robots' content='index, nofollow'/>
<link rel='stylesheet' type='text/css' href='/cgit.css'/>
<link rel='shortcut icon' href='//alpinelinux.org/alpine-logo.ico'/>
<link rel='alternate' title='Atom feed' href='https://git.alpinelinux.org/cgit/aports/atom/main/haveged/fix-cpu-cache-size-detection.patch?h=master' type='application/atom+xml'/>
<link rel='vcs-git' href='git://git.alpinelinux.org/aports' title='aports Git repository'/>
<link rel='vcs-git' href='https://git.alpinelinux.org/cgit/aports' title='aports Git repository'/>
</head>
<body>
<div id='cgit'><table id='header'>
<tr>
<td class='logo' rowspan='2'><a href='/cgit/'><img src='//wiki.alpinelinux.org/w/resources/assets/alogo.png' alt='cgit logo'/></a></td>
<td class='main'><a href='/cgit/'>index</a> : <a title='aports' href='/cgit/aports/'>aports</a></td><td class='form'><form method='get'>
<select name='h' onchange='this.form.submit();'>
<option value='1.10-stable'>1.10-stable</option>
<option value='1.9'>1.9</option>
<option value='2.0-stable'>2.0-stable</option>
<option value='2.1-stable'>2.1-stable</option>
<option value='2.2-stable'>2.2-stable</option>
<option value='2.3-stable'>2.3-stable</option>
<option value='2.4-stable'>2.4-stable</option>
<option value='2.5-stable'>2.5-stable</option>
<option value='2.6-stable'>2.6-stable</option>
<option value='2.7-stable'>2.7-stable</option>
<option value='3.0-stable'>3.0-stable</option>
<option value='3.1-stable'>3.1-stable</option>
<option value='3.2-stable'>3.2-stable</option>
<option value='3.3-stable'>3.3-stable</option>
<option value='3.4-stable'>3.4-stable</option>
<option value='3.5-stable'>3.5-stable</option>
<option value='3.6-stable'>3.6-stable</option>
<option value='3.7-stable'>3.7-stable</option>
<option value='master' selected='selected'>master</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>Main aports tree
</td><td class='sub right'>gitolite</td></tr></table>
<table class='tabs'><tr><td>
<a href='/cgit/aports/about/'>about</a><a href='/cgit/aports/'>summary</a><a href='/cgit/aports/refs/'>refs</a><a href='/cgit/aports/log/main/haveged/fix-cpu-cache-size-detection.patch'>log</a><a class='active' href='/cgit/aports/tree/main/haveged/fix-cpu-cache-size-detection.patch'>tree</a><a href='/cgit/aports/commit/main/haveged/fix-cpu-cache-size-detection.patch'>commit</a><a href='/cgit/aports/diff/main/haveged/fix-cpu-cache-size-detection.patch'>diff</a><a href='/cgit/aports/stats/main/haveged/fix-cpu-cache-size-detection.patch'>stats</a></td><td class='form'><form class='right' method='get' action='/cgit/aports/log/main/haveged/fix-cpu-cache-size-detection.patch'>
<select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='text' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit/aports/tree/'>root</a>/<a href='/cgit/aports/tree/main'>main</a>/<a href='/cgit/aports/tree/main/haveged'>haveged</a>/<a href='/cgit/aports/tree/main/haveged/fix-cpu-cache-size-detection.patch'>fix-cpu-cache-size-detection.patch</a></div><div class='content'>blob: 07da2b46d94bbd3333a540d74592615cae6a91b8 (<a href='/cgit/aports/plain/main/haveged/fix-cpu-cache-size-detection.patch'>plain</a>)
<table summary='blob content' class='blob'>
<tr><td class='linenumbers'><pre><a id='n1' href='#n1'>1</a>
<a id='n2' href='#n2'>2</a>
<a id='n3' href='#n3'>3</a>
<a id='n4' href='#n4'>4</a>
<a id='n5' href='#n5'>5</a>
<a id='n6' href='#n6'>6</a>
<a id='n7' href='#n7'>7</a>
<a id='n8' href='#n8'>8</a>
<a id='n9' href='#n9'>9</a>
<a id='n10' href='#n10'>10</a>
<a id='n11' href='#n11'>11</a>
<a id='n12' href='#n12'>12</a>
<a id='n13' href='#n13'>13</a>
<a id='n14' href='#n14'>14</a>
<a id='n15' href='#n15'>15</a>
</pre></td>
<td class='lines'><pre><code>Some ARM cpus does not report the cache size or say it is -1
diff --git a/src/havegetune.c b/src/havegetune.c
index f1a99f2..de39c53 100644
<span style="color:#0057ae">--- a/src/havegetune.c</span>
<span style="color:#000000; font-weight:bold">+++ b/src/havegetune.c</span>
@@ -795,6 +795,8 @@ static int vfs_configInfoCache(
ctype = vfs_configFile(pAnchor, path, vfs_configType);
strcpy(path+plen, "size");
size = vfs_configFile(pAnchor, path, vfs_configInt);
<span style="color:#000000; font-weight:bold">+ if (size == -1)</span>
<span style="color:#000000; font-weight:bold">+ size = ctype == 'I' ? GENERIC_ICACHE : GENERIC_DCACHE;</span>
cfg_cacheAdd(pAnchor, SRC_VFS_INDEX, pArgs[1], level, ctype, size);
}
}
</code></pre></td></tr></table>
</div> <!-- class=content -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-2804446-12");
pageTracker._trackPageview();
} catch(err) {}</script>
</div> <!-- id=cgit -->
</body>
</html>