DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: jigsaw <jigsaw-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "dev-VfR2kkLFssw@public.gmane.org" <dev-VfR2kkLFssw@public.gmane.org>
Subject: Re: 答复:  [PATCH] Add user defined tag calculation callback tolibrte_distributor.
Date: Fri, 7 Nov 2014 13:53:03 +0000	[thread overview]
Message-ID: <20141107135303.GB12092@bricha3-MOBL3> (raw)
In-Reply-To: <CAHVfvh6y4f7+bMhzmwOu5c0Y4wzwNaxj4sQPtq8cabGbdHrzXg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Fri, Nov 07, 2014 at 02:38:13PM +0200, jigsaw wrote:
> Hi Bruce,
> 
> >>  If a tag value of zero is ever passed in, then it will start matching
> against cores which are not doing any processing.
> 
> Yes, this is true according to current bookkeeping of inflight tags.
> 
> But if the slot in in_flight_tags is not a uint32_t but a struct which has
> a filed as indication of "on/off", and also with corresponding changes in
> looking for a matched tag, then the need for 1 bit mask can be eliminated.
> Of course this change requires a little bit more, O(n), memory space and
> costs O(n) more branch misses. But the benefit is a more free interface to
> user app.
> 
> This is just another trade-off. Since I am in need of such freedom, I am
> more interested in the free use of 32bits.

If you do implement such a change, I would suggest you simply add a bitmask
to the distributor indicating valid workers. Then when we do the check
for tag matches, we just need an extra "and" instruction to eliminate invalid
workers from the match.

/Bruce

> 
> thx &
> rgds,
> -qinglai
> 
> 
> On Fri, Nov 7, 2014 at 11:45 AM, Bruce Richardson <
> bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> 
> > On Thu, Nov 06, 2014 at 09:52:25PM +0200, jigsaw wrote:
> > > Hi Bruce,
> > >
> > > Actually IMHO it is good to leave the freedom to user to decide how to
> > > interpret the tag value, i.e. remove the OR 1 bit.
> > > If the tag value is zero, then we assume the programmer know what he is
> > > doing. Of course this shall be clearly documented in the comment/doxgen.
> > >
> > >
> > > thx &
> > > rgds,
> > > -qinglai
> >
> > I don't believe that will work. If a tag value of zero is ever passed
> > in, then it will start matching against cores which are not doing any
> > processing. Then it will get queued up to get sent to those cores, and so
> > never get processed.
> > We need a bit somewhere inside the tag to permanently set - though it can
> > be configurable.
> >
> > /Bruce
> >
> > >
> > > On Thu, Nov 6, 2014 at 8:01 PM, jigsaw <jigsaw-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > >
> > > > Hi Bruce,
> > > >
> > > > In my use case, unfortunately the tag is not hash. And the tag can be
> > on
> > > > either low or high bits, depending on configuration.
> > > > I wonder if it is possible to let the user to decide which bit to mask,
> > > > i.e. to add another param to rte_distributor_create to define the mask.
> > > >
> > > > thx &
> > > > rgds,
> > > > -qinglai
> > > >
> > > > On Thu, Nov 6, 2014 at 3:59 PM, Bruce Richardson <
> > > > bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> > > >
> > > >> On Thu, Nov 06, 2014 at 02:36:09PM +0200, Qinglai Xiao wrote:
> > > >> > Hi Bruce,
> > > >> >
> > > >> > There is a subtle case in which tag values are 2 and 3,
> > respectively.
> > > >> Then these two tags cannot be distinguished. There should be a better
> > way
> > > >> so as to handle this situation.
> > > >>
> > > >> It's not just in that, case, it's in any case where a pair of tags
> > differ
> > > >> by
> > > >> only a single bit. I've been assuming that the tag is likely to be a
> > hash
> > > >> value in most cases - given that it's only 32-bit - in which case it
> > just
> > > >> doesn't
> > > >> matter which bit we chose to permanently set to 1, but if there are
> > > >> scenarios
> > > >> where it's likely that the low bits are used but the high ones not
> > so, we
> > > >> can
> > > >> look to change which bit is set to 1. Either way, the distributor just
> > > >> uses a
> > > >> 31-bit tag rather than a 32-bit one.
> > > >>
> > > >> /Bruce
> > > >>
> > > >> >
> > > >> > thx &
> > > >> > rgds
> > > >> > -qinglai
> > > >> >
> > > >> > -----原始邮件-----
> > > >> > 发件人: "Thomas Monjalon" <thomas.monjalon@6wind.com>
> > > >> > 发送时间: ‎2014/‎11/‎6 12:36
> > > >> > 收件人: "Bruce Richardson" <bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > > >> > 抄送: "dev-VfR2kkLFssw@public.gmane.org" <dev-VfR2kkLFssw@public.gmane.org>; "jigsaw" <jigsaw-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > > >> > 主题: Re: [dpdk-dev] [PATCH] Add user defined tag calculation callback
> > > >> tolibrte_distributor.
> > > >> >
> > > >> > 2014-11-06 09:22, Bruce Richardson:
> > > >> > > On Wed, Nov 05, 2014 at 07:24:13PM +0200, jigsaw wrote:
> > > >> > > >
> > > >>
> > http://dpdk.org/browse/dpdk/tree/lib/librte_distributor/rte_distributor.c#n285
> > > >> > > >
> > > >> > > >         new_tag = (next_mb->hash.rss | 1);
> > > >> > > >
> > > >> > > > Why the logical OR is needed?
> > > >> > >
> > > >> > > That's needed to ensure that we never track a tag with an actual
> > > >> value of zero.
> > > >> > > We instead always force the low bit to be 1, so that we can use
> > zero
> > > >> as an
> > > >> > > "empty" value.
> > > >> >
> > > >> > Bruce, could you check how this code may be better commented please?
> > > >> > This discussion shows that the distributor library probably needs
> > more
> > > >> > explanations in the code or doxygen.
> > > >> >
> > > >> > Thanks
> > > >> > --
> > > >> > Thomas
> > > >>
> > > >
> > > >
> >

  parent reply	other threads:[~2014-11-07 13:53 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-05 13:30 [PATCH] Add user defined tag calculation callback to librte_distributor Qinglai Xiao
     [not found] ` <1415194237-1219-1-git-send-email-jigsaw-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-11-05 14:27   ` Bruce Richardson
2014-11-05 15:11     ` jigsaw
     [not found]       ` <CAHVfvh4yAdF-aDnV+sh+PgJpEUW18+aF0=JoZDwJtGHhh=5ZzQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-05 16:36         ` Bruce Richardson
2014-11-05 17:24           ` jigsaw
     [not found]             ` <CAHVfvh4X_sUPUzSJTqBdEnkS94t2Jwj_98Vg0xbUS3MPSeo2ZA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-06  9:22               ` Bruce Richardson
2014-11-06 10:14                 ` jigsaw
2014-11-06 10:36                 ` Thomas Monjalon
2014-11-06 12:36                   ` 答复: [PATCH] Add user defined tag calculation callback tolibrte_distributor Qinglai Xiao
     [not found]                     ` <545b6b74.a96db40a.26af.ffffe7fb-ATjtLOhZ0NVl57MIdRCFDg@public.gmane.org>
2014-11-06 13:59                       ` Bruce Richardson
2014-11-06 18:01                         ` jigsaw
     [not found]                           ` <CAHVfvh4U4PZKZSue_kKDQKATC2snb_=10OD08LGmUtieBc_LzA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-06 19:52                             ` jigsaw
     [not found]                               ` <CAHVfvh5SzJ-kpQQ9h=1wmMihiitcJXeR9mcNa1in8x6Gb6tSqQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-07  9:45                                 ` Bruce Richardson
2014-11-07 12:38                                   ` jigsaw
     [not found]                                     ` <CAHVfvh6y4f7+bMhzmwOu5c0Y4wzwNaxj4sQPtq8cabGbdHrzXg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-07 13:53                                       ` Bruce Richardson [this message]
2014-11-07 14:31                                         ` jigsaw
     [not found]                                           ` <CAHVfvh7ggGB_q1Rs1c3-9PRwDr_GKA+etaMXRSeKCfUKoUx8hQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-07 14:44                                             ` Bruce Richardson
2014-11-07 14:52                                               ` jigsaw
     [not found]                                                 ` <CAHVfvh6HxAVynbvCXFESMfFyHpiaLkgUPwM7eWEjNAF53qJDXg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-07 15:04                                                   ` Bruce Richardson
2014-11-07 15:18                                                     ` jigsaw
2014-11-06 13:55                   ` [PATCH] distributor: add comments to make code more readable Bruce Richardson
     [not found]                     ` <1415282132-11056-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-11-07 14:08                       ` Thomas Monjalon
2014-11-07 14:31                         ` jigsaw
2014-11-06 13:57                   ` [PATCH] Add user defined tag calculation callback to librte_distributor Bruce Richardson
2014-11-05 15:13     ` Ananyev, Konstantin
     [not found]       ` <2601191342CEEE43887BDE71AB977258213A2938-kPTMFJFq+rEu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-11-05 15:24         ` jigsaw

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=20141107135303.GB12092@bricha3-MOBL3 \
    --to=bruce.richardson-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    --cc=jigsaw-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox