From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9E5F2A0487 for ; Fri, 5 Jul 2019 15:45:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A30A81BEA0; Fri, 5 Jul 2019 15:45:51 +0200 (CEST) Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by dpdk.org (Postfix) with ESMTP id E53181BE76 for ; Fri, 5 Jul 2019 15:45:49 +0200 (CEST) Received: by mail-lj1-f196.google.com with SMTP id z28so414325ljn.4 for ; Fri, 05 Jul 2019 06:45:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MS0VLzwbpyajFdL2dez7SzmbqszGG7cmjZXO4giVMr8=; b=o8qQYmzDjdKwIVJCMStD5oGDThQfhJmgSEvr6toDGDqHT2MwrUdrP1uR7vUzcJ0sf2 UerZX+SsfTf2F2c7IaMzj81tifnvc4PVZVJJ3Z+ts9TFQwOi6SzmoibhQxS8PozwtpFq 9C1pjQbGtSgr+BHx7YINuHh9OBv/IwXyl5NxQynwgByyHj0nnepfJnn0VIkMPxO5nAxP cMCDLp4xBOm+xw5v7MBd55z8aeq9G8uKuejuT5SwYW/T38PnZ02LB8AMrJQ07pbM+6L/ FJ9U26MHXTlEq6/DBosUw38JaOGz5ZC6HyEt+6c2QFQkcZh35BtBTrMJD1EC0Ict/utx 1o5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MS0VLzwbpyajFdL2dez7SzmbqszGG7cmjZXO4giVMr8=; b=UZLTlg7udUwpZJTHNnq3l5ZPfOesICcpymwjw1O95v90U58Rn3oxpmIVH2nB97EK39 WhsIM0eZbc1o+8/s6nxlUPwAox7NrexHaLu/tilVJ4JHsPmhBVTCQu5Lp7Nj1Z9s2F4o QLX6Sbw++CIaK5akY9Bo3RV8YOHpoLNP3MRPMoABzOFWxyKSUkyvgIwXK5w9mUJp/zgT 2DSahnw4OOHVf4hO/2YKkp6NobFSi2r/z8MFED1t0W1BUe/Dsx//vQt/Ak/luQ5+aUnB 4wEnjxeyExJxb0YOa5VHI/CMC7pgxjU74J+xMjSNc/o6uPrncfrZGz+0CUPD8Gu+3Pz5 regA== X-Gm-Message-State: APjAAAUh3sydle+zRvpZ32LUzjXzK1uph6qQddlM63T6fGn7K1+1AfW0 AKCiCa0ug9RiKIhiIM91YFbZQvE5yvCIWNLSkl4= X-Google-Smtp-Source: APXvYqwkg11DiT2hKs+0DegwG1+pLfN1ZYSJORWfg/+D6DHv5+hg6ru9t4nkOLasMk2A+i1TxAtatUjOGkqmx2/fgrc= X-Received: by 2002:a2e:7c15:: with SMTP id x21mr2272963ljc.55.1562334349581; Fri, 05 Jul 2019 06:45:49 -0700 (PDT) MIME-Version: 1.0 References: <20190627093751.7746-1-ruifeng.wang@arm.com> <20190627093751.7746-3-ruifeng.wang@arm.com> <6daf7a76-1def-21df-d202-10b2a8f8582a@intel.com> In-Reply-To: From: Alex Kiselev Date: Fri, 5 Jul 2019 16:45:38 +0300 Message-ID: To: Honnappa Nagarahalli Cc: "Medvedkin, Vladimir" , "Ruifeng Wang (Arm Technology China)" , "bruce.richardson@intel.com" , "dev@dpdk.org" , "Gavin Hu (Arm Technology China)" , nd Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v3 3/3] lib/lpm: memory orderings to avoid race conditions for v20 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, > > > > > > As a general remark consider writing all of the tbl entries including > > tbl8 with atomic_store. Now "lpm->tbl8[j] = new_tbl8_entry;" is looks like > > > > 1e9: 44 88 9c 47 40 01 00 mov > > %r11b,0x2000140(%rdi,%rax,2) <-write first byte > > 1f0: 02 > > 1f1: 48 83 c0 01 add $0x1,%rax > > 1f5: 42 88 8c 47 41 01 00 mov %cl,0x2000141(%rdi,%r8,2) <-write > > second byte > > 1fc: 02 > > > > This may cause an incorrect nexthop to be returned. If the byte with valid flag > > is updated first, the old(and maybe invalid) next hop could be returned. > +1 > > It is surprising that the compiler is not generating a single 32b store. As you mentioned 'relaxed' __atomic_store_n should be good. Am I right that x86 platform is not affected by the bug since store-store could not be reordered on x86? -- Alex