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 B4A0EA04C0; Tue, 29 Sep 2020 12:36:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 28E321D60B; Tue, 29 Sep 2020 12:36:37 +0200 (CEST) Received: from new2-smtp.messagingengine.com (new2-smtp.messagingengine.com [66.111.4.224]) by dpdk.org (Postfix) with ESMTP id E81D31D5A0 for ; Tue, 29 Sep 2020 12:36:35 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id 3CC7C580358; Tue, 29 Sep 2020 06:36:34 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 29 Sep 2020 06:36:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm2; bh= lnmiHnWX54VBpmQL1Y+NZNV8Uxk/Y5sKQSR7IopyVDo=; b=YSjmhDyswK+OlUHW 1+7XCpp16o9ONqU7A11+b6W56o0Zs3DmCP6fz435i6nFzf5cIQ0HMbNTtbydy4fl Xu8TDUM9O2FejIKEKmrEay3XAVgrCziqt/094qBj+k/Z7wUBpDeflwdn26HV8xNq tkbXce9+Xztw+gFZP5V+dka1Skv53UM89psm2XYr8xj4QTckM+aXuQgVcFuftNPe a27kq+bQ0YmLOcpjkGabhBWkgbk6Skd0Xig7TIcIcCc5Sdgh4gMXEC7uPVGEAfs7 lwFBgOTuzp7La2tRcBw8ohk1ADmIwfZeG/5Qk3ep4lB1LvNXNIg3ZJa01CZp6Gk8 QVwzEQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=lnmiHnWX54VBpmQL1Y+NZNV8Uxk/Y5sKQSR7IopyV Do=; b=qA4RQgYZht6hYWirWw13kdd9323kYlkbQnXtvTyGt+3xSWtZV6OUOqtxQ DC3IGuqYvGyhPCplZuooLBvMkUnxsbxHBv+rmdLnFx/IrEkJWIwOGqNlVn/6vdjA hp1wBc60uynhMQq7VBf6I+5eaRwMJdKJoTxxsEvDmmDHyPihP2WtX0K9TkRV2Jnb CMgb/oFb/xeX/WKJpjH7rGC4GRAbjlqI4mniIENiJgPt/MjXVZ0OKA0KP5CnkEeB /Djm/MU6b3cJ4WfXyBxyXWzMzTCldAArtS5Pefbhdlf41/wNiw38iBF5ioxf/BIF JAdpcoZgIiQfezey+FaAtsVFf+Wcw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdekgdefudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpeffvdffjeeuteelfeeileduudeugfetjeelveefkeejfeeigeehteff vdekfeegudenucffohhmrghinhepughpughkrdhorhhgnecukfhppeejjedrudefgedrvd dtfedrudekgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhr ohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id ADD06328005A; Tue, 29 Sep 2020 06:36:27 -0400 (EDT) From: Thomas Monjalon To: Maxime Coquelin Cc: dev@dpdk.org, ferruh.yigit@intel.com, arybchenko@solarflare.com, Shepard Siegel , Ed Czeck , John Miller , Igor Russkikh , Pavel Belous , Somalapuram Amaranath , Ajit Khaparde , Somnath Kotur , Chas Williams , "Wei Hu (Xavier)" , Hemant Agrawal , Sachin Saxena , Jeff Guo , Haiyue Wang , Marcin Wojtas , Michal Krawczyk , Guy Tzalik , Evgeny Schemeilin , Igor Chauskin , Qi Zhang , Xiao Wang , Ziyang Xuan , Xiaoyun Wang , Guoyang Zhou , "Min Hu (Connor)" , Yisen Zhuang , Beilei Xing , Jingjing Wu , Qiming Yang , Alfredo Cardigliano , Shijith Thotton , Srisivasubramanian Srinivasan , Stephen Hemminger , "K. Y. Srinivasan" , Haiyang Zhang , Long Li , Harman Kalra , Rasesh Mody , Shahed Shaikh , Keith Wiles , Chenbo Xia , Zhihong Wang , Yong Wang , matan@nvidia.com Date: Tue, 29 Sep 2020 12:36:26 +0200 Message-ID: <6133857.dQzx89rgS5@thomas> In-Reply-To: <269736e1-bf3f-a010-914f-904f86e8c947@redhat.com> References: <20200913220711.3768597-1-thomas@monjalon.net> <20200928231437.414489-29-thomas@monjalon.net> <269736e1-bf3f-a010-914f-904f86e8c947@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v3 28/29] ethdev: reset all when releasing a port 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" 29/09/2020 12:26, Maxime Coquelin: > On 9/29/20 1:14 AM, Thomas Monjalon wrote: > > The function rte_eth_dev_release_port() was resetting partially > > the struct rte_eth_dev. The drivers were completing it > > with more pointers set to NULL in the close or remove operations. > > > > A full memset is done so most of those assignments become useless. [...] > With this patch, I get following segfault at init time with Virtio PMD: > > Program received signal SIGSEGV, Segmentation fault. > 0x0000000000854c9b in rte_eth_dev_callback_register (port_id=32, > event=RTE_ETH_EVENT_UNKNOWN, cb_fn=0x4b24de > , > cb_arg=0x0) at ../lib/librte_ethdev/rte_ethdev.c:4042 > 4042 > TAILQ_INSERT_TAIL(&(dev->link_intr_cbs), Yes this is because after closing a port, everything is resetted, including .link_intr_cbs which is set only once in a constructor: http://git.dpdk.org/dpdk/commit/?id=9ec0b3869d8 I can change this patch to selectively set pointers to NULL. Or if we prefer a big memset 0, we need to rework how RTE_ETH_ALL is managed to register a callback for any event. Instead of setting the callback for all ports, we could have a special catch-call callback list which is called for all events. This way we could revert initializing .link_intr_cbs in eth_dev_get().