<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Courier New";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:navy;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-GB link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 face="Courier New"><span lang=EN-US
style='font-size:10.0pt'>Running our multithreaded application on ppc8548 (E500
core) generates a machine check exception when trying to access some ASIC&#8217;s
registers mapped on the PCI space (This application maps a PCI device to access
its registers)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span lang=EN-US
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><i><font size=2 color=blue face="Courier New"><span
lang=EN-US style='font-size:10.0pt;color:blue;font-style:italic'>machine_check_exception:
task my_process, MCSR=0x10008, NIP=0x10153530<o:p></o:p></span></font></i></p>

<p class=MsoNormal><i><font size=2 color=blue face="Courier New"><span
lang=EN-US style='font-size:10.0pt;color:blue;font-style:italic'>Machine check
in user mode.<o:p></o:p></span></font></i></p>

<p class=MsoNormal><i><font size=2 color=blue face="Courier New"><span
lang=EN-US style='font-size:10.0pt;color:blue;font-style:italic'>Caused by
(from MCSR=10008): <b><span style='font-weight:bold'>Guarded Load or
Cache-Inhibited stwcx</span></b>.<o:p></o:p></span></font></i></p>

<p class=MsoNormal><i><font size=2 color=blue face="Courier New"><span
lang=EN-US style='font-size:10.0pt;color:blue;font-style:italic'>Bus - Read
Data Bus Error<o:p></o:p></span></font></i></p>

<p class=MsoNormal><font size=2 face="Courier New"><span lang=EN-US
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span lang=EN-US
style='font-size:10.0pt'>Here is the assembly dump of the region of code
containing the offending instruction in user-space, with SRR0 pointing us at
0x10153530 when the exception is raised:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span lang=EN-US
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span lang=EN-US
style='font-size:10.0pt'>0x10153528
&lt;_ZN2vk7in_le32EPVKj+16&gt;:&nbsp;&nbsp;&nbsp; lwz&nbsp;&nbsp;&nbsp;&nbsp;
r0,8(r31)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span lang=EN-US
style='font-size:10.0pt'>0x1015352c
&lt;_ZN2vk7in_le32EPVKj+20&gt;:&nbsp;&nbsp;&nbsp; lwz&nbsp;&nbsp;&nbsp;&nbsp;
r9,8(r31)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span lang=EN-US
style='font-size:10.0pt'>0x10153530
&lt;_ZN2vk7in_le32EPVKj+24&gt;:&nbsp;&nbsp;&nbsp; lwbrx&nbsp;&nbsp; r0,0,r0<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span lang=EN-US
style='font-size:10.0pt'>0x10153534
&lt;_ZN2vk7in_le32EPVKj+28&gt;:&nbsp;&nbsp;&nbsp; twi&nbsp;&nbsp;&nbsp;&nbsp;
0,r0,0<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span lang=EN-US
style='font-size:10.0pt'>0x10153538
&lt;_ZN2vk7in_le32EPVKj+32&gt;:&nbsp;&nbsp;&nbsp; isync<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span lang=EN-US
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span lang=EN-US
style='font-size:10.0pt'>All this is fully reproducible, the offending code is
repeatedly the byte-reverse load within the (m)mapped PCI memory segment. The offset
within the segment may vary, even if most of the hits seem to be taken when
reading 0x20030-0x20034 offsets from 0x80000000 PCI address space (which is
mapped to the application via /dev/mem)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span lang=EN-US
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span lang=EN-US
style='font-size:10.0pt'>/proc/pid/maps reports the following mappings to
/dev/mem, with the first one being an ASIC on the PCI space whose registers we
are trying to access, and the second one being system memory (this system
memory is out of kernel visibility&#8230;we use &#8216;mem=256M&#8217; as a
kernel parameter...):<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span lang=EN-US
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span lang=EN-US
style='font-size:10.0pt'>303a9000-304a9000 rw-s 80000000 00:0c
2087&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /dev/mem<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span lang=EN-US
style='font-size:10.0pt'>304a9000-404a9000 rw-s 10000000 00:0c
2087&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /dev/mem<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span lang=EN-US
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span lang=EN-US
style='font-size:10.0pt'>Has anybody experienced something similar using a
kernel based on a 2.6.20 powerpc tree? <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span lang=EN-US
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span lang=EN-US
style='font-size:10.0pt'>Many thanks<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 color=navy face=Arial><span style='font-size:
9.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=1 color=navy face=Arial><span style='font-size:
9.0pt;font-family:Arial;color:navy'>jorge<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 color=navy face=Arial><span style='font-size:
9.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><b><font size=1 color="#003366" face=Arial><span
style='font-size:7.5pt;font-family:Arial;color:#003366;font-weight:bold'>______________________________<o:p></o:p></span></font></b></p>

<p class=MsoNormal><b><font size=1 color="#003366" face=Arial><span
style='font-size:7.5pt;font-family:Arial;color:#003366;font-weight:bold'>Jorge
Ramirez-Ortiz<o:p></o:p></span></font></b></p>

<p class=MsoNormal><font size=3 color=navy face="Courier New"><span
style='font-size:12.0pt;color:navy'>&nbsp;</span></font><font
face="Times New Roman"><span style='font-family:"Times New Roman"'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Courier New"><span style='font-size:12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

</body>

</html>