<feed xmlns='http://www.w3.org/2005/Atom'>
<title>sdbusplus, branch master</title>
<subtitle>OpenBMC systemd DBUS binding API sources</subtitle>
<id>https://git.raptorcs.com/git/sdbusplus/atom?h=master</id>
<link rel='self' href='https://git.raptorcs.com/git/sdbusplus/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/sdbusplus/'/>
<updated>2020-02-13T06:49:15+00:00</updated>
<entry>
<title>Emit adding/removing interfaces for object server</title>
<updated>2020-02-13T06:49:15+00:00</updated>
<author>
<name>Lei YU</name>
<email>mine260309@gmail.com</email>
</author>
<published>2019-09-20T09:38:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/sdbusplus/commit/?id=e57c38e9dd64e0a5bc12bac5b6d3199c7baa9595'/>
<id>urn:sha1:e57c38e9dd64e0a5bc12bac5b6d3199c7baa9595</id>
<content type='text'>
The object server currently either creats the objects and interfaces, or
defer the signal by not adding objects.

In practice, we have situations that the code would like to add
interfaces to an existing object, and it's not supported, or needs
tricky code to workaround.
Exmaples:
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-bmc-code-mgmt/+/5820
https://gerrit.openbmc-project.xyz/c/openbmc/openpower-pnor-code-mgmt/+/5346

This commit adds the support by:
1. Adding emit_added() in interface.hpp and the generated server.hpp
2. Adding a enum class in object's constructor to indicate which action
   to do, to create the object, or adding the interface, or defer signal
   as before.

So the user of object&lt;&gt; could pass `action::emit_interface_added` to the
constructor to tell the object server *only* emit interface added to
DBus, without emitting object added.
The previous code stays the same behavior:
* If `true` is passed in object's constructor, it defers emitting object
  added signal;
* If no extra parameter is passed in object's constructor, it emits
  object added signal as before.

Tested: 1. Make sure the openbmc builds fine with
        https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-logging/+/25089
        because phosphor-logging uses its own server.hpp for interface, the
        above patch removes that.
        2. Manually write a small service to verify the interfaces are
        added and removed by using the `emit_interface_added` action.
        3. Added the unit test cases for object.hpp to check the
        ctor/dtor with different actions.

Signed-off-by: Lei YU &lt;mine260309@gmail.com&gt;
Change-Id: I178c5bed3c9ff39ee2ac8d143fbe9131b0753dfa
</content>
</entry>
<entry>
<title>Fix an issue found by cppcheck</title>
<updated>2020-02-11T03:29:31+00:00</updated>
<author>
<name>Lei YU</name>
<email>mine260309@gmail.com</email>
</author>
<published>2020-02-10T06:37:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/sdbusplus/commit/?id=19f24b9b706d85ef823bc3290dc1110b1f00a169'/>
<id>urn:sha1:19f24b9b706d85ef823bc3290dc1110b1f00a169</id>
<content type='text'>
cppcheck finds an issue:

 [sdbusplus/asio/object_server.hpp:46] -&gt;
 [sdbusplus/asio/object_server.hpp:315]: (style) The function 'set'
 overrides a function in a base class but is not marked with a
 'override' specifier.

Fix it by adding the override keyword correctly.

Signed-off-by: Lei YU &lt;mine260309@gmail.com&gt;
Change-Id: Ie032229874bb416f7c6ec142d9bf38f8ffcff877
</content>
</entry>
<entry>
<title>sdbus++: interface: fix indent of enum-string fn</title>
<updated>2020-02-11T02:49:21+00:00</updated>
<author>
<name>Patrick Williams</name>
<email>patrick@stwcx.xyz</email>
</author>
<published>2020-01-24T20:56:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/sdbusplus/commit/?id=5e001779718673aa50637958b362e5c5ca8359e5'/>
<id>urn:sha1:5e001779718673aa50637958b362e5c5ca8359e5</id>
<content type='text'>
The convert&lt;enum&gt;FromString functions were indented incorrectly
relative to the rest of the class.

Signed-off-by: Patrick Williams &lt;patrick@stwcx.xyz&gt;
Change-Id: Iabe9d30c33c8707bf2bf4c6a697e3d27d0a3000b
</content>
</entry>
<entry>
<title>MAINTAINERS: add Patrick Williams</title>
<updated>2020-02-11T02:44:02+00:00</updated>
<author>
<name>Patrick Williams</name>
<email>patrick@stwcx.xyz</email>
</author>
<published>2020-02-04T21:47:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/sdbusplus/commit/?id=75016662c0cbf50c45f1aaca5a9ee045877d69a4'/>
<id>urn:sha1:75016662c0cbf50c45f1aaca5a9ee045877d69a4</id>
<content type='text'>
Large portions of the codebase were originally written by me
before maintainers existed.  I am returning to the project and
plan to do significant enhancements and cleanups to sdbusplus.

Signed-off-by: Patrick Williams &lt;patrick@stwcx.xyz&gt;
Change-Id: I3ac6f6597c78041785ded272d1e6ce8974d5b49a
</content>
</entry>
<entry>
<title>Catch async errors so they do not throw</title>
<updated>2020-02-10T19:13:10+00:00</updated>
<author>
<name>Vernon Mauery</name>
<email>vernon.mauery@linux.intel.com</email>
</author>
<published>2020-02-06T17:22:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/sdbusplus/commit/?id=c079db4bb3a783b8db659ee3eba92345192ec7c9'/>
<id>urn:sha1:c079db4bb3a783b8db659ee3eba92345192ec7c9</id>
<content type='text'>
When running an async operation, it is not a good idea to throw because
the current running context is not the context that it was originally
registered from, it is the io run-loop context. So any methods that
*would* throw, must run in a try/catch and then set the error code
properly so that the handler will be notified of the error.

This was caught when a process (bmcweb) was used to invoke a call that
had a bad path. That was not caught and it caused bmcweb to abort
because of an unhandled exception.

Change-Id: Ie66a029066a3f463759089b44368b7518d0de8ce
Signed-off-by: Vernon Mauery &lt;vernon.mauery@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>Make interface string public</title>
<updated>2020-02-04T06:57:31+00:00</updated>
<author>
<name>Lei YU</name>
<email>mine260309@gmail.com</email>
</author>
<published>2020-02-03T06:13:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/sdbusplus/commit/?id=14db20f044be9faba00e41214d4aa8765b43b355'/>
<id>urn:sha1:14db20f044be9faba00e41214d4aa8765b43b355</id>
<content type='text'>
The interface string was private, and the users of sdbusplus have to
define their own strings for the D-Bus interfaces.
By making the interface string public, users do not have to define their
own and the generated string could be used instead.

E.g. one could directly use "Calculator::interface" instead of
"net.poettering.Calculator" in the example.

Signed-off-by: Lei YU &lt;mine260309@gmail.com&gt;
Change-Id: I0846d4e0609c8588d81e8a19bdd69fd79df83848
</content>
</entry>
<entry>
<title>maintainers: Add Lei YU as maintainer</title>
<updated>2020-01-15T06:57:54+00:00</updated>
<author>
<name>Lei YU</name>
<email>mine260309@gmail.com</email>
</author>
<published>2019-12-17T02:32:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/sdbusplus/commit/?id=43ea426d71e70a2fec3aab27dfa5ad6de0e9fbfd'/>
<id>urn:sha1:43ea426d71e70a2fec3aab27dfa5ad6de0e9fbfd</id>
<content type='text'>
Lei has been an active reviewer for sdbusplus, and fixed the CI issue
that has been there for quite a while.

He is willing to become one of the maintainers for sdbusplus, which is
good for speed up the review progress, and for redundancy.

Signed-off-by: Lei YU &lt;mine260309@gmail.com&gt;
Change-Id: I39ec5a1adc0d34c4ce2919a92bd7df463818b9d6
</content>
</entry>
<entry>
<title>maintainers: Fix dkodihal's email address</title>
<updated>2020-01-15T06:57:54+00:00</updated>
<author>
<name>Lei YU</name>
<email>mine260309@gmail.com</email>
</author>
<published>2019-12-17T02:41:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/sdbusplus/commit/?id=cff43c31c2dc9f04d451c34ea2d2ccdc114aa756'/>
<id>urn:sha1:cff43c31c2dc9f04d451c34ea2d2ccdc114aa756</id>
<content type='text'>
The email address of Deepak is incorrect that does match the one in
gerrit.
Fix it to use the correct one.

Signed-off-by: Lei YU &lt;mine260309@gmail.com&gt;
Change-Id: I0f2cc9bd89f0c2cf232d41018071aeea237cc1fe
</content>
</entry>
<entry>
<title>Add valgrind suppression</title>
<updated>2020-01-15T06:57:54+00:00</updated>
<author>
<name>Lei YU</name>
<email>mine260309@gmail.com</email>
</author>
<published>2019-09-25T09:58:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/sdbusplus/commit/?id=199b3b1299ff66b9ea7e0fadb66d5338087eee1a'/>
<id>urn:sha1:199b3b1299ff66b9ea7e0fadb66d5338087eee1a</id>
<content type='text'>
On latest OpenBMC, sdbusplus CI fails due to valgrind check like below
on ppc64le systems:

    ==5290== Syscall param epoll_ctl(event) points to uninitialised byte(s)
    ==5290==    at 0x4F2FB08: epoll_ctl (syscall-template.S:79)
    ==5290==    by 0x493A8F7: UnknownInlinedFun (sd-event.c:961)
    ==5290==    by 0x493A8F7: sd_event_add_time (sd-event.c:1019)
    ==5290==    by 0x190BB3: phosphor::Timer::Timer(sd_event*, std::function&lt;void ()&gt;) (timer.hpp:62)
    ==5290==    by 0x192B93: TimerTest::TimerTest() (timer.cpp:25)
    ==5290==    by 0x193A13: TimerTest_timerExpiresAfter2seconds_Test::TimerTest_timerExpiresAfter2seconds_Test() (timer.cpp:85)
    ==5290==    by 0x19E11F: testing::internal::TestFactoryImpl&lt;TimerTest_timerExpiresAfter2seconds_Test&gt;::CreateTest() (gtest-internal.h:472)
    ==5290==    by 0x4A52D3B: HandleSehExceptionsInMethodIfSupported&lt;testing::internal::TestFactoryBase, testing::Test*&gt; (gtest.cc:2447)
    ==5290==    by 0x4A52D3B: testing::Test* testing::internal::HandleExceptionsInMethodIfSupported&lt;testing::internal::TestFactoryBase, testing::Test*&gt;(testing::internal::TestFactoryBase*, testing::Test
    * (testing::internal::TestFactoryBase::*)(), char const*) (gtest.cc:2483)
    ==5290==    by 0x4A40BCB: Run (gtest.cc:2693)
    ==5290==    by 0x4A40BCB: testing::TestInfo::Run() (gtest.cc:2676)
    ==5290==    by 0x4A40DC3: Run (gtest.cc:2825)
    ==5290==    by 0x4A40DC3: testing::TestCase::Run() (gtest.cc:2810)
    ==5290==    by 0x4A414AF: testing::internal::UnitTestImpl::RunAllTests() (gtest.cc:5216)
    ==5290==    by 0x4A5329B: HandleSehExceptionsInMethodIfSupported&lt;testing::internal::UnitTestImpl, bool&gt; (gtest.cc:2447)
    ==5290==    by 0x4A5329B: bool testing::internal::HandleExceptionsInMethodIfSupported&lt;testing::internal::UnitTestImpl, bool&gt;(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::
    *)(), char const*) (gtest.cc:2483)
    ==5290==    by 0x4A416AF: testing::UnitTest::Run() (gtest.cc:4824)
    ==5290==    by 0x4A90917: RUN_ALL_TESTS (gtest.h:2370)
    ==5290==    by 0x4A90917: main (gmock_main.cc:69)
    ==5290==  Address 0x1fff00eafc is on thread 1's stack
    ==5290==  in frame #0, created by epoll_ctl (syscall-template.S:78)
    ==5290==

The root cause is:
1. GCC has a bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77992,
   that the padding bytes are not initialized.
2. In systemd, the code in [libsystemd/sd-event/sd-event.c][1] using
   epoll_event hit the above bug:

       typedef union epoll_data
       {
         void *ptr;
         int fd;
         uint32_t u32;
         uint64_t u64;
       } epoll_data_t;

       struct epoll_event
       {
         uint32_t events;      /* Epoll events */
         epoll_data_t data;    /* User data variable */
       } __EPOLL_PACKED;

   In glibc, on x86, `__EPOLL_PACKED` is defined as `__attribute__
   ((__packed__))`[2], so it's packed and there are no internal padding
   bytes;
   On other architectures (e.g. ppc64le), __EPOLL_PACKED is not defined
   and thus there are 4 internal padding bytes between `events` and
   `data`, that are not initialized.
3. When epoll_ctl() is invoked, in [Linux kernel][3], it does a
   copy_from_user() to copy the whole struct into kernel space. That's
   why Valgrind reports "epoll_ctl(event) points to uninitialised
   byte(s)", only for non-x86 platforms.
4. The timer test in this repo invokes sd_event_add_time() and
   eventually hit the above code.

The GCC bug is not resolved from 2016.
The systemd code is actually correct. There is a [PR][4] sent to systemd
trying to workaround the issue, and it is being discussed.

Before GCC bug is resolved or systemd PR is accepted, suppress the
valgrind error to make it pass the CI.

[1]: https://github.com/systemd/systemd/blob/v242/src/libsystemd/sd-event/sd-event.c#L961
[2]: https://github.com/bminor/glibc/blob/f1a0eb5b6762b315517469da47735c51bde6f4ad/sysdeps/unix/sysv/linux/x86/bits/epoll.h#L29
[3]: https://github.com/torvalds/linux/blob/d1eef1c619749b2a57e514a3fa67d9a516ffa919/fs/eventpoll.c#L2095
[4]: https://github.com/systemd/systemd/pull/14353

Signed-off-by: Lei YU &lt;mine260309@gmail.com&gt;
Change-Id: I3a29fd0e28e5c7b69037a7ef2ef9571f93d80df7
</content>
</entry>
<entry>
<title>Fix vtable CI error</title>
<updated>2020-01-15T06:57:52+00:00</updated>
<author>
<name>Lei YU</name>
<email>mine260309@gmail.com</email>
</author>
<published>2019-12-13T06:48:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/sdbusplus/commit/?id=d35c85239a85a101e866a7bd60aff4f40bf77401'/>
<id>urn:sha1:d35c85239a85a101e866a7bd60aff4f40bf77401</id>
<content type='text'>
The CI reports failure in VtableTest.SameContent, where the case is
comparing the binary of example vtables constructed from sdbusplus and
macros defined in systemd.

The root cause has two parts.

Part I:
When systemd is updated, the members in struct
sd_bus_vtable is updated, e.g.
* From v239 to v242, sd_bus_vtable.x.start is updated from
      struct {
              size_t element_size;
      } start;
  to:
      struct {
              size_t element_size;
              uint64_t features;
      } start;
  and sd_bus_vtable.x.method is updated from
      struct {
              const char *member;
              const char *signature;
              const char *result;
              sd_bus_message_handler_t handler;
              size_t offset;
      } method;
  to:
      struct {
              const char *member;
              const char *signature;
              const char *result;
              sd_bus_message_handler_t handler;
              size_t offset;
              const char *names;
      } method;
* From v242 to v243, sd_bus_vtable.x.start is updated to
      struct {
              size_t element_size;
              uint64_t features;
              const unsigned *vtable_format_reference;
      } start;

The code in vtable.hpp only assign the members in v239, the new
members are intialized with 0, so it differs from the vtable
constructed from macros defined by systemd.

The fix is to use macros from systemd in vtable.hpp as well,
which is suggested by systemd:

&gt; Please do not initialize this structure directly, use the
&gt; macros below instead

Part II:
The `const char *names` in struct method and signal introduced
between systemd v239 and v242 is a pointer to const strings.

By default they are "empty" strings, but there is no guarantee
that the compiler will use the same pointer for the same string.

So the test case can not assume the binaries are the same for
two vtables even they are constructed with the same parameters.

Update the test case to use real `const char*` and handler/get/set
functions and check each member of the struct instead of comparing the
binary data by memcmp.

Tested: Verify the CI passes.

Change-Id: I9e94ff16075dd3f12d73e96438c0d864203bdcf4
Signed-off-by: Lei YU &lt;mine260309@gmail.com&gt;
</content>
</entry>
</feed>
