Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/113124/?format=api
http://patches.dpdk.org/api/patches/113124/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20220620131044.1858049-1-david.marchand@redhat.com/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20220620131044.1858049-1-david.marchand@redhat.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20220620131044.1858049-1-david.marchand@redhat.com", "date": "2022-06-20T13:10:44", "name": "vdpa/mlx5: fix leak on event thread creation", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "ab7993f923a127c6c4c02aefd354bec76f5d242c", "submitter": { "id": 1173, "url": "http://patches.dpdk.org/api/people/1173/?format=api", "name": "David Marchand", "email": "david.marchand@redhat.com" }, "delegate": { "id": 2642, "url": "http://patches.dpdk.org/api/users/2642/?format=api", "username": "mcoquelin", "first_name": "Maxime", "last_name": "Coquelin", "email": "maxime.coquelin@redhat.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20220620131044.1858049-1-david.marchand@redhat.com/mbox/", "series": [ { "id": 23636, "url": "http://patches.dpdk.org/api/series/23636/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=23636", "date": "2022-06-20T13:10:44", "name": "vdpa/mlx5: fix leak on event thread creation", "version": 1, "mbox": "http://patches.dpdk.org/series/23636/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/113124/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/113124/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 331B6A0545;\n\tMon, 20 Jun 2022 15:10:59 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 199504069C;\n\tMon, 20 Jun 2022 15:10:59 +0200 (CEST)", "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by mails.dpdk.org (Postfix) with ESMTP id 533CD40151\n for <dev@dpdk.org>; Mon, 20 Jun 2022 15:10:57 +0200 (CEST)", "from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com\n [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n us-mta-444-CCsOFaCmPl2VFB0W_nuc-g-1; Mon, 20 Jun 2022 09:10:53 -0400", "from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com\n [10.11.54.6])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 54519185A7A4;\n Mon, 20 Jun 2022 13:10:53 +0000 (UTC)", "from fchome.redhat.com (unknown [10.40.193.132])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 10F852166B26;\n Mon, 20 Jun 2022 13:10:51 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1655730656;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=MJoAGpEtYaGdj02Hc8S59gNO9rJttvih9UQizAzwOgQ=;\n b=Fj/DGaIT318HlsaLnXAud2bfmvQ9ZQzO4EKpz1FZ7ERqFUciVDJsmMLUMEcG8kmRhndu+d\n gmysKE4uCia5M1SS80h+Ykd4uKEnvKyGGsx+o2fpzm5L5TN8JTNoh14oZ1sRVnKHhWkPxf\n 6Arrtxt6zQseeMl10hGS0g/zq/4E4Pw=", "X-MC-Unique": "CCsOFaCmPl2VFB0W_nuc-g-1", "From": "David Marchand <david.marchand@redhat.com>", "To": "dev@dpdk.org", "Cc": "stable@dpdk.org, Matan Azrad <matan@nvidia.com>,\n Viacheslav Ovsiienko <viacheslavo@nvidia.com>,\n Xueming Li <xuemingl@nvidia.com>,\n Maxime Coquelin <maxime.coquelin@redhat.com>", "Subject": "[PATCH] vdpa/mlx5: fix leak on event thread creation", "Date": "Mon, 20 Jun 2022 15:10:44 +0200", "Message-Id": "<20220620131044.1858049-1-david.marchand@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 2.78 on 10.11.54.6", "Authentication-Results": "relay.mimecast.com;\n auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com", "X-Mimecast-Spam-Score": "0", "X-Mimecast-Originator": "redhat.com", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain; charset=\"US-ASCII\"; x-default=true", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <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>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org" }, "content": "As stated in the manual, pthread_attr_init return value should be\nchecked.\nBesides, a pthread_attr_t should be destroyed once unused.\n\nIn practice, we may have no leak (from what I read in glibc current code),\nbut this may change in the future.\nStick to a correct use of the API.\n\nFixes: 5cf3fd3af4df (\"vdpa/mlx5: add CPU core parameter to bind polling thread\")\nCc: stable@dpdk.org\n\nSigned-off-by: David Marchand <david.marchand@redhat.com>\n---\nNote: this is only compile tested.\n\n---\n drivers/vdpa/mlx5/mlx5_vdpa_event.c | 30 +++++++++++++++++++----------\n 1 file changed, 20 insertions(+), 10 deletions(-)", "diff": "diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c b/drivers/vdpa/mlx5/mlx5_vdpa_event.c\nindex 7167a98db0..f40a68d187 100644\n--- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c\n+++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c\n@@ -467,6 +467,7 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)\n {\n \tint ret;\n \trte_cpuset_t cpuset;\n+\tpthread_attr_t *attrp = NULL;\n \tpthread_attr_t attr;\n \tchar name[16];\n \tconst struct sched_param sp = {\n@@ -476,22 +477,27 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)\n \tif (!priv->eventc)\n \t\t/* All virtqs are in poll mode. */\n \t\treturn 0;\n-\tpthread_attr_init(&attr);\n-\tret = pthread_attr_setschedpolicy(&attr, SCHED_RR);\n+\tret = pthread_attr_init(&attr);\n+\tif (ret != 0) {\n+\t\tDRV_LOG(ERR, \"Failed to initialize thread attributes\");\n+\t\tgoto out;\n+\t}\n+\tattrp = &attr;\n+\tret = pthread_attr_setschedpolicy(attrp, SCHED_RR);\n \tif (ret) {\n \t\tDRV_LOG(ERR, \"Failed to set thread sched policy = RR.\");\n-\t\treturn -1;\n+\t\tgoto out;\n \t}\n-\tret = pthread_attr_setschedparam(&attr, &sp);\n+\tret = pthread_attr_setschedparam(attrp, &sp);\n \tif (ret) {\n \t\tDRV_LOG(ERR, \"Failed to set thread priority.\");\n-\t\treturn -1;\n+\t\tgoto out;\n \t}\n-\tret = pthread_create(&priv->timer_tid, &attr, mlx5_vdpa_event_handle,\n+\tret = pthread_create(&priv->timer_tid, attrp, mlx5_vdpa_event_handle,\n \t\t\t (void *)priv);\n \tif (ret) {\n \t\tDRV_LOG(ERR, \"Failed to create timer thread.\");\n-\t\treturn -1;\n+\t\tgoto out;\n \t}\n \tCPU_ZERO(&cpuset);\n \tif (priv->event_core != -1)\n@@ -501,12 +507,16 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)\n \tret = pthread_setaffinity_np(priv->timer_tid, sizeof(cpuset), &cpuset);\n \tif (ret) {\n \t\tDRV_LOG(ERR, \"Failed to set thread affinity.\");\n-\t\treturn -1;\n+\t\tgoto out;\n \t}\n \tsnprintf(name, sizeof(name), \"vDPA-mlx5-%d\", priv->vid);\n-\tret = rte_thread_setname(priv->timer_tid, name);\n-\tif (ret)\n+\tif (rte_thread_setname(priv->timer_tid, name) != 0)\n \t\tDRV_LOG(DEBUG, \"Cannot set timer thread name.\");\n+out:\n+\tif (attrp != NULL)\n+\t\tpthread_attr_destroy(attrp);\n+\tif (ret != 0)\n+\t\treturn -1;\n \treturn 0;\n }\n \n", "prefixes": [] }{ "id": 113124, "url": "