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 BBBA7A0573; Wed, 4 Mar 2020 18:56:46 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 29F642BB8; Wed, 4 Mar 2020 18:56:46 +0100 (CET) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by dpdk.org (Postfix) with ESMTP id 75ECDFEB for ; Wed, 4 Mar 2020 18:56:44 +0100 (CET) Received: by mail-pg1-f196.google.com with SMTP id m5so1350840pgg.0 for ; Wed, 04 Mar 2020 09:56:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jA2kg2Mvxo4L6i9S93dzTR3T+96cRmV/fsYn5yzcv/E=; b=MhxR7KPvDUJ4r9jScCX5XyejD7adtZoGtheUIw67P/zfbJwtIERCxy0FBBj2g2jRbW GBFg/H3iUX9s3bdlibvSh4nlS4AM3ZxQE+utNl/7Aa5U32vYJNmlLxdASWGa/VWONzGy qUkWoHoVK4AdiK3ICHxEhG7T/qsIDUVQ0zf4Bc0SpaWzbOdDZm/KSEeajWFJFU00MHMv xi17WRX7oSHUspXrTQwVKFDHAINanlF4U5Aqj+gIvUVPQfXHvPu0lrPjyeIin4Y2vHrj Nh8krS4HW0vefSMmZZX5OgonfVB3psgkh4zWNiBrQulZBHvAHP3IoC0INqzEUbAeQO20 DUEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jA2kg2Mvxo4L6i9S93dzTR3T+96cRmV/fsYn5yzcv/E=; b=hBHxo8Stj68wQojwlCKb0KC79M9+Ri35V02hgDWsoD/q6oy9AwbgoeBtZtPSq9gLfM Ext7mvAbhqc1iy3S2JcPnTsIKjf8PokdwVkT5K8Jb9Gz7aXlnVHV17n0PhSaHKWvQBTt 8KksFuUhUwOWWUEHbfjUWLEpMOz0i+kTOoCN309yTJAVoxotVkdiJEQeEqQBYsxnxrYD cU1czk4SFt2UL7OijYLdxV25xwYSiipXGIDMk99qSacpM3KWG2iIdzfwFuBjq8QFkTjM 3MKxRI1J/Ldjn8/wgpAlSxOX8T3bmzsSO5ateRDT6OWP9DQ6G1Dmn9oFnB1LAs/Ua3P2 do4A== X-Gm-Message-State: ANhLgQ3N4ji3AZE4j87BC9zD1TKfJknZOzpaB3caGKwpY/oQiMnd6lU+ YobXt3ofyvczjU+PWn7qN+gMtA== X-Google-Smtp-Source: ADFU+vvvLGwPbrhmhuNVUuVV3XLfrJVeFkdV3EnkukxlcgxnOwAMn5jlmUBsE3LYksfpk5mOO61lcg== X-Received: by 2002:a62:86cf:: with SMTP id x198mr4250453pfd.140.1583344603396; Wed, 04 Mar 2020 09:56:43 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id u6sm27906742pgj.7.2020.03.04.09.56.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2020 09:56:43 -0800 (PST) Date: Wed, 4 Mar 2020 09:56:38 -0800 From: Stephen Hemminger To: ZY Qiu Cc: Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , dev@dpdk.org, ZY Qiu Message-ID: <20200304095638.7c7fed0b@hermes.lan> In-Reply-To: <20200304173349.26459-1-tgw_team@tencent.com> References: <20200304140543.31612-1-tgw_team@tencent.com> <20200304173349.26459-1-tgw_team@tencent.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2] rte_ethdev: safer memory access by calling Rx callback 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" On Thu, 5 Mar 2020 01:33:49 +0800 ZY Qiu wrote: > When compiling with -O0, > the compiler does not optimize two memory accesses into one. > Leads to accessing a null pointer when queue post Rx burst callback > removal while traffic is running. > See rte_eth_tx_burst function. > > Signed-off-by: ZY Qiu This is a problem many places in DPDK. You said it was related to -O0 but that is just what is causing a more generic problem to be exposed. Your solution is not sufficient. DPDK is sloppy in several places in handling memory ordering issues https://en.wikipedia.org/wiki/Memory_ordering It should have a macro to do RTE_READ_ONCE(). Several drives have this, the Linux kernel has it, Liburcu has it. The macro RTE_READ_ONCE() can then be used in many places in DPDK.