From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bruce Richardson Subject: Re: =?utf-8?b?562U5aSNOiAgW1BBVENIXSBBZGQgdXNlciBkZWZpbmVk?= =?utf-8?q?_tag_calculation_callback_tolibrte=5Fdistributor=2E?= Date: Fri, 7 Nov 2014 13:53:03 +0000 Message-ID: <20141107135303.GB12092@bricha3-MOBL3> References: <1415194237-1219-1-git-send-email-jigsaw@gmail.com> <20141106092228.GA3056@bricha3-MOBL3> <9190772.1rnKUO3oNV@xps13> <545b6b74.a96db40a.26af.ffffe7fb@mx.google.com> <20141106135951.GB7252@bricha3-MOBL3> <20141107094521.GB4628@bricha3-MOBL3> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: "dev-VfR2kkLFssw@public.gmane.org" To: jigsaw Return-path: Content-Disposition: inline In-Reply-To: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" On Fri, Nov 07, 2014 at 02:38:13PM +0200, jigsaw wrote: > Hi Bruce, >=20 > >> If a tag value of zero is ever passed in, then it will start matchi= ng > against cores which are not doing any processing. >=20 > Yes, this is true according to current bookkeeping of inflight tags. >=20 > 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 eliminat= ed. > Of course this change requires a little bit more, O(n), memory space an= d > costs O(n) more branch misses. But the benefit is a more free interface= to > user app. >=20 > This is just another trade-off. Since I am in need of such freedom, I a= m > more interested in the free use of 32bits. If you do implement such a change, I would suggest you simply add a bitma= sk to the distributor indicating valid workers. Then when we do the check for tag matches, we just need an extra "and" instruction to eliminate inv= alid workers from the match. /Bruce >=20 > thx & > rgds, > -qinglai >=20 >=20 > On Fri, Nov 7, 2014 at 11:45 AM, Bruce Richardson < > bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote: >=20 > > 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 h= e is > > > doing. Of course this shall be clearly documented in the comment/do= xgen. > > > > > > > > > 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, an= d 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 wrote: > > > > > > > Hi Bruce, > > > > > > > > In my use case, unfortunately the tag is not hash. And the tag ca= n 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 b= etter > > way > > > >> so as to handle this situation. > > > >> > > > >> It's not just in that, case, it's in any case where a pair of ta= gs > > 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 cas= e 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 n= ot > > so, we > > > >> can > > > >> look to change which bit is set to 1. Either way, the distributo= r just > > > >> uses a > > > >> 31-bit tag rather than a 32-bit one. > > > >> > > > >> /Bruce > > > >> > > > >> > > > > >> > thx & > > > >> > rgds > > > >> > -qinglai > > > >> > > > > >> > -----=E5=8E=9F=E5=A7=8B=E9=82=AE=E4=BB=B6----- > > > >> > =E5=8F=91=E4=BB=B6=E4=BA=BA: "Thomas Monjalon" > > > >> > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: =E2=80=8E2014/=E2=80=8E1= 1/=E2=80=8E6 12:36 > > > >> > =E6=94=B6=E4=BB=B6=E4=BA=BA: "Bruce Richardson" > > > >> > =E6=8A=84=E9=80=81: "dev-VfR2kkLFssw@public.gmane.org" ; "jigsaw" > > > >> > =E4=B8=BB=E9=A2=98: Re: [dpdk-dev] [PATCH] Add user defined ta= g 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_distribut= or.c#n285 > > > >> > > > > > > >> > > > new_tag =3D (next_mb->hash.rss | 1); > > > >> > > > > > > >> > > > Why the logical OR is needed? > > > >> > > > > > >> > > That's needed to ensure that we never track a tag with an ac= tual > > > >> 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 p= lease? > > > >> > This discussion shows that the distributor library probably ne= eds > > more > > > >> > explanations in the code or doxygen. > > > >> > > > > >> > Thanks > > > >> > -- > > > >> > Thomas > > > >> > > > > > > > > > >