DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	Stephen Hemminger <stephen@networkplumber.org>,
	"Ananyev, Konstantin" <konstantin.ananyev@intel.com>,
	"thomas@monjalon.net" <thomas@monjalon.net>,
	Ray Kinsella <mdr@ashroe.eu>, nd <nd@arm.com>
Subject: Re: [dpdk-dev] ABI and inline functions
Date: Wed, 17 Apr 2019 09:36:38 +0100	[thread overview]
Message-ID: <20190417083637.GB1890@bricha3-MOBL.ger.corp.intel.com> (raw)
In-Reply-To: <VE1PR08MB5149D3D24CD4F903FCFFE14798250@VE1PR08MB5149.eurprd08.prod.outlook.com>

On Wed, Apr 17, 2019 at 05:12:43AM +0000, Honnappa Nagarahalli wrote:
> Hello,
> 	There was a conversation [1] in the context of RCU library. I thought it needs participation from broader audience. Summary for the context (please look at [1] for full details)
>

Thanks for kicking off this discussion
 
> 1) How do we provide ABI compatibility when the code base contains inline functions? Unless we freeze development in these inline functions and corresponding structures, it might not be possible to claim ABI compatibility. Application has to be recompiled.

I agree that in some cases the application "might" need to be recompiled,
but on the other hand I also think that there are many cases where ABI
function versioning can still be used to mitigate things. For example, if
we think of a couple of various scenarios:

1. If everything is inline and variables are allocated by app, e.g.
spinlock on stack, then there is no issue as everything is application
contained.

2. If the situation is as in #1, but the structures in question are passed
to non-inline DPDK functions. In this case, any changes to the structures
require those functions taking the structures to be versioned for old and
new structures

3. If instead we have the case, like in rte_ring, where the data structures
are allocated using functions, but they are used via inlines in the app. In
this case the creation functions (and any other function using the
structures) need to be versioned so that the application gets the expected
structure back from the creation.

It might be useful to think of what other scenarios we have and what ones
are likely to be problematic, especially those that can't be solved by
having multiple function versions.

> 2) Every function that is not in the direct datapath (fastpath?) should not be inline. Exceptions or things like rx/tx burst, ring enqueue/dequeue, and packet alloc/free - Stephen

Agree with this. Anything not data path should not be inline. The next
question then is for data path items how to determine whether they need to
be inline or not. In general my rule-of-thumb:
* anything dealing with bursts of packets should not be inline
* anything what works with single packet at a time should be inline

The one exception to this rule is cases where we have to consider "empty
polling" as a likely use-case. For example, rte_ring_dequeue_burst works
with bursts of packets, but there is a valid application use case where a
thread could be polling a set of rings where only a small number are
actually busy. Right now, polling an empty ring only costs a few cycles,
meaning that it's neglible to have a few polls of empty rings before you
get to a busy one. Having that function not-inline will cause that cost to
jump significantly, so could cause problems. (This leads to the interesting
scenario where ring enqueue is safe to un-inline, while dequeue is not).

> 3) Plus synchronization routines: spin/rwlock/barrier, etc. I think rcu should be one of such exceptions - it is just another synchronization mechanism after all (just a bit more sophisticated). - Konstantin
> 
In general I believe the synchronisation primitives should be inline.
However, it does come down to cost too - if a function takes 300 cycles, do
we really care if it takes 305 or 310 instead to make it not inline?
Hopefully most synchronisation primitives are faster than this so this
situation should not occur.

> 2) and 3) can be good guidelines to what functions/APIs can be inline. But, I believe this guideline exists today too. Are there any thoughts to change this?
> 
> Coming to 1), I think DPDK cannot provide ABI compatibility unless all the inline functions are converted to normal functions and symbol versioning is done for those (not bothering about performance).
> 
I disagree. I think even in the case of #1, we should be able to manage
some changes without breaking ABI.

> In this context, does it make sense to say that we will maintain API
> compatibility rather than saying ABI compatibility? This will also send
> the right message to the end users.
> 
I would value ABI compatibility much higher than API compatibility. If
someone is recompiling the application anyway, making a couple of small
changes (large rework is obviously a different issue) to the code should
not be a massive issue, I hope. On the other hand, ABI compatibility is
needed to allow seamless update from one version to another, and it's that
ABI compatiblity that allows distro's to pick up our latest and greatest
versions. 

Personally, I'd be happy enough to allow API changes at any point without
deprecation notice, so long as function versioning is used to ensure ABI
compatibility is kept.

My 2c.
/Bruce

  parent reply	other threads:[~2019-04-17  8:36 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-17  5:12 Honnappa Nagarahalli
2019-04-17  5:12 ` Honnappa Nagarahalli
2019-04-17  8:36 ` Bruce Richardson [this message]
2019-04-17  8:36   ` Bruce Richardson
2019-04-17 16:52   ` Stephen Hemminger
2019-04-17 16:52     ` Stephen Hemminger
2019-04-17 17:46   ` Jerin Jacob Kollanukkaran
2019-04-17 17:46     ` Jerin Jacob Kollanukkaran
2019-04-17 18:51     ` Stephen Hemminger
2019-04-17 18:51       ` Stephen Hemminger
2019-04-18  5:56       ` [dpdk-dev] [EXT] " Jerin Jacob Kollanukkaran
2019-04-18  5:56         ` Jerin Jacob Kollanukkaran
2019-04-23 14:23         ` Ray Kinsella
2019-04-23 14:23           ` Ray Kinsella
2019-04-24 18:38           ` Jerin Jacob Kollanukkaran
2019-04-24 18:38             ` Jerin Jacob Kollanukkaran
2019-04-23 14:19       ` [dpdk-dev] " Ray Kinsella
2019-04-23 14:19         ` Ray Kinsella
2019-04-18  4:34   ` Honnappa Nagarahalli
2019-04-18  4:34     ` Honnappa Nagarahalli
2019-04-18 10:28     ` Bruce Richardson
2019-04-18 10:28       ` Bruce Richardson
2019-04-23 14:12       ` Ray Kinsella
2019-04-23 14:12         ` Ray Kinsella
2019-04-24  5:15         ` Honnappa Nagarahalli
2019-04-24  5:15           ` Honnappa Nagarahalli
2019-04-24 11:08         ` Burakov, Anatoly
2019-04-24 11:08           ` Burakov, Anatoly
2019-04-24 12:22           ` Ray Kinsella
2019-04-24 12:22             ` Ray Kinsella
2019-04-24 12:54             ` Burakov, Anatoly
2019-04-24 12:54               ` Burakov, Anatoly
2019-04-24 15:44               ` Stephen Hemminger
2019-04-24 15:44                 ` Stephen Hemminger
2019-04-30  8:52             ` Thomas Monjalon
2019-04-30  8:52               ` Thomas Monjalon
2019-04-24  5:08       ` Honnappa Nagarahalli
2019-04-24  5:08         ` Honnappa Nagarahalli
2019-04-24  8:49         ` Bruce Richardson
2019-04-24  8:49           ` Bruce Richardson

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=20190417083637.GB1890@bricha3-MOBL.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@intel.com \
    --cc=mdr@ashroe.eu \
    --cc=nd@arm.com \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    /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).