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 43B1CA0519; Mon, 22 Jun 2020 11:55:26 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 072EB1D62D; Mon, 22 Jun 2020 11:55:26 +0200 (CEST) Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120104.outbound.protection.outlook.com [40.107.12.104]) by dpdk.org (Postfix) with ESMTP id 872F41D62A for ; Mon, 22 Jun 2020 11:55:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E+58hvGhHnfe0XaA//e/BGv2P6pFxjkpPceYnT9AzfEgeTwIq0Yle/aAG7I6IStO+8BsIsDP3C36sBPkOgvaU2pdRNeBppRbP76Qw3jfistIZrdnB1dpNYyLQWHcN+2smIgGKDySMFHkuO0GDJ2lkuzMfC5k++ZglhfeOyBKmjAH8MG+Lh8JRbrq88F+MBcXJpDIBHBB7EbC+ykIC53a7iqXXchYVTkH3cPa/MlGBWmelLBOOdEw6G5SHTfoKKo2jfbatZx/6IfQfVLsPFNh9BzDURcCzIpupiBjNBViwRf7aMO3dTR39P5DSrjzWghoTN9HI4Wc4oV2ZV7GaLafPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=47rB2uVw2rARGruKHVAsyzRaN4CqjfUS8UrsUKtkiLs=; b=IIUWDx3vTGnYA/fc81h5RoW9ycQBII/lu7yec9ET8rv79bE+LMyHrciJd8hQCZIzq8VyzgQO/SyYWF5F4Ao38sfy3eKkvkyBLDbTz8Au92letdOAg/325iTb3hsHcD9vXbzRu0dnnZzRpbAo52YF8/B/2IlSL/C3a45kaFsbYKyQQbZDw4FqpO6yMVraQfBU20ofqfZwuRDkoSrPfQawFzVvu05n9SfRYmZqQkzr8epjOscJbSv5MPmEeZiAmFwhJ4GfSWV09f0RP790s8a/JwR5xvs+OQxsgJJ7jfZ+CRFxBy9bLGoNvGR6fU2ZSfGbnpC+hVQMgxWHlNiOW/xsCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ekinops.com; dmarc=pass action=none header.from=ekinops.com; dkim=pass header.d=ekinops.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ekinops.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=47rB2uVw2rARGruKHVAsyzRaN4CqjfUS8UrsUKtkiLs=; b=GXHlQUYDiFe14PYGtBp4qrghjNASkuev32bkKX/K4SpH48Sft5z1WzIt8PTPdXwVKWxijXbwND9GCzGelZvmxzzhzHhR3yRtvqAVc7amJ/MUXnWTRYie8x2DYS/8H7P2iuGOf/g3uVh6Y6yFml5Bb/W6jBk1plnrRVFbAbA53eQ= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=ekinops.com; Received: from MRXP264MB0120.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:1b::10) by MRXP264MB0102.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:17::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.23; Mon, 22 Jun 2020 09:55:23 +0000 Received: from MRXP264MB0120.FRAP264.PROD.OUTLOOK.COM ([fe80::b9c3:a77c:6837:2548]) by MRXP264MB0120.FRAP264.PROD.OUTLOOK.COM ([fe80::b9c3:a77c:6837:2548%6]) with mapi id 15.20.3109.027; Mon, 22 Jun 2020 09:55:23 +0000 From: Renata Saiakhova To: dev@dpdk.org Cc: Renata Saiakhova Date: Mon, 22 Jun 2020 11:54:39 +0200 Message-Id: <20200622095443.26136-1-Renata.Saiakhova@ekinops.com> X-Mailer: git-send-email 2.17.2 Content-Type: text/plain X-ClientProxiedBy: AM0PR10CA0015.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::25) To MRXP264MB0120.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:1b::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from renataOAB.oneaccess.intra (91.183.184.98) by AM0PR10CA0015.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.22 via Frontend Transport; Mon, 22 Jun 2020 09:55:23 +0000 X-Mailer: git-send-email 2.17.2 X-Originating-IP: [91.183.184.98] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 08d5fa26-c298-4a5b-f7e4-08d8169261d4 X-MS-TrafficTypeDiagnostic: MRXP264MB0102: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 0442E569BC X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d3iflUSB6w0DapU2T9Q3vIMMOR4vh5EHrV6QAJxXbNow2ysYCcohtV4vFOB5ztklN+NnscJSxMWvhXiSLrEncirAiMMNq5jz5Gm8JL3+vdGEHGAPbRmkiL5cijtfAg1U5/+kLM3PAp/8YkHLRiZ3g4qikHbRfH9vZIXpjFty3DA6s+gUS0eQI5WnZ9dXXqvha00RnR8X2IzzYMCp7WqkEXSlAmlaiPqG2u9yfp5XJSrRo0HG3vczOYSyzU2lOoNTmKCV7x74NsHLLFCeOk17LTHoIkH12X4rvmQMS2UabtcyU3QAs5hwJLm8StqZGY50OX44WTXsTUBzDoYXNRgRXA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MRXP264MB0120.FRAP264.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFTY:; SFS:(376002)(346002)(396003)(136003)(39840400004)(366004)(66556008)(66476007)(86362001)(316002)(8676002)(8936002)(66946007)(478600001)(5660300002)(2906002)(1076003)(956004)(2616005)(16526019)(6512007)(36756003)(6666004)(83380400001)(6486002)(186003)(4326008)(6916009)(52116002)(26005)(6506007)(107886003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: faSS1lUl/7VG8VPqaik3ibWnbn6umcQ8mUO/t0RfwHIEDR+L4baod5T83Cpsh0vA3OxAOunpBUWUjCo/BozipYyMXFZna4Tx4/wiqDt56XtDeS3j5Fb6Cr3BCrDMSahFeOXtxlLmE6I2DlhTT8sPBI7Pfcct5nZ/xJYTJpey40LvRGfq/1bvHLGsaruMXxcRxsyFtmXf22nvEDQGJHYCMKnV8alVHgg9j/vk8xJrpkDwOAmjeLaOgJ9hPCZb6Ip52KgMiNjdosBznuyCfRCRjjh21KROKxO3qRoYK83YLCaHHHAK+PLrD3AvSba5K7skOOqNHY42YMG7QV0iE0BWbRwvBNyq8VT57viKI2c/LlG4st2OpW8QIMM/5pVY/86aSC7TG2heftV7qLD23JpcRjV8fmmvU+Lvyz4Qyhk/B4M1zx0HVzcBDb6NS6feakykN1d6F4AZGdcp8mPT7NWDKWKNvHp9sxkYDm9M7PSSzCc= X-OriginatorOrg: ekinops.com X-MS-Exchange-CrossTenant-Network-Message-Id: 08d5fa26-c298-4a5b-f7e4-08d8169261d4 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2020 09:55:23.6617 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f57b78a6-c654-4771-a72f-837275f46179 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yYvyrEmhLPpYCUKncdWOmjvGsEofoReV7Iv29VzXcDrXaJPd1pdeFraCAAdmGaZv7Ui2PZ8L+tUz8nARHKDawltl2BsGm8GTq2Rmh1dvq1Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MRXP264MB0102 Subject: [dpdk-dev] [PATCH v4 0/4] Memory corruption due to HW rings allocation 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" igb and ixgbe and some other drivers allocate HW rings using rte_eth_dma_zone_reserve(), which checks first if the memzone exists for a given name, consisting of port id, queue_id, rx/tx direction, but not for the size, alignment, and socket_id. If the memzone with a given name exists it is returned, otherwise it is allocated. Disconnecting dpdk port from one type of interface (igb) and connecting it to another type of interface (ixgbe) for the same port id, potentially creates memory overlap and corruption, because it may require memzone of bigger size. That's what is happening from switching from igb to ixgbe having the same port id. v3->v4: Improve return code in rte_eth_dma_zone_free() in case mz is not found; Release explicitly i40e Flow Director rx/tx rings by calling rte_eth_dma_zone_free(). v2->v3: Remove #undef ETH_DMA_MZONE_NAME and minor changes in code standard. v1->v2: Minor changes on code standard and additional fixes in i40e em and ice drivers. Renata Saiakhova (4): librte_ethdev: Introduce a function to release HW rings drivers/net: Fix in igb and ixgbe HW rings memory drivers/net: Fix in i40e HW rings memory overlap drivers/net: Fix in em and ice HW rings memory overlap drivers/net/e1000/em_rxtx.c | 2 ++ drivers/net/e1000/igb_rxtx.c | 2 ++ drivers/net/i40e/i40e_fdir.c | 3 +++ drivers/net/i40e/i40e_rxtx.c | 2 ++ drivers/net/ice/ice_rxtx.c | 2 ++ drivers/net/ixgbe/ixgbe_rxtx.c | 2 ++ lib/librte_ethdev/rte_ethdev.c | 30 ++++++++++++++++++++++-- lib/librte_ethdev/rte_ethdev_driver.h | 20 ++++++++++++++++ lib/librte_ethdev/rte_ethdev_version.map | 1 + 9 files changed, 62 insertions(+), 2 deletions(-) -- 2.17.2