From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: dev@dpdk.org, Vipin Varghese <vipin.varghese@amd.com>,
Ciara Power <ciara.power@intel.com>,
Sivaprasad Tummala <Sivaprasad.Tummala@amd.com>,
Tyler Retzlaff <roretzla@linux.microsoft.com>,
Narcisa Ana Maria Vasile <navasile@linux.microsoft.com>,
Dmitry Malloy <dmitrym@microsoft.com>,
Pallavi Kadam <pallavi.kadam@intel.com>
Subject: Re: [RFC] Telemetry enhancements and Windows support
Date: Thu, 7 Apr 2022 00:50:29 +0300 [thread overview]
Message-ID: <20220407005029.29e34a11@sovereign> (raw)
In-Reply-To: <YkrCWUS6p4VHQfH8@bricha3-MOBL.ger.corp.intel.com>
2022-04-04 11:03 (UTC+0100), Bruce Richardson:
[...]
> Having EAL be the only one to create threads seems reasonable. However, I'm
> a little uncertain about the scope of change and tying telemetry and EAL
> together a lot more.
Scope is a strong valid argument.
What do you think if telemetry would create threads using Win32 API
just like on Unices it creates threads using pthread
(external component that is always present)?
> Another alternative might be to change telemetry to
> use only one thread for all connections and using "select" or "poll" to
> wait on input from all sockets simultaneously. Would that work on Windows?
Yes, there are select() and "poll()" with slightly different naming.
> > * The logging issue can be solved differently:
> >
> > a) by factoring logging into a library, either as Bruce suggested;
> > b) by replacing logging with simple print in Windows shim;
> > c) by integrating and using the new threading API [1, 2].
> >
>
> What is the issue with the current logging in telemetry on windows?
pthread.h shim contains calls to rte_log().
> The
> current implementation has EAL pass in the logging function to telemetry on
> init, allowing use of EAL logging without requiring a link-time dependency.
> Theoretically, the same solution could also be used for the threading,
> though I'm wary about doing so as using the same solution multiple times
> could lead to very awkward APIs.
Thinking out of scope of this RFC, telemetry *library* API should be:
- register handler
- JSON helpers
- create session
- process command in a session
- destroy session
All IO should be outside.
Otherwise it's not a library but a framework.
rte_telemetry_init() and all IO it starts is a higher-level helper
for the very common case that doesn't need to be in lib/telemetry itself
and even doesn't need to be a public API (but can be).
> Overall, I tend to think the proper solution for all this is to split EAL -
> something that was discussed previously but never done because it's
> difficult and the result may be uncertain. Theoretically, most low-level
> services in EAL, such as logging, should be in one library, while the EAL
> init code remains in a later, higher-level one.
I'd even say: utilities (log, trace, UUID, ...), environment abstraction,
and runtime (init, tasks, multiprocess).
It would be interesting to have a topic on that.
[...]
> > * It is technically possible to accept remote connections.
> > However, it's a new attack surface and a security risk.
> > OTOH, there's no need to allow remote connections:
> > anyone who needs this can setup a tunnel or something.
> > Local socket must be used by default.
> >
>
> Completely agree on not accepting non-local connections. However, I'd also
> point out that another reason why a unix socket was chosen over other
> TCP/UDP/etc socket options was that it also gave local-user protection.
> Right now, if a DPDK process is run as root, no non-root user can connect
> to the telemetry socket, unless root explicitly gives permissions. For TCP
> or similar sockets, that would not be the case. Not sure how big a deal
> that would be.
Windows also provides named pipes:
1. Pipes are subject to access control.
2. Pipes can work in message mode, like SOCK_SEQPACKET.
3. Pipes are addressed by path of form \\.\pipe\NAME
that is not visible in the file system, like abstract Unix sockets,
but this namespace is shared, so collision issue remains.
4. Pipes can be accessed as files from Python.
Message mode can be activated with a Win32 API call
that can be done using ctypes and msvcrt bundled modules.
5. Pipes can be configured to reject remote connections
and to automatically limit the number of clients if needed.
Another advantage is that message framing will not be needed this time,
which limits the scope.
Drawbacks:
1. There will be less shared code between Windows and Unix.
Unix domain sockets and named pipes provide the same
"accept client, send message, receive message, disconnect" API,
so it's easy to share all non-transport logic.
dpdk-telemetry.py will need a few Windows-specific lines.
2. On Windows, select() and WSAPoll() are only applicable to sockets.
If we decide to multiplex IO in lib/telemetry and use named pipes,
multiplexers will be different.
next prev parent reply other threads:[~2022-04-06 21:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-01 22:59 Dmitry Kozlyuk
2022-04-02 0:55 ` Dmitry Kozlyuk
2022-04-04 10:03 ` Bruce Richardson
2022-04-06 21:50 ` Dmitry Kozlyuk [this message]
2022-04-06 21:57 ` Stephen Hemminger
2022-04-06 22:03 ` Dmitry Kozlyuk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220407005029.29e34a11@sovereign \
--to=dmitry.kozliuk@gmail.com \
--cc=Sivaprasad.Tummala@amd.com \
--cc=bruce.richardson@intel.com \
--cc=ciara.power@intel.com \
--cc=dev@dpdk.org \
--cc=dmitrym@microsoft.com \
--cc=navasile@linux.microsoft.com \
--cc=pallavi.kadam@intel.com \
--cc=roretzla@linux.microsoft.com \
--cc=vipin.varghese@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).