From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-f66.google.com (mail-oi0-f66.google.com [209.85.218.66]) by dpdk.org (Postfix) with ESMTP id 098EC37A8 for ; Thu, 8 Sep 2016 18:08:13 +0200 (CEST) Received: by mail-oi0-f66.google.com with SMTP id s71so2652658oih.3 for ; Thu, 08 Sep 2016 09:08:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=LXdU+q50ivVuibRGT9X5nTtplbQ20yOhsWnEh+4aUaU=; b=qwXppP3fAaI/xJNKePaDa0WUj9K9o3malvUhE7P9eIls8ohUW2ou1E32mZ+2Sw0wvW VVZ3iCikjjplz0EfvDAqgSwgbcxufWLOVWdF85oK/57/6mJTgsNiq4uKTUU1JPdM9Xjl R8xWISwfyy3zZ42+fde8BsJmu6dC5Cfcw/EAxRHXDBJaazl3tuMjFTYP1UeeX/FmRwFw L9+UPA9Z5F8PbV9bqNAQZyDjnT0HK8YZLR/5Isfa0W68HTvy9y6PiOCzSiBDddrDyntM yP/zWOKTFfm4LBdw9TZujjPxGcj77QP47xTkyGVsc53tWDm9rLZAgIVbg9hzZqB2DiKS 0zRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=LXdU+q50ivVuibRGT9X5nTtplbQ20yOhsWnEh+4aUaU=; b=XkpdAOpOXPKZ1jaoRCBHSThFwYHPiNW4+QYy03/JLtSOGxSBlE86AfVGqk3Dv58kfK TQWL95ZTFY0HtDLAtAtzX0eh8MQBG8plk6uqWnURFarwebrmSDrB651+jd6Vts7eSy8y iMv4F6PuUniH4KwH/vdYeNsQms0eh865O0byrOKR79hTxOqv7r4TFqhl+IV/IwBbJMYp 50ofHvgSL8mGYRkskyCPXxAFbrZFiuNZp5XjYNWHJZSy37h99It21aueU0ge1rJRN7YD r/9c5X0i38zbwUkov5Ce0Mq0hlmjmZrGPw/pNysznA/Ng8yOkm5A1ZxC90xMV/ezxksV rf0g== X-Gm-Message-State: AE9vXwMgwJJ/xUW2pcDPrgmbXVchvsfoWmn5G4gkYTbARrYLkhiSzU0cSUUuJsYncMID2pt0Bn7IxjxNuJU8sQ== X-Received: by 10.157.15.228 with SMTP id m33mr455841otd.154.1473350892362; Thu, 08 Sep 2016 09:08:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.202.216.11 with HTTP; Thu, 8 Sep 2016 09:08:11 -0700 (PDT) In-Reply-To: References: <1473305760-2420-1-git-send-email-droidluo@gmail.com> From: Weiliang Luo Date: Thu, 8 Sep 2016 11:08:11 -0500 Message-ID: To: Olivier Matz Cc: dev@dpdk.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH] mempool: fix sp sc mempool bug X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Sep 2016 16:08:13 -0000 Thanks for your suggestion, I have submitted again with amended commit msg. Thanks, Weiliang On Thu, Sep 8, 2016 at 3:13 AM, Olivier Matz wrote: > Hi Weiliang, > > On 09/08/2016 05:36 AM, Weiliang Luo wrote: > > Signed-off-by: Weiliang Luo > > --- > > lib/librte_mempool/rte_mempool.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_ > mempool.c > > index 2e28e2e..350d77a 100644 > > --- a/lib/librte_mempool/rte_mempool.c > > +++ b/lib/librte_mempool/rte_mempool.c > > @@ -879,7 +879,7 @@ rte_mempool_create(const char *name, unsigned n, > unsigned elt_size, > > * Since we have 4 combinations of the SP/SC/MP/MC examine the > flags to > > * set the correct index into the table of ops structs. > > */ > > - if (flags & (MEMPOOL_F_SP_PUT | MEMPOOL_F_SC_GET)) > > + if ((flags & MEMPOOL_F_SP_PUT) && (flags & MEMPOOL_F_SC_GET)) > > rte_mempool_set_ops_byname(mp, "ring_sp_sc", NULL); > > else if (flags & MEMPOOL_F_SP_PUT) > > rte_mempool_set_ops_byname(mp, "ring_sp_mc", NULL); > > > > > I would just change the title and add some explanation in the commit > log. I suggest: > > """ > mempool: fix corruption due to invalid handler > > When using rte_mempool_create(), the mempool handler is selected > depending on the flags given by the user: > - multi-consumer / multi-producer > - multi-consumer / single-producer > - single-consumer / multi-producer > - single-consumer / single-producer > > The flags were not properly tested, resulting in the selection of sc/sp > handler if sc/mp or mc/sp was asked. This can lead to corruption or > crashes because the get/put operations are not atomic. > > Fixes: 449c49b93a6b ("mempool: support handler operations") > > Signed-off-by: Weiliang Luo > Acked-by: Olivier Matz > """ > > > Thanks! > Olivier >