From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7CCA142C97; Mon, 12 Jun 2023 12:26:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0FF804114A; Mon, 12 Jun 2023 12:26:15 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by mails.dpdk.org (Postfix) with ESMTP id CE09840689; Mon, 12 Jun 2023 12:26:12 +0200 (CEST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id D613C3200943; Mon, 12 Jun 2023 06:26:10 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 12 Jun 2023 06:26:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1686565570; x=1686651970; bh=vujPevBn6QBQE7MKgr1aNr6HnfeN0eV5BPT 5ecKDvC8=; b=nnPgzZI8Ak10PaeM/eFxxbujFHWWhVThItEPYrZGi4SuQEuZsny iECVjqZ09g//IuJdAQPrGDal9V/vSCgPRmxRiaayKSZuA4PGULEkISUjWtJrcuxy xNvvR/1Rb6m+SK6wTgAkRnJxd6SN2qWsFzSVkshq02FlTkdGZMtqLIy4eIa1MkwN bN+Jhoj99eRz/Tu+UVk771ZT9FzESUwKMKbRl4+uu64LUgw+30XlouY2SBMsMREA HH4IAx3ByGGiQU8t7PdzIomaP3342Jj4ZV4FDXTBB2cGFqP33J/NWB9DupRPvpS0 oLWrS5QS7vtGE9mrWYSTMytUnJMQU9PDv2g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1686565570; x=1686651970; bh=vujPevBn6QBQE7MKgr1aNr6HnfeN0eV5BPT 5ecKDvC8=; b=n1tCSOjHCz1p5Nhd79LuioeckfCceMxpodTc59PLCK/oTE8lYK+ ICcreeZOM87MbLtOAc5k8tXsEyrphUHj9HcRx4cHNLP9jHZCEKdb1JO9CATdxD0y d/zkk7CTgysSFPh2SpLQbkuyBcR+W6c6lCByvc5DucnqyQAZK8nci26ljkG0e/QI QnPK0eOJK8a4XCMBil3h4es6oQVQiH8BBsQ8L2YGaINtGQBy+DFPUUl+EAnQDgFB HvIG9L3fJayx043jRog3GgHolipIXbSXrqeiV5pkQJPC1RGFGWKl2kXMzPbZB97i xg8/2oWr07QqtdbX303rCwxzVfAo0GsMExw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgeduhedgvdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpedtjeeiieefhedtfffgvdelteeufeefheeujefgueetfedttdei kefgkeduhedtgfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 12 Jun 2023 06:26:07 -0400 (EDT) From: Thomas Monjalon To: Ruifeng Wang , Min Zhou , dev@dpdk.org, "Zhang, Qi Z" Cc: "mb@smartsharesystems.com" , "konstantin.v.ananyev@yandex.ru" , "Yang, Qiming" , "Wu, Wenjun1" , "drc@linux.vnet.ibm.com" , "roretzla@linux.microsoft.com" , "dev@dpdk.org" , "stable@dpdk.org" , "maobibo@loongson.cn" , nd , david.marchand@redhat.com Subject: Re: [PATCH v3] net/ixgbe: add proper memory barriers for some Rx functions Date: Mon, 12 Jun 2023 12:26:06 +0200 Message-ID: <3202143.AJdgDx1Vlc@thomas> In-Reply-To: References: <20230424090532.367194-1-zhoumin@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 15/05/2023 04:10, Zhang, Qi Z: > From: Ruifeng Wang > > From: Min Zhou > > > > > > Segmentation fault has been observed while running the > > > ixgbe_recv_pkts_lro() function to receive packets on the Loongson > > > 3C5000 processor which has 64 cores and 4 NUMA nodes. > > > > > > From the ixgbe_recv_pkts_lro() function, we found that as long as the > > > first packet has the EOP bit set, and the length of this packet is > > > less than or equal to rxq->crc_len, the segmentation fault will > > > definitely happen even though on the other platforms. For example, if > > > we made the first packet which had the EOP bit set had a zero length by > > force, the segmentation fault would happen on X86. > > > > > > Because when processd the first packet the first_seg->next will be > > > NULL, if at the same time this packet has the EOP bit set and its > > > length is less than or equal to rxq->crc_len, the following loop will be > > executed: > > > > > > for (lp = first_seg; lp->next != rxm; lp = lp->next) > > > ; > > > > > > We know that the first_seg->next will be NULL under this condition. So > > > the expression of > > > lp->next->next will cause the segmentation fault. > > > > > > Normally, the length of the first packet with EOP bit set will be > > > greater than rxq- > > > >crc_len. However, the out-of-order execution of CPU may make the read > > > >ordering of the > > > status and the rest of the descriptor fields in this function not be > > > correct. The related codes are as following: > > > > > > rxdp = &rx_ring[rx_id]; > > > #1 staterr = rte_le_to_cpu_32(rxdp->wb.upper.status_error); > > > > > > if (!(staterr & IXGBE_RXDADV_STAT_DD)) > > > break; > > > > > > #2 rxd = *rxdp; > > > > > > The sentence #2 may be executed before sentence #1. This action is > > > likely to make the ready packet zero length. If the packet is the > > > first packet and has the EOP bit set, the above segmentation fault will > > happen. > > > > > > So, we should add a proper memory barrier to ensure the read ordering > > > be correct. We also did the same thing in the ixgbe_recv_pkts() > > > function to make the rxd data be valid even though we did not find > > segmentation fault in this function. > > > > > > Fixes: 8eecb3295ae ("ixgbe: add LRO support") > > > Cc: stable@dpdk.org > > > > > > Signed-off-by: Min Zhou > > > --- > > > v3: > > > - Use rte_smp_rmb() as the proper memory barrier instead of rte_rmb() > > > --- > > > v2: > > > - Make the calling of rte_rmb() for all platforms > > > --- [...] > > Reviewed-by: Ruifeng Wang > > Applied to dpdk-next-net-intel. > > Thanks > Qi > Why ignoring checkpatch? It is saying: " Warning in drivers/net/ixgbe/ixgbe_rxtx.c: Using rte_smp_[r/w]mb " Ruifeng proposed "rte_atomic_thread_fence(__ATOMIC_ACQUIRE)" in a comment on the v2. I will drop this patch from the pull of next-net-intel branch.