<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 13/12/2013 08:54, Michal Privoznik
      wrote:<br>
    </div>
    <blockquote cite="mid:52AABD1B.6020502@redhat.com" type="cite">
      <pre wrap="">On 12.12.2013 20:27, Eric Blake wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">On 12/12/2013 11:55 AM, Michal Privoznik wrote:
</pre>
        <blockquote type="cite">
          <blockquote type="cite">
            <pre wrap="">     int detail;
-};
+} ATTRIBUTE_PACKED;
</pre>
          </blockquote>
          <pre wrap="">
(What an ancient e-mail :-) )
</pre>
        </blockquote>
        <pre wrap="">
1970 was how many years before libvirt was even started?</pre>
      </blockquote>
    </blockquote>
    Indeed, this is a 43 years old thread :-)<br>
    <br>
    I've had some problem with the ntpd deamon on the OMAP5 yesterday.
    For this reason I've resent the patch with the prefix [resend].<br>
    <br>
    <blockquote cite="mid:52AABD1B.6020502@redhat.com" type="cite">
      <blockquote type="cite">
        <pre wrap="">

</pre>
        <blockquote type="cite">
          <pre wrap="">
I've raised the problem here:

<a class="moz-txt-link-freetext" href="https://www.redhat.com/archives/libvir-list/2013-December/msg00635.html">https://www.redhat.com/archives/libvir-list/2013-December/msg00635.html</a>

And Eric replied suggesting a fix:

<a class="moz-txt-link-freetext" href="https://www.redhat.com/archives/libvir-list/2013-December/msg00662.html">https://www.redhat.com/archives/libvir-list/2013-December/msg00662.html</a>

But I must say I like your approach more. Eric?
</pre>
        </blockquote>
        <pre wrap="">
I still think ATTRIBUTE_PACKED in a parent class is wrong; it forces the
children to be packed, and may make it impossible to implement atomic
operations on a child member that was supposed to be aligned.  I'd much
rather fix the alignment in the parent class using portable constructs
than a compiler-specific non-alignment directive.

</pre>
      </blockquote>
      <pre wrap="">
Oh right. The locking could be impossible, because if two struct members
are packed in a word, e.g.:

struct S {
  bool a;
  bool b;
  ...
};

then modifying S.a requires whole struct to be fetched from mem,
modifying S.a a and storing it back. However, even if our locking code
to protect say S.b was written well, S.b can still get changed without
lock. As S.a is being changed, another thread changes S.b, but storing
S.a means overwriting S.b without lock held.

I have not thought of that. So NACK then - we need Eric's approach.</pre>
    </blockquote>
    <br>
    I saw the Eric's patch. I will test it today.<br>
    <br>
    <blockquote cite="mid:52AABD1B.6020502@redhat.com" type="cite">
      <pre wrap="">

Michal
</pre>
    </blockquote>
    <br>
    <br>
    <div class="moz-signature">-- <br>
      <strong><span style="font-size: large;"><span style="color:
            #2e3436;">Michele Paolino</span></span></strong><span
        style="font-size:14px;"><span style="color: rgb(46, 52, 54);">,
        </span>Virtualization R&D Engineer<span style="color:
          rgb(46, 52, 54);"> </span></span><br>
      <span style="color: #888888;">Virtual Open Systems</span><br>
      <em><span style="color: #888888;">Open Source  KVM 
          Virtualization  Developments</span></em><br>
      <em><span style="color: #888888;">Multicore Systems Virtualization
          Porting Services</span></em><br>
      <span style="color: #888888;">Web</span><span style="color:
        #888888;"><em>:</em></span><span style="color: #888888;"> </span><span
        style="color: #888888;"><span style="text-decoration:
          underline;"><a href="http://www.virtualopensystems.com/">www.virtualopensystems.</a><a
            href="http://www.virtualopensystems.com/">com</a></span></span>
      <p><br>
      </p>
    </div>
  </body>
</html>