All of lore.kernel.org
 help / color / mirror / Atom feed
* pthreads at bmcweb
@ 2021-01-06  8:02 Sunitha Harish
  2021-01-06 18:12 ` Milton Miller II
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Sunitha Harish @ 2021-01-06  8:02 UTC (permalink / raw)
  To: openbmc; +Cc: edtanous, apparao.puli

[-- Attachment #1: Type: text/plain, Size: 1357 bytes --]

Hi team,

Reference commit 
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/31735 :

In order to handle the multiple push-style event subscribers, bmc needs 
to support the async resolution of the subscribers address. The 
async_resolve() API crashes if there is no thread support in the binary.

I created a bmcweb binary patch by pulling this commit and including the 
pthread. This works fine for the use-cases, but increased the bmcweb 
binary size by 220KB.

Ed's suggestion is not to use the pthreads, instead implement 
alternatives to do the same job, so that the binary size is kept 
minimum. He mentioned: /"//Considering that's a ~30% increase in binary 
size to support one line off code, and most systems are already at their 
binary size limit, no, that's not going to be acceptable. We can either 
patch boost to use this 
//https://man7.org/linux/man-pages/man3/getaddrinfo_a.3.html 
<https://man7.org/linux/man-pages/man3/getaddrinfo_a.3.html>//or we 
could build our own resolver type that calls that underneath. This was 
based on a quick lookthrough of solutions in Google. I'm open to other 
ideas here". /

I am looking for the community views about the increased bmcweb binary 
size v/s having a custom implementation for asyc_resolve. Please share 
your views & ideas to get to the best solution.


Thanks & regards,
Sunitha



[-- Attachment #2: Type: text/html, Size: 4424 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re:  pthreads at bmcweb
  2021-01-06  8:02 pthreads at bmcweb Sunitha Harish
@ 2021-01-06 18:12 ` Milton Miller II
  2021-01-12  8:48   ` Sunitha Harish
  2021-01-12 13:05 ` Patrick Williams
  2021-01-19 16:48 ` Ed Tanous
  2 siblings, 1 reply; 6+ messages in thread
From: Milton Miller II @ 2021-01-06 18:12 UTC (permalink / raw)
  To: Sunitha Harish; +Cc: openbmc, apparao.puli, edtanous

On Jan 6, 2021 Sunitha Harish wrote:
>     Hi team,
>     Reference commit
>https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/31735 :
>     In order to handle the multiple push-style event subscribers,
>bmc       needs to support the async resolution of the subscribers
>address.       The async_resolve() API crashes if there is no thread
>support in       the binary. 
>     I created a bmcweb binary patch by pulling this commit and
>including the pthread. This works fine for the use-cases, but
>increased the bmcweb binary size by 220KB. 
?
>     Ed's suggestion is not to use the pthreads, instead implement
> alternatives to do the same job, so that the binary size is kept
>minimum. He mentioned: "Considering that's a ~30% increase in binary
>size to support one line off code, and most systems are already at
>their binary size limit, no, that's not going to be acceptable. We
>can either patch boost to use this
>https://man7.org/linux/man-pages/man3/getaddrinfo_a.3.html or we
>could build our own resolver type that calls that underneath.  This
>was based on a quick lookthrough of solutions in Google.  I'm open to
>other ideas here". 
>     I am looking for the community views about the increased bmcweb
>     binary size v/s having a custom implementation for asyc_resolve.
>      Please share your views & ideas to get to the best solution.

I agree with Ed that adding pthreads is a step that should be taken 
with a lot of caution.   In addition to the binary size, a threaded 
application also adds security audit concerns.

A quick search with the query of "dns lookup library embedded" found 
a possible library with a probably compatible license (although last 
update was 4 years ago), and the second link was a survey of other 
client and server packages that could be investigated.

My personal opinion only.

milton


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: pthreads at bmcweb
  2021-01-06 18:12 ` Milton Miller II
@ 2021-01-12  8:48   ` Sunitha Harish
  0 siblings, 0 replies; 6+ messages in thread
From: Sunitha Harish @ 2021-01-12  8:48 UTC (permalink / raw)
  To: Milton Miller II; +Cc: openbmc, apparao.puli, edtanous

Thanks Milton for sharing your views.

Awaiting more inputs/feedbacks from the community.

Regards,
Sunitha

On 06-01-2021 23:42, Milton Miller II wrote:
> On Jan 6, 2021 Sunitha Harish wrote:
>>      Hi team,
>>      Reference commit
>> https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/31735 :
>>      In order to handle the multiple push-style event subscribers,
>> bmc       needs to support the async resolution of the subscribers
>> address.       The async_resolve() API crashes if there is no thread
>> support in       the binary.
>>      I created a bmcweb binary patch by pulling this commit and
>> including the pthread. This works fine for the use-cases, but
>> increased the bmcweb binary size by 220KB.
> ?
>>      Ed's suggestion is not to use the pthreads, instead implement
>> alternatives to do the same job, so that the binary size is kept
>> minimum. He mentioned: "Considering that's a ~30% increase in binary
>> size to support one line off code, and most systems are already at
>> their binary size limit, no, that's not going to be acceptable. We
>> can either patch boost to use this
>> https://man7.org/linux/man-pages/man3/getaddrinfo_a.3.html or we
>> could build our own resolver type that calls that underneath.  This
>> was based on a quick lookthrough of solutions in Google.  I'm open to
>> other ideas here".
>>      I am looking for the community views about the increased bmcweb
>>      binary size v/s having a custom implementation for asyc_resolve.
>>       Please share your views & ideas to get to the best solution.
> I agree with Ed that adding pthreads is a step that should be taken
> with a lot of caution.   In addition to the binary size, a threaded
> application also adds security audit concerns.
>
> A quick search with the query of "dns lookup library embedded" found
> a possible library with a probably compatible license (although last
> update was 4 years ago), and the second link was a survey of other
> client and server packages that could be investigated.
>
> My personal opinion only.
>
> milton
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: pthreads at bmcweb
  2021-01-06  8:02 pthreads at bmcweb Sunitha Harish
  2021-01-06 18:12 ` Milton Miller II
@ 2021-01-12 13:05 ` Patrick Williams
  2021-01-18  9:49   ` Sunitha Harish
  2021-01-19 16:48 ` Ed Tanous
  2 siblings, 1 reply; 6+ messages in thread
From: Patrick Williams @ 2021-01-12 13:05 UTC (permalink / raw)
  To: Sunitha Harish; +Cc: openbmc, apparao.puli, edtanous

[-- Attachment #1: Type: text/plain, Size: 1221 bytes --]

On Wed, Jan 06, 2021 at 01:32:11PM +0530, Sunitha Harish wrote:
> Ed's suggestion is not to use the pthreads, instead implement 
> alternatives to do the same job, so that the binary size is kept 
> minimum. He mentioned: /"//Considering that's a ~30% increase in binary 
> size to support one line off code, and most systems are already at their 
> binary size limit, no, that's not going to be acceptable. We can either 
> patch boost to use this 
> //https://man7.org/linux/man-pages/man3/getaddrinfo_a.3.html 
> <https://man7.org/linux/man-pages/man3/getaddrinfo_a.3.html>//or we 
> could build our own resolver type that calls that underneath. This was 
> based on a quick lookthrough of solutions in Google. I'm open to other 
> ideas here". /

Since we're using systemd and we have the `resolved` feature turned on,
why not just send an async dbus message to the resolved.service?

```
$ busctl introspect org.freedesktop.resolve1 /org/freedesktop/resolve1 | grep ResolveHostname
.ResolveHostname                    method    isit          a(iiay)st                                -
```

https://www.freedesktop.org/software/systemd/man/org.freedesktop.resolve1.html

-- 
Patrick Williams

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: pthreads at bmcweb
  2021-01-12 13:05 ` Patrick Williams
@ 2021-01-18  9:49   ` Sunitha Harish
  0 siblings, 0 replies; 6+ messages in thread
From: Sunitha Harish @ 2021-01-18  9:49 UTC (permalink / raw)
  To: Patrick Williams; +Cc: openbmc, apparao.puli, edtanous


On 12-01-2021 18:35, Patrick Williams wrote:
> On Wed, Jan 06, 2021 at 01:32:11PM +0530, Sunitha Harish wrote:
>> Ed's suggestion is not to use the pthreads, instead implement
>> alternatives to do the same job, so that the binary size is kept
>> minimum. He mentioned: /"//Considering that's a ~30% increase in binary
>> size to support one line off code, and most systems are already at their
>> binary size limit, no, that's not going to be acceptable. We can either
>> patch boost to use this
>> //https://man7.org/linux/man-pages/man3/getaddrinfo_a.3.html
>> <https://man7.org/linux/man-pages/man3/getaddrinfo_a.3.html>//or we
>> could build our own resolver type that calls that underneath. This was
>> based on a quick lookthrough of solutions in Google. I'm open to other
>> ideas here". /
> Since we're using systemd and we have the `resolved` feature turned on,
> why not just send an async dbus message to the resolved.service?
>
> ```
> $ busctl introspect org.freedesktop.resolve1 /org/freedesktop/resolve1 | grep ResolveHostname
> .ResolveHostname                    method    isit          a(iiay)st                                -
> ```
>
> https://www.freedesktop.org/software/systemd/man/org.freedesktop.resolve1.html

Thank you Patrick. I will try implementing this and verify if all the 
async event notification scenarios works good.

Regards,
Sunitha

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: pthreads at bmcweb
  2021-01-06  8:02 pthreads at bmcweb Sunitha Harish
  2021-01-06 18:12 ` Milton Miller II
  2021-01-12 13:05 ` Patrick Williams
@ 2021-01-19 16:48 ` Ed Tanous
  2 siblings, 0 replies; 6+ messages in thread
From: Ed Tanous @ 2021-01-19 16:48 UTC (permalink / raw)
  To: Sunitha Harish; +Cc: OpenBMC Maillist, apparao.puli

Another option might be something like c-ares, the description of which is:

c-ares... is intended for applications which need to perform DNS
queries without blocking, or need to perform multiple DNS queries in
parallel. The primary examples of such applications are servers which
communicate with multiple clients and programs with graphical user
interfaces.


Sounds like exactly our problem statement, so it might be worth a look
to see how much binary size it adds.

On Wed, Jan 6, 2021 at 12:02 AM Sunitha Harish
<sunithaharish04@gmail.com> wrote:
>
> Hi team,
>
> Reference commit https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/31735 :
>
> In order to handle the multiple push-style event subscribers, bmc needs to support the async resolution of the subscribers address. The async_resolve() API crashes if there is no thread support in the binary.
>
> I created a bmcweb binary patch by pulling this commit and including the pthread. This works fine for the use-cases, but increased the bmcweb binary size by 220KB.
>
> Ed's suggestion is not to use the pthreads, instead implement alternatives to do the same job, so that the binary size is kept minimum. He mentioned: "Considering that's a ~30% increase in binary size to support one line off code, and most systems are already at their binary size limit, no, that's not going to be acceptable. We can either patch boost to use this https://man7.org/linux/man-pages/man3/getaddrinfo_a.3.html or we could build our own resolver type that calls that underneath. This was based on a quick lookthrough of solutions in Google. I'm open to other ideas here".
>
> I am looking for the community views about the increased bmcweb binary size v/s having a custom implementation for asyc_resolve. Please share your views & ideas to get to the best solution.
>
>
> Thanks & regards,
> Sunitha
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-19 18:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06  8:02 pthreads at bmcweb Sunitha Harish
2021-01-06 18:12 ` Milton Miller II
2021-01-12  8:48   ` Sunitha Harish
2021-01-12 13:05 ` Patrick Williams
2021-01-18  9:49   ` Sunitha Harish
2021-01-19 16:48 ` Ed Tanous

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.