From: Walker, Benjamin <benjamin.walker at intel.com>
To: spdk@lists.01.org
Subject: Re: [SPDK] SPDK Dependencies
Date: Wed, 26 Apr 2017 22:09:24 +0000 [thread overview]
Message-ID: <1493244563.6290.3.camel@intel.com> (raw)
In-Reply-To: 37B08312E007AE46A00101F43DA919DD43FA83EB@FMSMSX105.amr.corp.intel.com
[-- Attachment #1: Type: text/plain, Size: 7305 bytes --]
At the summit we did end up discussing this quite a bit. For DPDK it's fairly
clear that we're going to continue to abstract away all of those dependencies
inside of the env library. There are pull requests out to finish this up now and
we'll get those merged relatively quickly. We're also working with the DPDK team
to improve DPDK so that there are hopefully fewer reasons to forego using it.
As far as POSIX, I have a proposal. Assuming POSIX is available makes it
significantly easier to work on SPDK itself, so I'm very hesitant to move all
POSIX calls inside of the env library and force people to use wrapper functions.
I'm concerned that it raises the barrier to contribute too much (can I call
malloc? what about printf?). Further, the vast majority of SPDK users actually
do have POSIX available to them. That said, there are probably parts that we can
abstract out and some other refactoring we can do here.
First, I think pthreads can be refactored into the env library. Locking and
spawning threads is rare enough in SPDK that it isn't an undue burden to use
wrappers, and it also requires some care regarding CPU affinity. So the below
discussion excludes that.
Second, I think we can get away with moving all of our POSIX headers to a single
SPDK header file at spdk/stdinc.h. We can then include that file everywhere
either directly or by using a -include option in the Makefile. This will even
play nicely with precompiling spdk/stdinc.h (thanks Daniel for the suggestion),
although SPDK's build times are not a concern right now.
Third, for the small subset of SPDK users that really don't have POSIX
available, they can carry a patch on top of SPDK that simply replaces
spdk/stdinc.h with their own implementation. Most environments have at least
some part of the POSIX standard, and 90% of what we're using is just the C
standard library, so in reality this header shouldn't be too difficult to
replace.
Thoughts? Opinions?
Thanks,
Ben
On Mon, 2017-04-17 at 18:55 +0000, Walker, Benjamin wrote:
> Hi all,
>
> There has been a lot of activity lately dealing with abstracting SPDK's
> dependencies to allow porting SPDK to additional platforms and frameworks. I
> think we'll end up talking about this extensively at the summit this week. The
> ability to use SPDK in a variety of environments is very important to us, so I
> look forward to the discussions. I wanted to write a basic summary of the
> current state of SPDK's dependencies for everyone to have, and so that those
> who are unable to attend the summit can provide feedback. I'll try to update
> this thread with the results of the discussions at the summit for everyone's
> benefit.
>
> We've already eliminated all SPDK dependencies except for two:
>
> 1) POSIX
> 2) DPDK
>
> SPDK already has a mechanism for abstracting away the "environment" it is
> running in. We do this by moving all calls to dependencies to the "env"
> library, whose interface is defined by include/spdk/env.h. The build system
> allows users to point to an alternate implementation of the env library if
> required. SPDK's default implementation of env is based on DPDK and runs in
> Linux and FreeBSD user space.
>
> DPDK is a very large toolkit, of course, but until just recently SPDK only
> used DPDK's 'eal' module (environment abstraction library). The original goal
> of the SPDK env library was just to abstract all uses of DPDK's eal, but not
> all uses of POSIX APIs. We made some progress in this area, but there are a
> number of remaining calls as of this writing. Fortunately, the wider community
> has really come through. There are at least two pull requests out from two
> independent users that mostly finish the job. We'll work through those pull
> requests and try to get them merged shortly. The only part of the code that
> will continue to explicitly depend on DPDK will be the newly released vhost-
> scsi target because that relies on DPDK vhost infrastructure. This
> infrastructure is outside of DPDK's eal and is quite extensive. We feel this
> is acceptable because building vhost in SPDK is optional - you can just turn
> it off to eliminate the dependency.
>
> There are a number of legitimate reasons to want to remove the DPDK dependency
> from SPDK. For instance, DPDK dictates a particular memory management model,
> requires a specific threading model, and performs PCI device management that
> may conflict with other libraries. However, DPDK provides tremendous value to
> SPDK in a number of areas, especially by implementing memory allocation
> suitable for DMA in user space. Memory management is a major challenge with
> all sorts of hidden traps and challenges, so we see significant value in using
> a production-tested library here. Re-implement the env without DPDK at your
> own risk!
>
> Abstracting away our POSIX dependency is a similar but larger challenge. While
> we foresaw the need for people to replace DPDK, we didn't see any use case for
> dropping POSIX. We were definitely wrong though - people are using SPDK in all
> sorts of environments that we didn't predict, from embedded firmware to
> operating system kernels and beyond. So we'll need to address this as time
> goes on. I think this will result in further expansion of the 'env' library.
> Fortunately, we don't require too much from POSIX - mostly pthreads, the C
> standard library, and maybe a couple of other miscellaneous headers.
>
> There are other less obvious dependencies in SPDK. For instance, it also
> depends on a relatively recent version of gcc or clang. This is mostly a
> practical concern and not so much by intention. Our continuous integration
> system (which I'll talk about at the summit - exciting developments here)
> currently consists of 4 machines, 3 of which are running Fedora Linux 25 while
> the other is running FreeBSD 11.0. These are very much up to date systems, so
> we tend not to catch bugs on older systems today. We also use cutting edge C
> features and tools, so we'll probably over time need to select a particular
> minimum version of the C standard that we're going to develop to.
>
> I'm also concerned with the scope of the env library and I'd like to work as
> hard as possible to limit the size of the API. This is for two reasons - first
> and foremost to minimize the number of calls to these wrapper functions so
> that it doesn't impact performance. Performance really is everything and we
> can't sacrifice that. This isn't shaping up to be much of a problem so far
> because very few calls to our dependencies happen within the I/O path.
> Secondarily, I'd like to make it as straightforward as possible for users to
> re-implement the env. The best way to make it easy to do that is to keep the
> API small.
>
> I look forward to the discussions at the summit this week. We'd love to hear
> about all of the different environments, platforms, and frameworks where SPDK
> is being used and how we can make it easier to integrate SPDK wherever it is
> valuable.
>
> Thanks,
> Ben
>
>
> _______________________________________________
> SPDK mailing list
> SPDK(a)lists.01.org
> https://lists.01.org/mailman/listinfo/spdk
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3274 bytes --]
next reply other threads:[~2017-04-26 22:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-26 22:09 Walker, Benjamin [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-05-05 10:08 [SPDK] SPDK Dependencies John Meneghini
2017-05-03 2:23 John Meneghini
2017-04-29 11:46 Meneghini, John
2017-04-29 11:38 Rodriguez, Edwin
2017-04-27 21:10 Walker, Benjamin
2017-04-27 5:36 Ranjit Noronha
2017-04-17 18:55 Walker, Benjamin
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=1493244563.6290.3.camel@intel.com \
--to=spdk@lists.01.org \
/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 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.