-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add method and property flags to code generator #17
Add method and property flags to code generator #17
Conversation
Hi @MarkAtBosch Thanks for the pull request! Despite the presence on Github, this project's workflow is for patches to be reviewed and merged through OpenBMC's Gerrit instance. If you don't mind, please push your patches there. The docs repository has a small write-up on how to configure your tools for Gerrit. If you need further help please get in touch either here, on IRC (#openbmc on freenode) or via the mailing list (openbmc@lists.ozlabs.org). |
sd-bus allows to specify flags for methods in the vtable. The sdbus++ code generator does not support that yet. This commit adds support for sd-bus method flags unprivileged, deprecated, hidden, and no_reply. Change-Id: I327fbe08dd2dda3d378e41c28e4b04ee15d03523 Signed-off-by: Zhu Yi <yi.zhu5@cn.bosch.com> Signed-off-by: Mark Jonas <mark.jonas@de.bosch.com>
sd-bus allows to specify flags for properties in the vtable. The sdbusplus code generator currently does not support specifying property flags. This patch adds support for the sd-bus property flags deprecated, hidden, unprivileged, const, emits_change, emits_invalidation, explicit and readonly. The flag 'readonly' is used to prohibit the client from changing the property. If const is set, readonly is implied. Change-Id: I045c107fcadbbe47dd41f8ea42c4c54c327a0cad Signed-off-by: Zhu Yi <yi.zhu5@cn.bosch.com> Signed-off-by: Ruan Tingquan <tingquan.ruan@cn.bosch.com> Signed-off-by: Mark Jonas <mark.jonas@de.bosch.com>
15c635a
to
706d260
Compare
@amboar Thank you for your kind hint. Here are the Gerrit reviews: https://gerrit.openbmc-project.xyz/#/c/9665/ |
Problem: Current sdbusplus will use sd_bus_message_read_basic and message_append_basic for decoding and encoding of arrays, no matter is the array element type is sized or unsized. This leads to some extreme performance downgrade in some cases, for example, passing a 4K bytes data array over sdbusplus interface now takes 4096 calls of sd_bus_message_read_basic and message_append_basic for each byte in the message, this will consume about 10ms CPU time on a Aspeed 2600 platform for each package on both send and receive side. Example callstack in MCTPD for decoding an incoming package with 4KB payload: (gdb) bt #0 sd_bus_message_read_basic (m=0x0, type=0 '\000', p=0x7ebd1438) at /usr/src/debug/systemd/1_253.3-r0/src/libsystemd/sd-bus/bus-message.c:2701 #1 0x004b4f38 in sdbusplus::message::details::read_single<unsigned char>::op<unsigned char&> (t=<optimized out>, m=0x54f234, intf=0x76f0ae44) at /usr/include/sdbusplus/message/read.hpp:144 #2 sdbusplus::message::details::read_tuple<std::tuple<unsigned char&> > (intf=intf@entry=0x76f17010 <sdbusplus::sdbus_impl>, m=m@entry=0x16faaa0, t=...) at /usr/include/sdbusplus/message/read.hpp:478 #3 0x004b5a20 in sdbusplus::message::details::read_grouping<std::tuple<>, unsigned char&>(sdbusplus::SdBusInterface*, sd_bus_message*, std::tuple<>&&, unsigned char&) ( arg=<optimized out>, t=..., m=0x16faaa0, intf=0x76f17010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/read.hpp:534 #4 sdbusplus::message::read<unsigned char&> (m=0x16faaa0, intf=0x76f17010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/read.hpp:585 #5 sdbusplus::message::details::tuple_item_read<unsigned char&> (t=<optimized out>, m=0x16faaa0, intf=0x76f17010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/read.hpp:434 #6 sdbusplus::message::details::ReadHelper<1>::op<unsigned char&, unsigned char&> (field_tuple=..., m=0x16faaa0, intf=0x76f17010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/read.hpp:451 #7 sdbusplus::message::details::ReadHelper<2>::op<unsigned char&, unsigned char&> (field_tuple=..., m=0x16faaa0, intf=0x76f17010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/read.hpp:448 #8 sdbusplus::message::details::read_tuple<std::tuple<unsigned char&, unsigned char&> > (t=..., m=0x16faaa0, intf=0x76f17010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/read.hpp:473 #9 sdbusplus::message::details::read_grouping<std::tuple<unsigned char&, unsigned char&>, bool&, std::vector<unsigned char, std::allocator<unsigned char> >&> ( intf=0x76f17010 <sdbusplus::sdbus_impl>, m=0x16faaa0, t=..., arg=@0x7ebd1410: false) at /usr/include/sdbusplus/message/read.hpp:575 #10 0x0049cd80 in sdbusplus::message::details::read_grouping<std::tuple<unsigned char&>, unsigned char&, bool&, std::vector<unsigned char, std::allocator<unsigned char> >&> ( arg=@0x7ebd1409: 0 '\000', t=..., m=<optimized out>, intf=<optimized out>) at /usr/include/sdbusplus/message/read.hpp:560 #11 sdbusplus::message::details::read_grouping<std::tuple<>, unsigned char&, unsigned char&, bool&, std::vector<unsigned char, std::allocator<unsigned char> >&>(sdbusplus::SdBusInterface*, sd_bus_message*, std::tuple<>&&, unsigned char&, unsigned char&, bool&, std::vector<unsigned char, std::allocator<unsigned char> >&) (arg=@0x7ebd140a: 0 '\000', t=..., m=<optimized out>, intf=<optimized out>) at /usr/include/sdbusplus/message/read.hpp:560 #12 sdbusplus::message::read<unsigned char&, unsigned char&, bool&, std::vector<unsigned char, std::allocator<unsigned char> >&> (m=<optimized out>, intf=<optimized out>) at /usr/include/sdbusplus/message/read.hpp:585 #13 sdbusplus::message::message::read<unsigned char&, unsigned char&, bool&, std::vector<unsigned char, std::allocator<unsigned char> >&> (this=0x7ebd151c) at /usr/include/sdbusplus/message.hpp:156 #14 _ZZN9sdbusplus7utility15read_into_tupleISt5tupleIJhhbSt6vectorIhSaIhEEEEEEbRT_RNS_7message7messageEENKUlDpT_E_clIJSt17integral_constantIjLj0EESG_IjLj1EESG_IjLj2EESG_IjLj3EEEEEDaSD_ (__closure=<synthetic pointer>) at /usr/include/sdbusplus/utility/read_into_tuple.hpp:48 #15 _ZN9sdbusplus7utility6detail16index_apply_implIZNS0_15read_into_tupleISt5tupleIJhhbSt6vectorIhSaIhEEEEEEbRT_RNS_7message7messageEEUlDpT_E_JLj0ELj1ELj2ELj3EEEEDaS9_St16integer_sequenceIjJXspT0_EEE (f=...) at /usr/include/sdbusplus/utility/read_into_tuple.hpp:32 --Type <RET> for more, q to quit, c to continue without paging-- #16 _ZN9sdbusplus7utility6detail11index_applyILj4EZNS0_15read_into_tupleISt5tupleIJhhbSt6vectorIhSaIhEEEEEEbRT_RNS_7message7messageEEUlDpT_E_EEDaT0_ (f=...) at /usr/include/sdbusplus/utility/read_into_tuple.hpp:37 #17 sdbusplus::utility::read_into_tuple<std::tuple<unsigned char, unsigned char, bool, std::vector<unsigned char, std::allocator<unsigned char> > > > (m=..., t=...) at /usr/include/sdbusplus/utility/read_into_tuple.hpp:43 #18 sdbusplus::asio::callback_method_instance<MctpBinding::MctpBinding(std::shared_ptr<sdbusplus::asio::connection>, std::shared_ptr<sdbusplus::asio::object_server>&, const std::string&, const Configuration&, boost::asio::io_context&, sdbusplus::common::xyz::openbmc_project::mctp::Base::BindingTypes)::<lambda(uint8_t, uint8_t, bool, std::vector<unsigned char, std::allocator<unsigned char> >)> >::operator() (m=..., this=0x16ec278) at /usr/include/sdbusplus/asio/object_server.hpp:193 #19 std::__invoke_impl<int, sdbusplus::asio::callback_method_instance<MctpBinding::MctpBinding(std::shared_ptr<sdbusplus::asio::connection>, std::shared_ptr<sdbusplus::asio::object_server>&, const std::string&, const Configuration&, boost::asio::io_context&, sdbusplus::common::xyz::openbmc_project::mctp::Base::BindingTypes)::<lambda(uint8_t, uint8_t, bool, std::vector<unsigned char>)> >&, sdbusplus::message::message&> (__f=...) at /usr/include/c++/13.1.1/bits/invoke.h:61 #20 std::__invoke_r<int, sdbusplus::asio::callback_method_instance<MctpBinding::MctpBinding(std::shared_ptr<sdbusplus::asio::connection>, std::shared_ptr<sdbusplus::asio::object_server>&, const std::string&, const Configuration&, boost::asio::io_context&, sdbusplus::common::xyz::openbmc_project::mctp::Base::BindingTypes)::<lambda(uint8_t, uint8_t, bool, std::vector<unsigned char>)> >&, sdbusplus::message::message&> (__fn=...) at /usr/include/c++/13.1.1/bits/invoke.h:114 #21 std::_Function_handler<int(sdbusplus::message::message&), sdbusplus::asio::callback_method_instance<MctpBinding::MctpBinding(std::shared_ptr<sdbusplus::asio::connection>, std::shared_ptr<sdbusplus::asio::object_server>&, const std::string&, const Configuration&, boost::asio::io_context&, sdbusplus::common::xyz::openbmc_project::mctp::Base::BindingTypes)::<lambda(uint8_t, uint8_t, bool, std::vector<unsigned char, std::allocator<unsigned char> >)> > >::_M_invoke(const std::_Any_data &, sdbusplus::message::message &) (__functor=..., __args#0=...) at /usr/include/c++/13.1.1/bits/std_function.h:290 #22 0x004a192c in std::function<int (sdbusplus::message::message&)>::operator()(sdbusplus::message::message&) const (__args#0=..., this=0x16ec278) at /usr/include/c++/13.1.1/bits/std_function.h:591 #23 sdbusplus::asio::dbus_interface::method_handler (m=<optimized out>, userdata=0x16ec260, error=0x7ebd1578) at /usr/include/sdbusplus/asio/object_server.hpp:700 #24 0x76d7ca68 in method_callbacks_run (bus=0x16ea950, m=0x16faaa0, c=0x16ed010, require_fallback=false, found_object=0x7ebd160b) at /usr/src/debug/systemd/1_253.3-r0/src/libsystemd/sd-bus/bus-objects.c:406 #25 0x76d805d8 in object_find_and_run (bus=0x16ea950, m=0x16faaa0, p=0x16f99e0 "/xyz/openbmc_project/mctp", require_fallback=false, found_object=0x7ebd160b) at /usr/src/debug/systemd/1_253.3-r0/src/libsystemd/sd-bus/bus-objects.c:1319 #26 0x76d80e18 in bus_process_object (bus=0x16ea950, m=0x16faaa0) at /usr/src/debug/systemd/1_253.3-r0/src/libsystemd/sd-bus/bus-objects.c:1439 #27 0x76da3b9c in process_message (bus=0x16ea950, m=0x16faaa0) at /usr/src/debug/systemd/1_253.3-r0/src/libsystemd/sd-bus/sd-bus.c:2976 Similarly for PLDMD to send a package with 4KB data payload: (gdb) bt #0 message_append_basic (m=0x7a84580, type=121 'y', p=0x7a8ad03, stored=0x0) at /usr/src/debug/sdbus-c++-libsystemd/250.9-r0/src/libsystemd/sd-bus/bus-message.c:1583 #1 0x76f1603c in sdbusplus::message::details::append_single<unsigned char, void>::op<unsigned char const&> (t=<optimized out>, m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:165 #2 sdbusplus::message::details::append_tuple<std::tuple<unsigned char const&> > (intf=intf@entry=0x76ede010 <sdbusplus::sdbus_impl>, m=m@entry=0x7a84580, t=...) at /usr/include/sdbusplus/message/append.hpp:415 #3 0x76f160c0 in sdbusplus::message::details::append_grouping<std::tuple<>, unsigned char const&>(sdbusplus::SdBusInterface*, sd_bus_message*, std::tuple<>&&, unsigned char const&) (arg=@0x7a8ad03: 46 '.', t=..., m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:481 #4 sdbusplus::message::append<unsigned char const&> (m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:535 #5 sdbusplus::message::details::append_single<std::vector<unsigned char, std::allocator<unsigned char> >, void>::op<std::vector<unsigned char, std::allocator<unsigned char> > const&> (s=..., m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:281 #6 sdbusplus::message::details::append_tuple<std::tuple<std::vector<unsigned char, std::allocator<unsigned char> > const&> > (intf=intf@entry=0x76ede010 <sdbusplus::sdbus_impl>, m=m@entry=0x7a84580, t=...) at /usr/include/sdbusplus/message/append.hpp:415 #7 0x76f161bc in sdbusplus::message::details::append_grouping<std::tuple<>, std::vector<unsigned char, std::allocator<unsigned char> > const&>(sdbusplus::SdBusInterface*, sd_bus_message*, std::tuple<>&&, std::vector<unsigned char, std::allocator<unsigned char> > const&) (arg=..., t=..., m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:497 #8 sdbusplus::message::details::append_grouping<std::tuple<unsigned char const&, unsigned char const&>, bool const&, std::vector<unsigned char, std::allocator<unsigned char> > const&> (arg=@0x7aa3eb0: 240, t=..., m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:527 #9 sdbusplus::message::details::append_grouping<std::tuple<unsigned char const&>, unsigned char const&, bool const&, std::vector<unsigned char, std::allocator<unsigned char> > const&> (arg=@0x7a846ec: 0 '\000', t=..., m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:508 #10 sdbusplus::message::details::append_grouping<std::tuple<>, unsigned char const&, unsigned char const&, bool const&, std::vector<unsigned char, std::allocator<unsigned char> > const&>(sdbusplus::SdBusInterface*, sd_bus_message*, std::tuple<>&&, unsigned char const&, unsigned char const&, bool const&, std::vector<unsigned char, std::allocator<unsigned char> > const&) (arg=@0x76f4a10d: 164 '\244', t=..., m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:508 #11 sdbusplus::message::append<unsigned char const&, unsigned char const&, bool const&, std::vector<unsigned char, std::allocator<unsigned char> > const&> ( intf=0x76ede010 <sdbusplus::sdbus_impl>, m=0x7a84580) at /usr/include/sdbusplus/message/append.hpp:535 #12 0x76f2bd68 in sdbusplus::message::message::append<unsigned char const&, unsigned char const&, bool const&, std::vector<unsigned char, std::allocator<unsigned char> > const&> ( this=0x7aa3db4) at /usr/include/c++/13.1.1/bits/unique_ptr.h:199 #13 sdbusplus::asio::connection::yield_method_call<int, unsigned char, unsigned char, bool, std::vector<unsigned char, std::allocator<unsigned char> > > ( this=this@entry=0x7a7719c, yield=..., ec=..., service=..., objpath=..., interf=..., method=...) at /usr/include/sdbusplus/asio/connection.hpp:240 #14 0x76f042bc in mctpw::MCTPImpl::sendYield (this=<optimized out>, yield=..., dstEId=<optimized out>, dstEId@entry=9 '\t', msgTag=<optimized out>, msgTag@entry=84 'T', tagOwner=<optimized out>, tagOwner@entry=172, request=...) at /usr/src/debug/mctpwplus/1.0+git999-r0/mctpwplus/mctp_impl.cpp:612 #15 0x76ef3e28 in mctpw::MCTPWrapper::sendYield (this=<optimized out>, yield=..., dstEId=dstEId@entry=9 '\t', msgTag=msgTag@entry=0 '\000', tagOwner=tagOwner@entry=false, --Type <RET> for more, q to quit, c to continue without paging-- request=...) at /usr/src/debug/mctpwplus/1.0+git999-r0/mctpwplus/mctp_wrapper.cpp:128 #16 0x004dccac in pldm::sendPldmMessageEid (yield=..., eid=eid@entry=9 '\t', retryCount=retryCount@entry=3 '\003', msgTag=msgTag@entry=0 '\000', tagOwner=6, tagOwner@entry=false, payload=<error reading variable: Cannot access memory at address 0x0>, type=<optimized out>) at /usr/include/c++/13.1.1/bits/unique_ptr.h:19 Solution: When the array's element type is sized, use sd_bus_message_append_array_space and sd_bus_message_read_array instead. Test: Tested I3C boot with PLDMD and MCTPD Change-Id: I6235ce27fc50dd7317ecf0a48fa3340c9fbc8d3b Signed-off-by: Yongbing Chen <yongbingchen@google.com>
Problem: Current sdbusplus will use sd_bus_message_read_basic and message_append_basic for decoding and encoding of arrays, no matter is the array element type is sized or unsized. This leads to some extreme performance downgrade in some cases, for example, passing a 4K bytes data array over sdbusplus interface now takes 4096 calls of sd_bus_message_read_basic and message_append_basic for each byte in the message, this will consume about 10ms CPU time on a Aspeed 2600 platform for each package on both send and receive side. Example callstack in MCTPD for decoding an incoming package with 4KB payload: ```sh (gdb) bt #0 sd_bus_message_read_basic (m=0x0, type=0 '\000', p=0x7ebd1438) at /usr/src/debug/systemd/1_253.3-r0/src/libsystemd/sd-bus/bus-message.c:2701 #1 0x004b4f38 in sdbusplus::message::details::read_single<unsigned char>::op<unsigned char&> (t=<optimized out>, m=0x54f234, intf=0x76f0ae44) at /usr/include/sdbusplus/message/read.hpp:144 #2 sdbusplus::message::details::read_tuple<std::tuple<unsigned char&> > (intf=intf@entry=0x76f17010 <sdbusplus::sdbus_impl>, m=m@entry=0x16faaa0, t=...) at /usr/include/sdbusplus/message/read.hpp:478 #3 0x004b5a20 in sdbusplus::message::details::read_grouping<std::tuple<>, unsigned char&>(sdbusplus::SdBusInterface*, sd_bus_message*, std::tuple<>&&, unsigned char&) ( arg=<optimized out>, t=..., m=0x16faaa0, intf=0x76f17010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/read.hpp:534 #4 sdbusplus::message::read<unsigned char&> (m=0x16faaa0, intf=0x76f17010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/read.hpp:585 #5 sdbusplus::message::details::tuple_item_read<unsigned char&> (t=<optimized out>, m=0x16faaa0, intf=0x76f17010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/read.hpp:434 #6 sdbusplus::message::details::ReadHelper<1>::op<unsigned char&, unsigned char&> (field_tuple=..., m=0x16faaa0, intf=0x76f17010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/read.hpp:451 #7 sdbusplus::message::details::ReadHelper<2>::op<unsigned char&, unsigned char&> (field_tuple=..., m=0x16faaa0, intf=0x76f17010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/read.hpp:448 #8 sdbusplus::message::details::read_tuple<std::tuple<unsigned char&, unsigned char&> > (t=..., m=0x16faaa0, intf=0x76f17010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/read.hpp:473 #9 sdbusplus::message::details::read_grouping<std::tuple<unsigned char&, unsigned char&>, bool&, std::vector<unsigned char, std::allocator<unsigned char> >&> ( intf=0x76f17010 <sdbusplus::sdbus_impl>, m=0x16faaa0, t=..., arg=@0x7ebd1410: false) at /usr/include/sdbusplus/message/read.hpp:575 #10 0x0049cd80 in sdbusplus::message::details::read_grouping<std::tuple<unsigned char&>, unsigned char&, bool&, std::vector<unsigned char, std::allocator<unsigned char> >&> ( arg=@0x7ebd1409: 0 '\000', t=..., m=<optimized out>, intf=<optimized out>) at /usr/include/sdbusplus/message/read.hpp:560 #11 sdbusplus::message::details::read_grouping<std::tuple<>, unsigned char&, unsigned char&, bool&, std::vector<unsigned char, std::allocator<unsigned char> >&>(sdbusplus::SdBusInterface*, sd_bus_message*, std::tuple<>&&, unsigned char&, unsigned char&, bool&, std::vector<unsigned char, std::allocator<unsigned char> >&) (arg=@0x7ebd140a: 0 '\000', t=..., m=<optimized out>, intf=<optimized out>) at /usr/include/sdbusplus/message/read.hpp:560 #12 sdbusplus::message::read<unsigned char&, unsigned char&, bool&, std::vector<unsigned char, std::allocator<unsigned char> >&> (m=<optimized out>, intf=<optimized out>) at /usr/include/sdbusplus/message/read.hpp:585 #13 sdbusplus::message::message::read<unsigned char&, unsigned char&, bool&, std::vector<unsigned char, std::allocator<unsigned char> >&> (this=0x7ebd151c) at /usr/include/sdbusplus/message.hpp:156 #14 _ZZN9sdbusplus7utility15read_into_tupleISt5tupleIJhhbSt6vectorIhSaIhEEEEEEbRT_RNS_7message7messageEENKUlDpT_E_clIJSt17integral_constantIjLj0EESG_IjLj1EESG_IjLj2EESG_IjLj3EEEEEDaSD_ (__closure=<synthetic pointer>) at /usr/include/sdbusplus/utility/read_into_tuple.hpp:48 #15 _ZN9sdbusplus7utility6detail16index_apply_implIZNS0_15read_into_tupleISt5tupleIJhhbSt6vectorIhSaIhEEEEEEbRT_RNS_7message7messageEEUlDpT_E_JLj0ELj1ELj2ELj3EEEEDaS9_St16integer_sequenceIjJXspT0_EEE (f=...) at /usr/include/sdbusplus/utility/read_into_tuple.hpp:32 --Type <RET> for more, q to quit, c to continue without paging-- #16 _ZN9sdbusplus7utility6detail11index_applyILj4EZNS0_15read_into_tupleISt5tupleIJhhbSt6vectorIhSaIhEEEEEEbRT_RNS_7message7messageEEUlDpT_E_EEDaT0_ (f=...) at /usr/include/sdbusplus/utility/read_into_tuple.hpp:37 #17 sdbusplus::utility::read_into_tuple<std::tuple<unsigned char, unsigned char, bool, std::vector<unsigned char, std::allocator<unsigned char> > > > (m=..., t=...) at /usr/include/sdbusplus/utility/read_into_tuple.hpp:43 #18 sdbusplus::asio::callback_method_instance<MctpBinding::MctpBinding(std::shared_ptr<sdbusplus::asio::connection>, std::shared_ptr<sdbusplus::asio::object_server>&, const std::string&, const Configuration&, boost::asio::io_context&, sdbusplus::common::xyz::openbmc_project::mctp::Base::BindingTypes)::<lambda(uint8_t, uint8_t, bool, std::vector<unsigned char, std::allocator<unsigned char> >)> >::operator() (m=..., this=0x16ec278) at /usr/include/sdbusplus/asio/object_server.hpp:193 #19 std::__invoke_impl<int, sdbusplus::asio::callback_method_instance<MctpBinding::MctpBinding(std::shared_ptr<sdbusplus::asio::connection>, std::shared_ptr<sdbusplus::asio::object_server>&, const std::string&, const Configuration&, boost::asio::io_context&, sdbusplus::common::xyz::openbmc_project::mctp::Base::BindingTypes)::<lambda(uint8_t, uint8_t, bool, std::vector<unsigned char>)> >&, sdbusplus::message::message&> (__f=...) at /usr/include/c++/13.1.1/bits/invoke.h:61 #20 std::__invoke_r<int, sdbusplus::asio::callback_method_instance<MctpBinding::MctpBinding(std::shared_ptr<sdbusplus::asio::connection>, std::shared_ptr<sdbusplus::asio::object_server>&, const std::string&, const Configuration&, boost::asio::io_context&, sdbusplus::common::xyz::openbmc_project::mctp::Base::BindingTypes)::<lambda(uint8_t, uint8_t, bool, std::vector<unsigned char>)> >&, sdbusplus::message::message&> (__fn=...) at /usr/include/c++/13.1.1/bits/invoke.h:114 #21 std::_Function_handler<int(sdbusplus::message::message&), sdbusplus::asio::callback_method_instance<MctpBinding::MctpBinding(std::shared_ptr<sdbusplus::asio::connection>, std::shared_ptr<sdbusplus::asio::object_server>&, const std::string&, const Configuration&, boost::asio::io_context&, sdbusplus::common::xyz::openbmc_project::mctp::Base::BindingTypes)::<lambda(uint8_t, uint8_t, bool, std::vector<unsigned char, std::allocator<unsigned char> >)> > >::_M_invoke(const std::_Any_data &, sdbusplus::message::message &) (__functor=..., __args#0=...) at /usr/include/c++/13.1.1/bits/std_function.h:290 #22 0x004a192c in std::function<int (sdbusplus::message::message&)>::operator()(sdbusplus::message::message&) const (__args#0=..., this=0x16ec278) at /usr/include/c++/13.1.1/bits/std_function.h:591 #23 sdbusplus::asio::dbus_interface::method_handler (m=<optimized out>, userdata=0x16ec260, error=0x7ebd1578) at /usr/include/sdbusplus/asio/object_server.hpp:700 #24 0x76d7ca68 in method_callbacks_run (bus=0x16ea950, m=0x16faaa0, c=0x16ed010, require_fallback=false, found_object=0x7ebd160b) at /usr/src/debug/systemd/1_253.3-r0/src/libsystemd/sd-bus/bus-objects.c:406 #25 0x76d805d8 in object_find_and_run (bus=0x16ea950, m=0x16faaa0, p=0x16f99e0 "/xyz/openbmc_project/mctp", require_fallback=false, found_object=0x7ebd160b) at /usr/src/debug/systemd/1_253.3-r0/src/libsystemd/sd-bus/bus-objects.c:1319 #26 0x76d80e18 in bus_process_object (bus=0x16ea950, m=0x16faaa0) at /usr/src/debug/systemd/1_253.3-r0/src/libsystemd/sd-bus/bus-objects.c:1439 #27 0x76da3b9c in process_message (bus=0x16ea950, m=0x16faaa0) at /usr/src/debug/systemd/1_253.3-r0/src/libsystemd/sd-bus/sd-bus.c:2976 ``` Similarly for PLDMD to send a package with 4KB data payload: ```sh (gdb) bt #0 message_append_basic (m=0x7a84580, type=121 'y', p=0x7a8ad03, stored=0x0) at /usr/src/debug/sdbus-c++-libsystemd/250.9-r0/src/libsystemd/sd-bus/bus-message.c:1583 #1 0x76f1603c in sdbusplus::message::details::append_single<unsigned char, void>::op<unsigned char const&> (t=<optimized out>, m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:165 #2 sdbusplus::message::details::append_tuple<std::tuple<unsigned char const&> > (intf=intf@entry=0x76ede010 <sdbusplus::sdbus_impl>, m=m@entry=0x7a84580, t=...) at /usr/include/sdbusplus/message/append.hpp:415 #3 0x76f160c0 in sdbusplus::message::details::append_grouping<std::tuple<>, unsigned char const&>(sdbusplus::SdBusInterface*, sd_bus_message*, std::tuple<>&&, unsigned char const&) (arg=@0x7a8ad03: 46 '.', t=..., m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:481 #4 sdbusplus::message::append<unsigned char const&> (m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:535 #5 sdbusplus::message::details::append_single<std::vector<unsigned char, std::allocator<unsigned char> >, void>::op<std::vector<unsigned char, std::allocator<unsigned char> > const&> (s=..., m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:281 #6 sdbusplus::message::details::append_tuple<std::tuple<std::vector<unsigned char, std::allocator<unsigned char> > const&> > (intf=intf@entry=0x76ede010 <sdbusplus::sdbus_impl>, m=m@entry=0x7a84580, t=...) at /usr/include/sdbusplus/message/append.hpp:415 #7 0x76f161bc in sdbusplus::message::details::append_grouping<std::tuple<>, std::vector<unsigned char, std::allocator<unsigned char> > const&>(sdbusplus::SdBusInterface*, sd_bus_message*, std::tuple<>&&, std::vector<unsigned char, std::allocator<unsigned char> > const&) (arg=..., t=..., m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:497 #8 sdbusplus::message::details::append_grouping<std::tuple<unsigned char const&, unsigned char const&>, bool const&, std::vector<unsigned char, std::allocator<unsigned char> > const&> (arg=@0x7aa3eb0: 240, t=..., m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:527 #9 sdbusplus::message::details::append_grouping<std::tuple<unsigned char const&>, unsigned char const&, bool const&, std::vector<unsigned char, std::allocator<unsigned char> > const&> (arg=@0x7a846ec: 0 '\000', t=..., m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:508 #10 sdbusplus::message::details::append_grouping<std::tuple<>, unsigned char const&, unsigned char const&, bool const&, std::vector<unsigned char, std::allocator<unsigned char> > const&>(sdbusplus::SdBusInterface*, sd_bus_message*, std::tuple<>&&, unsigned char const&, unsigned char const&, bool const&, std::vector<unsigned char, std::allocator<unsigned char> > const&) (arg=@0x76f4a10d: 164 '\244', t=..., m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:508 #11 sdbusplus::message::append<unsigned char const&, unsigned char const&, bool const&, std::vector<unsigned char, std::allocator<unsigned char> > const&> ( intf=0x76ede010 <sdbusplus::sdbus_impl>, m=0x7a84580) at /usr/include/sdbusplus/message/append.hpp:535 #12 0x76f2bd68 in sdbusplus::message::message::append<unsigned char const&, unsigned char const&, bool const&, std::vector<unsigned char, std::allocator<unsigned char> > const&> ( this=0x7aa3db4) at /usr/include/c++/13.1.1/bits/unique_ptr.h:199 #13 sdbusplus::asio::connection::yield_method_call<int, unsigned char, unsigned char, bool, std::vector<unsigned char, std::allocator<unsigned char> > > ( this=this@entry=0x7a7719c, yield=..., ec=..., service=..., objpath=..., interf=..., method=...) at /usr/include/sdbusplus/asio/connection.hpp:240 #14 0x76f042bc in mctpw::MCTPImpl::sendYield (this=<optimized out>, yield=..., dstEId=<optimized out>, dstEId@entry=9 '\t', msgTag=<optimized out>, msgTag@entry=84 'T', tagOwner=<optimized out>, tagOwner@entry=172, request=...) at /usr/src/debug/mctpwplus/1.0+git999-r0/mctpwplus/mctp_impl.cpp:612 #15 0x76ef3e28 in mctpw::MCTPWrapper::sendYield (this=<optimized out>, yield=..., dstEId=dstEId@entry=9 '\t', msgTag=msgTag@entry=0 '\000', tagOwner=tagOwner@entry=false, --Type <RET> for more, q to quit, c to continue without paging-- request=...) at /usr/src/debug/mctpwplus/1.0+git999-r0/mctpwplus/mctp_wrapper.cpp:128 #16 0x004dccac in pldm::sendPldmMessageEid (yield=..., eid=eid@entry=9 '\t', retryCount=retryCount@entry=3 '\003', msgTag=msgTag@entry=0 '\000', tagOwner=6, tagOwner@entry=false, payload=<error reading variable: Cannot access memory at address 0x0>, type=<optimized out>) at /usr/include/c++/13.1.1/bits/unique_ptr.h:19 ``` Solution: When the vector or array's element type is trivially copyable, and is an integral type, then use sd_bus_message_append_array_space and sd_bus_message_read_array to do the message encode/decode instead. Test: Tested with intensive D-Bus transactions, which has large byte array as IPC message payload. The encode and decode time is negligible now compare to the IPC delay (down from 10ms to less than 1ms) Change-Id: I6235ce27fc50dd7317ecf0a48fa3340c9fbc8d3b Signed-off-by: Yongbing Chen <yongbingchen@google.com>
Problem: Current sdbusplus will use sd_bus_message_read_basic and message_append_basic for decoding and encoding of arrays, no matter is the array element type is sized or unsized. This leads to some extreme performance downgrade in some cases, for example, passing a 4K bytes data array over sdbusplus interface now takes 4096 calls of sd_bus_message_read_basic and message_append_basic for each byte in the message, this will consume about 10ms CPU time on a Aspeed 2600 platform for each package on both send and receive side. Example callstack in MCTPD for decoding an incoming package with 4KB payload: ```sh (gdb) bt #0 sd_bus_message_read_basic (m=0x0, type=0 '\000', p=0x7ebd1438) at /usr/src/debug/systemd/1_253.3-r0/src/libsystemd/sd-bus/bus-message.c:2701 #1 0x004b4f38 in sdbusplus::message::details::read_single<unsigned char>::op<unsigned char&> (t=<optimized out>, m=0x54f234, intf=0x76f0ae44) at /usr/include/sdbusplus/message/read.hpp:144 #2 sdbusplus::message::details::read_tuple<std::tuple<unsigned char&> > (intf=intf@entry=0x76f17010 <sdbusplus::sdbus_impl>, m=m@entry=0x16faaa0, t=...) at /usr/include/sdbusplus/message/read.hpp:478 #3 0x004b5a20 in sdbusplus::message::details::read_grouping<std::tuple<>, unsigned char&>(sdbusplus::SdBusInterface*, sd_bus_message*, std::tuple<>&&, unsigned char&) ( arg=<optimized out>, t=..., m=0x16faaa0, intf=0x76f17010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/read.hpp:534 #4 sdbusplus::message::read<unsigned char&> (m=0x16faaa0, intf=0x76f17010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/read.hpp:585 #5 sdbusplus::message::details::tuple_item_read<unsigned char&> (t=<optimized out>, m=0x16faaa0, intf=0x76f17010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/read.hpp:434 #6 sdbusplus::message::details::ReadHelper<1>::op<unsigned char&, unsigned char&> (field_tuple=..., m=0x16faaa0, intf=0x76f17010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/read.hpp:451 #7 sdbusplus::message::details::ReadHelper<2>::op<unsigned char&, unsigned char&> (field_tuple=..., m=0x16faaa0, intf=0x76f17010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/read.hpp:448 #8 sdbusplus::message::details::read_tuple<std::tuple<unsigned char&, unsigned char&> > (t=..., m=0x16faaa0, intf=0x76f17010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/read.hpp:473 #9 sdbusplus::message::details::read_grouping<std::tuple<unsigned char&, unsigned char&>, bool&, std::vector<unsigned char, std::allocator<unsigned char> >&> ( intf=0x76f17010 <sdbusplus::sdbus_impl>, m=0x16faaa0, t=..., arg=@0x7ebd1410: false) at /usr/include/sdbusplus/message/read.hpp:575 #10 0x0049cd80 in sdbusplus::message::details::read_grouping<std::tuple<unsigned char&>, unsigned char&, bool&, std::vector<unsigned char, std::allocator<unsigned char> >&> ( arg=@0x7ebd1409: 0 '\000', t=..., m=<optimized out>, intf=<optimized out>) at /usr/include/sdbusplus/message/read.hpp:560 #11 sdbusplus::message::details::read_grouping<std::tuple<>, unsigned char&, unsigned char&, bool&, std::vector<unsigned char, std::allocator<unsigned char> >&>(sdbusplus::SdBusInterface*, sd_bus_message*, std::tuple<>&&, unsigned char&, unsigned char&, bool&, std::vector<unsigned char, std::allocator<unsigned char> >&) (arg=@0x7ebd140a: 0 '\000', t=..., m=<optimized out>, intf=<optimized out>) at /usr/include/sdbusplus/message/read.hpp:560 #12 sdbusplus::message::read<unsigned char&, unsigned char&, bool&, std::vector<unsigned char, std::allocator<unsigned char> >&> (m=<optimized out>, intf=<optimized out>) at /usr/include/sdbusplus/message/read.hpp:585 #13 sdbusplus::message::message::read<unsigned char&, unsigned char&, bool&, std::vector<unsigned char, std::allocator<unsigned char> >&> (this=0x7ebd151c) at /usr/include/sdbusplus/message.hpp:156 #14 _ZZN9sdbusplus7utility15read_into_tupleISt5tupleIJhhbSt6vectorIhSaIhEEEEEEbRT_RNS_7message7messageEENKUlDpT_E_clIJSt17integral_constantIjLj0EESG_IjLj1EESG_IjLj2EESG_IjLj3EEEEEDaSD_ (__closure=<synthetic pointer>) at /usr/include/sdbusplus/utility/read_into_tuple.hpp:48 #15 _ZN9sdbusplus7utility6detail16index_apply_implIZNS0_15read_into_tupleISt5tupleIJhhbSt6vectorIhSaIhEEEEEEbRT_RNS_7message7messageEEUlDpT_E_JLj0ELj1ELj2ELj3EEEEDaS9_St16integer_sequenceIjJXspT0_EEE (f=...) at /usr/include/sdbusplus/utility/read_into_tuple.hpp:32 --Type <RET> for more, q to quit, c to continue without paging-- #16 _ZN9sdbusplus7utility6detail11index_applyILj4EZNS0_15read_into_tupleISt5tupleIJhhbSt6vectorIhSaIhEEEEEEbRT_RNS_7message7messageEEUlDpT_E_EEDaT0_ (f=...) at /usr/include/sdbusplus/utility/read_into_tuple.hpp:37 #17 sdbusplus::utility::read_into_tuple<std::tuple<unsigned char, unsigned char, bool, std::vector<unsigned char, std::allocator<unsigned char> > > > (m=..., t=...) at /usr/include/sdbusplus/utility/read_into_tuple.hpp:43 #18 sdbusplus::asio::callback_method_instance<MctpBinding::MctpBinding(std::shared_ptr<sdbusplus::asio::connection>, std::shared_ptr<sdbusplus::asio::object_server>&, const std::string&, const Configuration&, boost::asio::io_context&, sdbusplus::common::xyz::openbmc_project::mctp::Base::BindingTypes)::<lambda(uint8_t, uint8_t, bool, std::vector<unsigned char, std::allocator<unsigned char> >)> >::operator() (m=..., this=0x16ec278) at /usr/include/sdbusplus/asio/object_server.hpp:193 #19 std::__invoke_impl<int, sdbusplus::asio::callback_method_instance<MctpBinding::MctpBinding(std::shared_ptr<sdbusplus::asio::connection>, std::shared_ptr<sdbusplus::asio::object_server>&, const std::string&, const Configuration&, boost::asio::io_context&, sdbusplus::common::xyz::openbmc_project::mctp::Base::BindingTypes)::<lambda(uint8_t, uint8_t, bool, std::vector<unsigned char>)> >&, sdbusplus::message::message&> (__f=...) at /usr/include/c++/13.1.1/bits/invoke.h:61 #20 std::__invoke_r<int, sdbusplus::asio::callback_method_instance<MctpBinding::MctpBinding(std::shared_ptr<sdbusplus::asio::connection>, std::shared_ptr<sdbusplus::asio::object_server>&, const std::string&, const Configuration&, boost::asio::io_context&, sdbusplus::common::xyz::openbmc_project::mctp::Base::BindingTypes)::<lambda(uint8_t, uint8_t, bool, std::vector<unsigned char>)> >&, sdbusplus::message::message&> (__fn=...) at /usr/include/c++/13.1.1/bits/invoke.h:114 #21 std::_Function_handler<int(sdbusplus::message::message&), sdbusplus::asio::callback_method_instance<MctpBinding::MctpBinding(std::shared_ptr<sdbusplus::asio::connection>, std::shared_ptr<sdbusplus::asio::object_server>&, const std::string&, const Configuration&, boost::asio::io_context&, sdbusplus::common::xyz::openbmc_project::mctp::Base::BindingTypes)::<lambda(uint8_t, uint8_t, bool, std::vector<unsigned char, std::allocator<unsigned char> >)> > >::_M_invoke(const std::_Any_data &, sdbusplus::message::message &) (__functor=..., __args#0=...) at /usr/include/c++/13.1.1/bits/std_function.h:290 #22 0x004a192c in std::function<int (sdbusplus::message::message&)>::operator()(sdbusplus::message::message&) const (__args#0=..., this=0x16ec278) at /usr/include/c++/13.1.1/bits/std_function.h:591 #23 sdbusplus::asio::dbus_interface::method_handler (m=<optimized out>, userdata=0x16ec260, error=0x7ebd1578) at /usr/include/sdbusplus/asio/object_server.hpp:700 #24 0x76d7ca68 in method_callbacks_run (bus=0x16ea950, m=0x16faaa0, c=0x16ed010, require_fallback=false, found_object=0x7ebd160b) at /usr/src/debug/systemd/1_253.3-r0/src/libsystemd/sd-bus/bus-objects.c:406 #25 0x76d805d8 in object_find_and_run (bus=0x16ea950, m=0x16faaa0, p=0x16f99e0 "/xyz/openbmc_project/mctp", require_fallback=false, found_object=0x7ebd160b) at /usr/src/debug/systemd/1_253.3-r0/src/libsystemd/sd-bus/bus-objects.c:1319 #26 0x76d80e18 in bus_process_object (bus=0x16ea950, m=0x16faaa0) at /usr/src/debug/systemd/1_253.3-r0/src/libsystemd/sd-bus/bus-objects.c:1439 #27 0x76da3b9c in process_message (bus=0x16ea950, m=0x16faaa0) at /usr/src/debug/systemd/1_253.3-r0/src/libsystemd/sd-bus/sd-bus.c:2976 ``` Similarly for PLDMD to send a package with 4KB data payload: ```sh (gdb) bt #0 message_append_basic (m=0x7a84580, type=121 'y', p=0x7a8ad03, stored=0x0) at /usr/src/debug/sdbus-c++-libsystemd/250.9-r0/src/libsystemd/sd-bus/bus-message.c:1583 #1 0x76f1603c in sdbusplus::message::details::append_single<unsigned char, void>::op<unsigned char const&> (t=<optimized out>, m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:165 #2 sdbusplus::message::details::append_tuple<std::tuple<unsigned char const&> > (intf=intf@entry=0x76ede010 <sdbusplus::sdbus_impl>, m=m@entry=0x7a84580, t=...) at /usr/include/sdbusplus/message/append.hpp:415 #3 0x76f160c0 in sdbusplus::message::details::append_grouping<std::tuple<>, unsigned char const&>(sdbusplus::SdBusInterface*, sd_bus_message*, std::tuple<>&&, unsigned char const&) (arg=@0x7a8ad03: 46 '.', t=..., m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:481 #4 sdbusplus::message::append<unsigned char const&> (m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:535 #5 sdbusplus::message::details::append_single<std::vector<unsigned char, std::allocator<unsigned char> >, void>::op<std::vector<unsigned char, std::allocator<unsigned char> > const&> (s=..., m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:281 #6 sdbusplus::message::details::append_tuple<std::tuple<std::vector<unsigned char, std::allocator<unsigned char> > const&> > (intf=intf@entry=0x76ede010 <sdbusplus::sdbus_impl>, m=m@entry=0x7a84580, t=...) at /usr/include/sdbusplus/message/append.hpp:415 #7 0x76f161bc in sdbusplus::message::details::append_grouping<std::tuple<>, std::vector<unsigned char, std::allocator<unsigned char> > const&>(sdbusplus::SdBusInterface*, sd_bus_message*, std::tuple<>&&, std::vector<unsigned char, std::allocator<unsigned char> > const&) (arg=..., t=..., m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:497 #8 sdbusplus::message::details::append_grouping<std::tuple<unsigned char const&, unsigned char const&>, bool const&, std::vector<unsigned char, std::allocator<unsigned char> > const&> (arg=@0x7aa3eb0: 240, t=..., m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:527 #9 sdbusplus::message::details::append_grouping<std::tuple<unsigned char const&>, unsigned char const&, bool const&, std::vector<unsigned char, std::allocator<unsigned char> > const&> (arg=@0x7a846ec: 0 '\000', t=..., m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:508 #10 sdbusplus::message::details::append_grouping<std::tuple<>, unsigned char const&, unsigned char const&, bool const&, std::vector<unsigned char, std::allocator<unsigned char> > const&>(sdbusplus::SdBusInterface*, sd_bus_message*, std::tuple<>&&, unsigned char const&, unsigned char const&, bool const&, std::vector<unsigned char, std::allocator<unsigned char> > const&) (arg=@0x76f4a10d: 164 '\244', t=..., m=0x7a84580, intf=0x76ede010 <sdbusplus::sdbus_impl>) at /usr/include/sdbusplus/message/append.hpp:508 #11 sdbusplus::message::append<unsigned char const&, unsigned char const&, bool const&, std::vector<unsigned char, std::allocator<unsigned char> > const&> ( intf=0x76ede010 <sdbusplus::sdbus_impl>, m=0x7a84580) at /usr/include/sdbusplus/message/append.hpp:535 #12 0x76f2bd68 in sdbusplus::message::message::append<unsigned char const&, unsigned char const&, bool const&, std::vector<unsigned char, std::allocator<unsigned char> > const&> ( this=0x7aa3db4) at /usr/include/c++/13.1.1/bits/unique_ptr.h:199 #13 sdbusplus::asio::connection::yield_method_call<int, unsigned char, unsigned char, bool, std::vector<unsigned char, std::allocator<unsigned char> > > ( this=this@entry=0x7a7719c, yield=..., ec=..., service=..., objpath=..., interf=..., method=...) at /usr/include/sdbusplus/asio/connection.hpp:240 #14 0x76f042bc in mctpw::MCTPImpl::sendYield (this=<optimized out>, yield=..., dstEId=<optimized out>, dstEId@entry=9 '\t', msgTag=<optimized out>, msgTag@entry=84 'T', tagOwner=<optimized out>, tagOwner@entry=172, request=...) at /usr/src/debug/mctpwplus/1.0+git999-r0/mctpwplus/mctp_impl.cpp:612 #15 0x76ef3e28 in mctpw::MCTPWrapper::sendYield (this=<optimized out>, yield=..., dstEId=dstEId@entry=9 '\t', msgTag=msgTag@entry=0 '\000', tagOwner=tagOwner@entry=false, --Type <RET> for more, q to quit, c to continue without paging-- request=...) at /usr/src/debug/mctpwplus/1.0+git999-r0/mctpwplus/mctp_wrapper.cpp:128 #16 0x004dccac in pldm::sendPldmMessageEid (yield=..., eid=eid@entry=9 '\t', retryCount=retryCount@entry=3 '\003', msgTag=msgTag@entry=0 '\000', tagOwner=6, tagOwner@entry=false, payload=<error reading variable: Cannot access memory at address 0x0>, type=<optimized out>) at /usr/include/c++/13.1.1/bits/unique_ptr.h:19 ``` Solution: When the vector or array's element type is trivially copyable, and is an integral type, then use sd_bus_message_append_array_space and sd_bus_message_read_array to do the message encode/decode instead. Test: Tested with intensive D-Bus transactions, which has large byte array as IPC message payload. The encode and decode time is negligible now compare to the IPC delay (down from 10ms to less than 1ms) Change-Id: I6235ce27fc50dd7317ecf0a48fa3340c9fbc8d3b Signed-off-by: Yongbing Chen <yongbingchen@google.com>
sd-bus allows to specify flags for methods and properties in the vtable. The sdbusplus code generator currently does not support specifying these flags.
We propose the following two patches to: