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 40544A034E; Tue, 21 Dec 2021 13:40:46 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CC3FD40141; Tue, 21 Dec 2021 13:40:45 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2084.outbound.protection.outlook.com [40.107.93.84]) by mails.dpdk.org (Postfix) with ESMTP id AB1AB40040 for ; Tue, 21 Dec 2021 13:40:44 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jyWraN8UynghJTIHLFYCxplf9jrsoZx9IC561FkVDC7zieZoeVxSfKPrpGOP1k/JxHMxHBgHNNZqewGFQCLVYCn41tWjhl8sNsv3SvKO/QAZ0duixeNDAHIkM0ElxFlEYAU/6Oqh+VrxFdbXzU2A+oBziq/f00lpHuxLEpZMCX1n+i72VJVo32XDYWYJMjNcZ4JvtxWrCM1jumGIgcB7ybdOlcPnVNqCnysYrAUQalEh2PhqJJ3/qRwQHHtvr6AY7L2X7I1DVYQx8Gn9Jz2R6JQKG2W0EOD6RiHN2wLDHyZxy7uNzrZt1PkaX1+e8qdNHgWolVV60uRAHVJ8HzxhVQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=G2hviWQC5ktvKaYKHhKXd16wbQL981K0+RD1foNuLXo=; b=L80poG+WUAgu5Js9QKPNOIWI1jQePV3lH1ev2wzsy9YUoK/hipuHCy7SRkXBkfM5lL35todNoewxzEUxI1BB4vbqf+YqriSdxN+htx/GuIbUv9W7pqDU+fM+0271UTXptNEe4CjZP3isIR9EZzA64HLkmmZDI77a1sut5jBzp5gHqRuRBImHCfdPfynojvKZ5Qy2Z0Tb0dVBoggsF9DHUVOSFgoroZKRv1VRRX6oY/Cnl9mE0KC9RT+u+l0o4IxMwczFeq+Nthqy/CIorIAQXGsqLdTG0uWE9ziietAxaXwXQg2YEeLOxDuio+efphRGNBoZMIbpb8mTG7uSRM+UKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=G2hviWQC5ktvKaYKHhKXd16wbQL981K0+RD1foNuLXo=; b=flz5MRQcI4ui22nTtKEqNaSiVP8+YTEQUAVx2R10uzjVT8AmY2+Z91KfaJokrGC62C6R08bsThwT3Rf4NAAoVBD5K9ZYmg6bi/PbVavBJXBmAY3EVrQSDlIQJhZgQ8Z0vAiFDddkXTJ9r9onS/3vk2MpkOcGORNDfgavDNCz2xYu8vms5PkUEyJBNiunEvGSDwmYjJjCLbXd0bcPcfdLMYsN3G/w5FMwak/hiIz2eqki5B0nGZlxNteEAUJy2HUPQ+IfpA/VCBLDKpCJSGqVfUJC58ziBsPgJK9KPQepcb4KhC4AejSNKmnLTvc9ritbvv2tlu/K+kDxfsf7uwTRiA== Received: from BN9PR03CA0783.namprd03.prod.outlook.com (2603:10b6:408:13f::8) by BL0PR12MB5009.namprd12.prod.outlook.com (2603:10b6:208:1c2::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.15; Tue, 21 Dec 2021 12:40:43 +0000 Received: from BN8NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13f:cafe::e2) by BN9PR03CA0783.outlook.office365.com (2603:10b6:408:13f::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.16 via Frontend Transport; Tue, 21 Dec 2021 12:40:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.234) by BN8NAM11FT023.mail.protection.outlook.com (10.13.177.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4801.14 via Frontend Transport; Tue, 21 Dec 2021 12:40:42 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 21 Dec 2021 12:40:42 +0000 Received: from nvidia.com (172.20.187.6) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.986.9; Tue, 21 Dec 2021 04:40:41 -0800 From: To: CC: Elena Agostini Subject: [PATCH v1] gpu/cuda: fix memory list cleanup Date: Tue, 21 Dec 2021 20:50:42 +0000 Message-ID: <20211221205042.17289-1-eagostini@nvidia.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2069b439-61a0-4676-f40d-08d9c47f1a48 X-MS-TrafficTypeDiagnostic: BL0PR12MB5009:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2803; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gQlDwA2G1SJLjE4ipLfo4W/n6BaP7i0SF2qjKZYW6308RFyK8wZ7L7LCdzKMS3M28cLnB1BNt5P4AOVeBn8ZNa7k+q8hHEyD9K0bHNUNS83UoVLa9ChE5kf/dvMAcKlCkso7SbtG5v8VZ45/UuOm3Yh5ck3SwL+J1lNZR1HZ8LYBS7GH+hcD+XytfUMwR3/QuyZC2/E3vgfEvqDo+bR7mucH9F9VMWPYvDfdDPy3UZVIw/LQh6WY9FtbQXT8EZJxPsmnTwfX4l1cbN1l+WxCRn2yYPP0a+Ju7RmPmQ4o35Yr6Hz21gJoEeRW1Vr9/Ocwfuag1ns5s19jGQ5+qKqSxvWGRAV32wZe4/KOchYX8gqTJPvhx9Dz77vZzE8WnChfYARatEPekN79n6WI7O77NcXz8bNWB2uh+9g28wMvgL5KsWKyLDe8+5mRWtck/eOYMol6FoA0dqOJRVTEBXcioKC225JSc1ElN+NKd1JSXpeHEIo8iCP2tHRts5gNPyENnLJ20D3ZFMyemCxDwfXE2OrY6V6ztxYQZa+fSi2aRAWEZ2x2OuA75hhWnf6fbH6HP6TZ/mocf8DSRZUVZLYnPL+OlVIN2EphwxM2gOB5S+EzdOLij0e3+GB8taAHyyq+m7x99ii77nuH+q81HrzpCrbsLvPUd9Xv1XR/6eBV/AmpBz/vsZZMWNEOvO8L+En5aD0VOMzDb2bNdw0VLi1tTTpXZ4KIbEirfERx7uwTUT5MYk9Y/aln+l7zreVeghMGoD8k/LAkrhf/Ts/wEWrWf43xx0IKQuNQvFRj2KNHQ7Nbl/6/XOr9a8I/edX+5qT55ltcQS8UyFACK/m/Yqx4MA== X-Forefront-Antispam-Report: CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(4636009)(40470700002)(46966006)(36840700001)(40460700001)(316002)(4744005)(26005)(356005)(7696005)(426003)(2616005)(70206006)(47076005)(6916009)(82310400004)(34020700004)(16526019)(2906002)(8936002)(70586007)(6286002)(186003)(107886003)(55016003)(8676002)(81166007)(1076003)(36860700001)(83380400001)(5660300002)(4326008)(336012)(2876002)(86362001)(508600001)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2021 12:40:42.8796 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2069b439-61a0-4676-f40d-08d9c47f1a48 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.234]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB5009 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 From: Elena Agostini Memory list cleanup (called by cuda_mem_free) was not properly set the new head of the list when deleting an entry. Fixes: 1306a73b1958 ("gpu/cuda: introduce CUDA driver") Signed-off-by: Elena Agostini --- drivers/gpu/cuda/cuda.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c index 49da215af4..afd4b92a93 100644 --- a/drivers/gpu/cuda/cuda.c +++ b/drivers/gpu/cuda/cuda.c @@ -447,9 +447,11 @@ mem_list_del_item(cuda_ptr_key pk) return -EINVAL; /* if key is in head */ - if (mem_alloc_list_cur->prev == NULL) + if (mem_alloc_list_cur->prev == NULL) { mem_alloc_list_head = mem_alloc_list_cur->next; - else { + if (mem_alloc_list_head != NULL) + mem_alloc_list_head->prev = NULL; + } else { mem_alloc_list_cur->prev->next = mem_alloc_list_cur->next; if (mem_alloc_list_cur->next != NULL) mem_alloc_list_cur->next->prev = mem_alloc_list_cur->prev; -- 2.17.1