Message ID | 20200503162636.5233-1-Renata.Saiakhova@ekinops.com (mailing list archive) |
---|---|
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 81BDDA04B2; Mon, 4 May 2020 19:27:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 506031D53F; Mon, 4 May 2020 19:26:51 +0200 (CEST) Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120138.outbound.protection.outlook.com [40.107.12.138]) by dpdk.org (Postfix) with ESMTP id 0D6951D41C for <dev@dpdk.org>; Sun, 3 May 2020 18:26:49 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZEZ2fJ7uMfDFno808KbYZgn7V1x0itzpF83fZO2znhLBHaAvE6Njh6k2q20egFaxzYuz23sMLR0BoAGjhTuhicJZH7uwZ6D04PH6/NBojneUicATbde5+elXMzFmXapWTBl2ozXkjqguJAQPx97Jq5YTnX0vMawKGsDiPOMmIE8hgufT8LFP5rN3T8h/aWRpAuDBNT+BOYmqb439s5fcowrOj3NeKHY/AAnU0XB2HVYhpHa14l9JJdiKQqSUAgsc6OBbd1CtxrhBB5sR7y4DzVX0U4FE/4XoncpJr+PtZPZp9aBF7y8X4E2CdgwEh4wzvtujpvCqNtb2S8BARGIUmg== 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=0d3vgkpxKQmeYOEnOGefAgfPOgJynaMBXUKaUiv4TT8=; b=nWkbdfw2FxW7OnWw1xz3YuYA4/RyfGF8fAAKdWPc/S7dPK4R67GQnIvTx/eJdvFFrEromnDNupRV5ypRUIU7wwSVfPuLCQBMxsDbRkAW2mUbmRUzreRRAUsZLSpN3wZZNRvcIKGEF7s/rWxI3GWuNxWA7Gb7jrUS3KuA9zJ0v7/EtLLOKW7EJZ++UrXlj05fJ2yzxOJeQzvMuCPAlclbiSoPOilGG/ytHOPPoAkgvFquDZlBiuvGfud9RJo9QlBBo5CEYHfWuno+KMJZR6HcOk3PIcDpaLo1IjRi0zgwJ4Nh7p6iVXBmwUV7WxoY5V84u5ueBB2/BZOTVuAV22i9ug== 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=0d3vgkpxKQmeYOEnOGefAgfPOgJynaMBXUKaUiv4TT8=; b=rNlts55cA3GBNGhN+PpphbO3gKFhV67pzdIIRvtx0KjNz/JT9cDr2vyWDtpI2rfLHzNTVR+4o+KAt6roKoERUjEKXKsKFGZlAf7okDUJTukZApEoZ1sLocAsE62jfFqZXDkmunyemuQCHMZm0mJD2Z1w/ZYtBwNBNqurwjNfIMY= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=ekinops.com; Received: from MRXP264MB0325.FRAP264.PROD.OUTLOOK.COM (52.134.49.19) by MRXP264MB0566.FRAP264.PROD.OUTLOOK.COM (52.134.47.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20; Sun, 3 May 2020 16:26:47 +0000 Received: from MRXP264MB0325.FRAP264.PROD.OUTLOOK.COM ([fe80::41a7:e761:6112:5c08]) by MRXP264MB0325.FRAP264.PROD.OUTLOOK.COM ([fe80::41a7:e761:6112:5c08%7]) with mapi id 15.20.2958.029; Sun, 3 May 2020 16:26:47 +0000 From: Renata Saiakhova <Renata.Saiakhova@ekinops.com> To: dev@dpdk.org Date: Sun, 3 May 2020 18:26:34 +0200 Message-Id: <20200503162636.5233-1-Renata.Saiakhova@ekinops.com> X-Mailer: git-send-email 2.17.2 Content-Type: text/plain X-ClientProxiedBy: AM0PR06CA0087.eurprd06.prod.outlook.com (2603:10a6:208:fa::28) To MRXP264MB0325.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:22::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from renataOAB.oneaccess.intra (91.183.184.98) by AM0PR06CA0087.eurprd06.prod.outlook.com (2603:10a6:208:fa::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Sun, 3 May 2020 16:26:47 +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: c0a2fbf3-dbab-47ad-56d0-08d7ef7ec68d X-MS-TrafficTypeDiagnostic: MRXP264MB0566: X-Microsoft-Antispam-PRVS: <MRXP264MB05664A75DFCBFFC362B9B0E292A90@MRXP264MB0566.FRAP264.PROD.OUTLOOK.COM> X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-Forefront-PRVS: 0392679D18 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TwfGsnTN5kwjk2+uk4Nb+VTMUgRe1wrvt5uh07enMjzH2gTPi6hAEq1uD9NrH1tJ3mL642+exgxUuFNdG5JC5PQRXJhQwdrybJuwzJ38sZEIVl5TCj1B0Zd3BlB6L13MpeUHkVULhInah0Rcu54OazjmD1xiwBq+mus6NuactEx4yCKc0vdBSMYmyMLLS+UxgoA4fNR6pDyuAzfFBfSpzVRnT5fFZQ7vV9J3KwhCxAycJyWhNm2vS7IfWKbBMP4yUibTjqZ6FwEnyCt+ycfn+3Tn4427Ehx2fesj7D2/do11AoCmAb2OHsRz/DhZuiB2C1gjJmCbzaVmwkVw6uJ5SpeVnZF5wxtXEY5G+aGK7p32I0u8v9y4l92soxMqn+zeJkmQoj4162T7mXflFSxOA5wYtzKWq+CYIKAm0vkpqmPwLuQBDtWReBnaxPelK/0u X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MRXP264MB0325.FRAP264.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFTY:; SFS:(136003)(396003)(366004)(376002)(346002)(39830400003)(6506007)(5660300002)(6916009)(8676002)(8936002)(478600001)(86362001)(1076003)(16526019)(66476007)(66946007)(66556008)(2906002)(186003)(26005)(6666004)(52116002)(956004)(2616005)(36756003)(6486002)(6512007)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: Y8dzbtqxhkHZZmc7Jcfx/hozCmbSDpEA1CnQHy+qFO+I6py3X8wr8XTIcildG2EyetNDNROMVU/+8XzoZlzo7R62rQh+zSah5dM1aLB3de5SPjCcHqUNc2yPNFGVEJkNSINEPAToV+O/kfPI7CCy0upf2pmcrcv/j2ONUBBjJPcai2ay1lc0m9GjUuygt9jHGhag4gU45Wl29c4oSQBiWGmnQW7026W/qTRL8rWSixc6953uEh55dkj4NCUufVb95xY1fahS0ZEc/Est225N3tC9utvPOutoWs43B+vr5JDw2Y6U022Yqv1qLztsLqBHNvcNxKzIoAX6H8sOZ/Ez7rWS0g3TeSzBQl/qRab4bzUbi5wn6WrC04YK2F7wIyZUQ3Q+dUMtKlKOeKY61g1c3OHYkQvVe2Bk2fbqNxmUeGPThLMhseC/5gFqES24pnPQ1CaBICTUPb/AmpS1b6XsGTxbrt9z6wu0EST2k6A8XrZ/2rI2Njf6FQb1EuaVtPF7uEaVrhlyvzCoBAAXa4ZYuqc/ZPBHLzyOisNX4+AQ4IlUuaNNoGFcZXr66AHF35Vu0PzgTvAwesQo0wbVIPpTUk91H+JenAougZ/aiFQb3tUljTdToey3r6FvfKl+l62KyyJ2VB3KEH9E2bYkUFlxwZfEZdoQ3bz9iLOKMpMc/XBliqO6JiGeHeycYGsxf58kQNIKFfb41hIL7ijuqYqMcWjHX2op4E5x/qtwWYOukee1LasvcDH8wvqRvbGZWHD1TIno7enQJMioijKSg4RcmgXbKghFOsHJRylnIWGXvds= X-OriginatorOrg: ekinops.com X-MS-Exchange-CrossTenant-Network-Message-Id: c0a2fbf3-dbab-47ad-56d0-08d7ef7ec68d X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2020 16:26:47.4212 (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: yY4DqTXPzCqPcSGnALuCnb7wGlpBZMu6A/N1M3CO0bxCInAsvLfl7scnY47yAyPNmRdQhmlyCJXwSaJT3brLTW37Yb/RtLGUgAeuPIY4tUs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MRXP264MB0566 X-Mailman-Approved-At: Mon, 04 May 2020 19:26:43 +0200 Subject: [dpdk-dev] [PATCH 0/2] 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 <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Series |
Memory corruption due to HW rings allocation
|
|
Message
Renata Saiakhova
May 3, 2020, 4:26 p.m. UTC
igb and ixgbe 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. Renata Saiakhova (2): librte_ethdev: Introduce a function to release HW rings drivers/net: Fix in e1000 and ixgbe HW rings memory overlap drivers/net/e1000/igb_rxtx.c | 2 ++ drivers/net/ixgbe/ixgbe_rxtx.c | 2 ++ lib/librte_ethdev/rte_ethdev.c | 23 +++++++++++++++++++++++ lib/librte_ethdev/rte_ethdev_driver.h | 14 ++++++++++++++ lib/librte_ethdev/rte_ethdev_version.map | 1 + 5 files changed, 42 insertions(+)
Comments
03/05/2020 18:26, Renata Saiakhova: > igb and ixgbe 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. I don't understand the use case. Do you mean you close one port and open another one, so the port id is recycled by ethdev? Please could you elaborate with some code snippet?
Hi Thomas, In our application dpdk port can be connected and disconnected: Connect: new_port_id = netdev_dpdk_get_port_by_devargs(dpdk_port->pci_addr_str); if (!rte_eth_dev_is_valid_port(new_port_id)) { /* Device not found in DPDK, attempt to attach it */ if (rte_dev_probe(dpdk_port->pci_addr_str)) { new_port_id = DPDK_ETH_PORT_ID_INVALID; } else { new_port_id = netdev_dpdk_get_port_by_devargs(dpdk_port->pci_addr_str); if (rte_eth_dev_is_valid_port(new_port_id)) { LO_TRACE("Device '%s' attached to DPDK", dpdk_port->pci_addr_str); } else { /* Attach unsuccessful */ new_port_id = DPDK_ETH_PORT_ID_INVALID; } } } Disconnect: dp_ConfigureRxQueues(dpdk_port, FALSE); rte_eth_dev_set_link_down(port_id); rte_eth_dev_stop(port_id); rte_eth_dev_close(port_id); and yes, exactly, port id is recycled by eth_dev. Next time, switching from igb port to ixgbe with the same port and using HW rings of bigger size for ixgbe creates memory corruption. Kind regards, Renata
05/05/2020 13:19, Renata Saiakhova: > Hi Thomas, > > In our application dpdk port can be connected and disconnected: > > Connect: > new_port_id = netdev_dpdk_get_port_by_devargs(dpdk_port->pci_addr_str); > > if (!rte_eth_dev_is_valid_port(new_port_id)) { > /* Device not found in DPDK, attempt to attach it */ > if (rte_dev_probe(dpdk_port->pci_addr_str)) { > new_port_id = DPDK_ETH_PORT_ID_INVALID; > } else { > new_port_id = netdev_dpdk_get_port_by_devargs(dpdk_port->pci_addr_str); > if (rte_eth_dev_is_valid_port(new_port_id)) { > LO_TRACE("Device '%s' attached to DPDK", dpdk_port->pci_addr_str); > } else { > /* Attach unsuccessful */ > new_port_id = DPDK_ETH_PORT_ID_INVALID; > } > } > } > > Disconnect: > > dp_ConfigureRxQueues(dpdk_port, FALSE); > rte_eth_dev_set_link_down(port_id); > rte_eth_dev_stop(port_id); > rte_eth_dev_close(port_id); > > and yes, exactly, port id is recycled by eth_dev. Next time, switching from igb port to ixgbe with the same port and using HW rings of bigger size for ixgbe creates memory corruption. I see. Reusing the same rings for a new port seems really wrong indeed. Please check if same issue must be fixed in other PMDs.