<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 01:18:38 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Whamcloud Community JIRA</title>
    <link>https://jira.whamcloud.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.4.14</version>
        <build-number>940014</build-number>
        <build-date>05-12-2023</build-date>
    </build-info>


<item>
            <title>[LU-1665] hsb_head[0] in cfs_hash_bucket_t can experience poor alignment</title>
                <link>https://jira.whamcloud.com/browse/LU-1665</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;hsb_head&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt; can experience poor alignment on certain platforms with odd alignment requirements like the ia64.  it is possible for hsb_head&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt; to be aligned to a 32-bit boundary, but later it could be cast to something with a stricter alignment requirement.  this can/does cause hardware faults for unaligned access:&lt;/p&gt;

&lt;p&gt;Jul 18 19:25:20 seraph kernel: kernel unaligned access to 0xe0000069eef8f194, ip=0xa00000028342e0d1&lt;br/&gt;
Jul 18 19:25:20 seraph kernel: kernel unaligned access to 0xe0000069eef8f19c, ip=0xa00000028342e0d1&lt;br/&gt;
Jul 18 19:25:20 seraph kernel: kernel unaligned access to 0xe0000069eef8f1a4, ip=0xa00000028342e0d1&lt;br/&gt;
Jul 18 19:25:20 seraph kernel: kernel unaligned access to 0xe0000069eef8f1ac, ip=0xa00000028342e0d1&lt;br/&gt;
Jul 18 19:25:20 seraph kernel: kernel unaligned access to 0xe0000069eef8f1b4, ip=0xa00000028342e0d1&lt;/p&gt;</description>
                <environment>ia64</environment>
        <key id="15293">LU-1665</key>
            <summary>hsb_head[0] in cfs_hash_bucket_t can experience poor alignment</summary>
                <type id="1" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="4" iconUrl="https://jira.whamcloud.com/images/icons/priorities/minor.svg">Minor</priority>
                        <status id="5" iconUrl="https://jira.whamcloud.com/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="1">Fixed</resolution>
                                        <assignee username="keith">Keith Mannthey</assignee>
                                    <reporter username="chas3">chas williams - CONTRACTOR</reporter>
                        <labels>
                    </labels>
                <created>Tue, 24 Jul 2012 10:22:40 +0000</created>
                <updated>Wed, 23 Jan 2013 14:28:04 +0000</updated>
                            <resolved>Wed, 23 Jan 2013 14:28:04 +0000</resolved>
                                    <version>Lustre 2.2.0</version>
                    <version>Lustre 2.1.2</version>
                                    <fixVersion>Lustre 2.4.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>5</watches>
                                                                            <comments>
                            <comment id="42212" author="pjones" created="Tue, 24 Jul 2012 16:54:26 +0000"  >&lt;p&gt;Keith&lt;/p&gt;

&lt;p&gt;Can you please look into this one?&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;

&lt;p&gt;Peter&lt;/p&gt;</comment>
                            <comment id="42533" author="keith" created="Tue, 31 Jul 2012 20:01:16 +0000"  >&lt;p&gt;The char to long change is a low risk change overall but is isn&apos;t clear to me we are not just masking an underlaying issue. &lt;/p&gt;

&lt;p&gt;Do you know know what part of the code that accesses this data structure is causing the unaligned access?  Where &quot;ip=0xa00000028342e0d1&quot; is? &lt;/p&gt;</comment>
                            <comment id="42547" author="chas3" created="Wed, 1 Aug 2012 10:01:31 +0000"  >&lt;p&gt;for whatever reason, gcc doesnt quite align the structure optimally for ia64.  it seems to aligning so that the data structure is compatible with x86/x86_64.  try this program on x86_64:&lt;/p&gt;


&lt;p&gt;#include &amp;lt;stdio.h&amp;gt;&lt;br/&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;/p&gt;

&lt;p&gt;struct long_then_charp {&lt;br/&gt;
        unsigned long value;&lt;br/&gt;
        unsigned char string&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;;&lt;br/&gt;
};&lt;/p&gt;

&lt;p&gt;struct int_then_charp &lt;/p&gt;
{
        unsigned int value;
        unsigned char string[0];
};

int
main(int argc, char **argv)
{
        struct long_then_charp *a;
        struct int_then_charp *b;

        unsigned long *anon;

        a = malloc(32);
        b = malloc(32);

        printf(&quot;&amp;amp;a.value %p\n&quot;, &amp;amp;a-&amp;gt;value);
        printf(&quot;a.string[] %p\n&quot;, a-&amp;gt;string);

        anon = (void *) a-&amp;gt;string;
        *anon = 0xdeadbeefdeadbeef;

        printf(&quot;&amp;amp;b.value %p\n&quot;, &amp;amp;b-&amp;gt;value);
        printf(&quot;b.string[] %p\n&quot;, b-&amp;gt;string);

        anon = (void *) b-&amp;gt;string;
        *anon = 0xdeadbeefdeadbeef;

}

&lt;p&gt;when you run this you will see that a.string is aligned to an 8 byte boundary in one case and a 4 byte boundary in the other case.  both of these will work on x86/x86_64 without complaint (although i imagine that the x64_64 might benefit from the long being aligned to an 8 byte boundary?)&lt;/p&gt;

&lt;p&gt;the kernel on ia64 issues a runtime message though for this program:&lt;/p&gt;

&lt;p&gt;% a.out&lt;br/&gt;
&amp;amp;a.value 0x6000000000004010&lt;br/&gt;
a.string[] 0x6000000000004018&lt;br/&gt;
&amp;amp;b.value 0x6000000000004040&lt;br/&gt;
b.string[] 0x6000000000004044&lt;br/&gt;
a.out(119837): unaligned access to 0x6000000000004044, ip=0x40000000000009e0&lt;/p&gt;

&lt;p&gt;so the b.string[] that was cast to the unsigned long and then accessed caused this fault.  the program will run, but performance is somewhat reduced since the kernel has to handle this misalignment.&lt;/p&gt;

&lt;p&gt;in lustre, this specifically seems to be here:&lt;/p&gt;

&lt;p&gt;(gdb) info line *cfs_hash_bd_lookup_intent+0x80&lt;br/&gt;
Line 630 of &quot;/scratch1/chas/lustre-2.1.2/libcfs/libcfs/hash.c&quot; starts at address 0x28e0 &amp;lt;cfs_hash_bd_lookup_intent+128&amp;gt;&lt;br/&gt;
   and ends at 0x28e1 &amp;lt;cfs_hash_bd_lookup_intent+129&amp;gt;.&lt;/p&gt;

&lt;p&gt;that&apos;s here:&lt;br/&gt;
tatic cfs_hlist_node_t *&lt;br/&gt;
cfs_hash_bd_lookup_intent(cfs_hash_t *hs, cfs_hash_bd_t *bd,&lt;br/&gt;
                          const void *key, cfs_hlist_node_t *hnode,&lt;br/&gt;
                          cfs_hash_lookup_intent_t intent)&lt;/p&gt;

&lt;p&gt;{&lt;br/&gt;
        cfs_hlist_head_t  *hhead = cfs_hash_bd_hhead(hs, bd);&lt;br/&gt;
        cfs_hlist_node_t  *ehnode;&lt;br/&gt;
        cfs_hlist_node_t  *match;&lt;br/&gt;
        int  intent_add = (intent &amp;amp; CFS_HS_LOOKUP_MASK_ADD) != 0;&lt;/p&gt;

&lt;p&gt;        /* with this function, we can avoid a lot of useless refcount ops,&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;which are expensive atomic operations most time. */&lt;br/&gt;
        match = intent_add ? NULL : hnode;&lt;br/&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;    cfs_hlist_for_each(ehnode, hhead) {&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;cfs_hash_bd_hhead() converts hsb_head&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt; via the appropriate cfs_hash_hlist_ops_t to a cfs_hlist_head_t.  apparently hhead winds up with a poor alignment for ia64 because of this.  there are a couple other places, where this happens but it is basically the same.&lt;/p&gt;</comment>
                            <comment id="42569" author="keith" created="Wed, 1 Aug 2012 19:07:46 +0000"  >&lt;p&gt;The reasoning seems good to me.  Can you submit the patch in git?  &lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://wiki.whamcloud.com/display/PUB/Submitting+Changes&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://wiki.whamcloud.com/display/PUB/Submitting+Changes&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It makes the DCO and testing much easier. &lt;/p&gt;</comment>
                            <comment id="42849" author="keith" created="Tue, 7 Aug 2012 18:42:12 +0000"  >&lt;p&gt;Do you have any questions about the process?&lt;/p&gt;</comment>
                            <comment id="42940" author="chas3" created="Thu, 9 Aug 2012 10:23:14 +0000"  >&lt;p&gt;no.  just busy this week.&lt;/p&gt;</comment>
                            <comment id="49995" author="keith" created="Fri, 4 Jan 2013 22:19:47 +0000"  >&lt;p&gt;Without an update I will close this LU at the end of the Month. &lt;/p&gt;</comment>
                            <comment id="50054" author="chas3" created="Mon, 7 Jan 2013 08:28:18 +0000"  >&lt;p&gt;i have a patch in gerrit &lt;a href=&quot;http://review.whamcloud.com/#change,3603&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/#change,3603&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;i dont know if it was merged.  build testing failed but i think the error was due to problems with the backend testing facility.&lt;/p&gt;</comment>
                            <comment id="50060" author="pjones" created="Mon, 7 Jan 2013 10:28:40 +0000"  >&lt;p&gt;Hi Chas&lt;/p&gt;

&lt;p&gt;Your change has not been merged yet. It has failed autotest due to an unrelated error. Usually the ticket owner will monitor contributed patches and take action if this happens but I imagine Keith was unaware of the patch. The convention is to post a comment with a link to any related patches so that those watching the JIRA ticket can find them.&lt;/p&gt;

&lt;p&gt;Keith&lt;/p&gt;

&lt;p&gt;Can you please see whether it is best to trigger a re-test on the patch with a no score build or else rebase the patch on the latest master code.&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;

&lt;p&gt;Peter&lt;/p&gt;</comment>
                            <comment id="51052" author="keith" created="Wed, 23 Jan 2013 14:28:04 +0000"  >&lt;p&gt;Sorry for that patch lost issue last  year. &lt;/p&gt;

&lt;p&gt;The patch has just been landed to master. &lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="11714" name="ia64-alignment-fix.patch" size="620" author="chas3" created="Tue, 24 Jul 2012 10:22:40 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                            <customfield id="customfield_10890" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10390" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hzvgqf:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10090" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>6360</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10060" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Severity</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10022"><![CDATA[3]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        </customfields>
    </item>
</channel>
</rss>