get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/63507/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 63507,
    "url": "http://patches.dpdk.org/api/patches/63507/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20191202154221.10942-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": "<20191202154221.10942-1-david.marchand@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20191202154221.10942-1-david.marchand@redhat.com",
    "date": "2019-12-02T15:42:20",
    "name": "[4/4] eal: remove limitation on cpuset with --lcores",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "0fc684dd957e0bd8bc81218449dcb5444269c96f",
    "submitter": {
        "id": 1173,
        "url": "http://patches.dpdk.org/api/people/1173/?format=api",
        "name": "David Marchand",
        "email": "david.marchand@redhat.com"
    },
    "delegate": {
        "id": 24651,
        "url": "http://patches.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20191202154221.10942-1-david.marchand@redhat.com/mbox/",
    "series": [
        {
            "id": 7707,
            "url": "http://patches.dpdk.org/api/series/7707/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=7707",
            "date": "2019-12-02T15:35:55",
            "name": "Extend --lcores to run on cores > RTE_MAX_LCORE",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/7707/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/63507/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/63507/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 3337BA04B5;\n\tMon,  2 Dec 2019 16:42:33 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 093C01BF78;\n\tMon,  2 Dec 2019 16:42:33 +0100 (CET)",
            "from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com\n [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id 257371BF72\n for <dev@dpdk.org>; Mon,  2 Dec 2019 16:42:32 +0100 (CET)",
            "from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com\n [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id\n us-mta-299-8QOJUvRaMGueyaoUusLzJw-1; Mon, 02 Dec 2019 10:42:28 -0500",
            "from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com\n [10.5.11.15])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9C632804901;\n Mon,  2 Dec 2019 15:42:27 +0000 (UTC)",
            "from dmarchan.remote.csb (ovpn-205-88.brq.redhat.com [10.40.205.88])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 2960C5D6A0;\n Mon,  2 Dec 2019 15:42:25 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1575301351;\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 in-reply-to:in-reply-to:references:references;\n bh=jYnFyHDBht+CJgkN5pbSW/A2KzHaEuShXZwrAkdHwoA=;\n b=Wjbrz+h9J/M+W/W3AF2zl4xMAZWfU7RgqCDkZt/JXMfVmdE6UZrdIZYj7L5og14/HINAw9\n 0yOO6YO3ioIN1FBrog/G/3DlChutZD9sTCOLpVSB7wxPuObAkK9bHaIxvnkHxWWyxw5iG1\n U32muM3Gxda404T8Z0D1I9vOD8huiZs=",
        "From": "David Marchand <david.marchand@redhat.com>",
        "To": "dev@dpdk.org",
        "Cc": "aconole@redhat.com, Hemant Agrawal <hemant.agrawal@nxp.com>,\n Sachin Saxena <sachin.saxena@nxp.com>",
        "Date": "Mon,  2 Dec 2019 16:42:20 +0100",
        "Message-Id": "<20191202154221.10942-1-david.marchand@redhat.com>",
        "In-Reply-To": "<20191202153559.9709-1-david.marchand@redhat.com>",
        "References": "<20191202153559.9709-1-david.marchand@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.15",
        "X-MC-Unique": "8QOJUvRaMGueyaoUusLzJw-1",
        "X-Mimecast-Spam-Score": "0",
        "Content-Type": "text/plain; charset=US-ASCII",
        "Content-Transfer-Encoding": "quoted-printable",
        "Subject": "[dpdk-dev] [PATCH 4/4] eal: remove limitation on cpuset with\n\t--lcores",
        "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>,\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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Contrary to the -c/-l options, where a logical core runs on the same\nphysical core in a 1:1 fashion (example: lcore 0 runs on core 0, lcore\n16 runs on core 16), the --lcores option makes it possible to select the\nphysical cores on which runs a logical core.\n\nHowever the current parsing code still limits the cpuset to the\n[0, RTE_MAX_LCORE] range.\n\nExample, before the patch, on a 24 cores system with RTE_MAX_LCORE == 16:\n$ ./master/app/testpmd --no-huge --no-pci -m 512 --log-level *:debug \\\n --lcores 0@16,1@17 -- -i --total-num-mbufs 2048\nEAL: Detected lcore 0 as core 0 on socket 0\nEAL: Detected lcore 1 as core 1 on socket 0\nEAL: Detected lcore 2 as core 2 on socket 0\nEAL: Detected lcore 3 as core 3 on socket 0\nEAL: Detected lcore 4 as core 4 on socket 0\nEAL: Detected lcore 5 as core 5 on socket 0\nEAL: Detected lcore 6 as core 6 on socket 0\nEAL: Detected lcore 7 as core 8 on socket 0\nEAL: Detected lcore 8 as core 9 on socket 0\nEAL: Detected lcore 9 as core 10 on socket 0\nEAL: Detected lcore 10 as core 11 on socket 0\nEAL: Detected lcore 11 as core 12 on socket 0\nEAL: Detected lcore 12 as core 13 on socket 0\nEAL: Detected lcore 13 as core 14 on socket 0\nEAL: Detected lcore 14 as core 0 on socket 0\nEAL: Detected lcore 15 as core 1 on socket 0\nEAL: Skipped lcore 16 as core 2 on socket 0\nEAL: Skipped lcore 17 as core 3 on socket 0\nEAL: Skipped lcore 18 as core 4 on socket 0\nEAL: Skipped lcore 19 as core 5 on socket 0\nEAL: Skipped lcore 20 as core 6 on socket 0\nEAL: Skipped lcore 21 as core 8 on socket 0\nEAL: Skipped lcore 22 as core 9 on socket 0\nEAL: Skipped lcore 23 as core 10 on socket 0\nEAL: Skipped lcore 24 as core 11 on socket 0\nEAL: Skipped lcore 25 as core 12 on socket 0\nEAL: Skipped lcore 26 as core 13 on socket 0\nEAL: Skipped lcore 27 as core 14 on socket 0\nEAL: Support maximum 16 logical core(s) by configuration.\nEAL: Detected 16 lcore(s)\nEAL: Detected 1 NUMA nodes\nEAL: invalid parameter for --lcores\n\nWe can remove this limitation by using a cpuset_t (which is a more\nnatural type since this is what gets passed to pthread_setaffinity*\nin the end).\n\nAfter the patch:\n$ ./master/app/testpmd --no-huge --no-pci -m 512 --log-level *:debug \\\n --lcores 0@16,1@17 -- -i --total-num-mbufs 2048\n[...]\nEAL: Master lcore 0 is ready (tid=7f94217bbc00;cpuset=[16])\nEAL: lcore 1 is ready (tid=7f941f491700;cpuset=[17])\n\nSigned-off-by: David Marchand <david.marchand@redhat.com>\n---\n drivers/bus/fslmc/portal/dpaa2_hw_dpio.c   | 31 ++++++-----\n lib/librte_eal/common/eal_common_options.c | 63 +++++++++++-----------\n lib/librte_eal/common/eal_common_thread.c  |  4 +-\n 3 files changed, 50 insertions(+), 48 deletions(-)",
    "diff": "diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c\nindex 3ca3ae4f51..739ce434ba 100644\n--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c\n+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c\n@@ -365,20 +365,25 @@ dpaa2_check_lcore_cpuset(void)\n \t\tdpaa2_cpu[lcore_id] = 0xffffffff;\n \n \tfor (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {\n-\t\tfor (i = 0; i < RTE_MAX_LCORE; i++) {\n-\t\t\trte_cpuset_t cpuset = rte_lcore_cpuset(lcore_id);\n-\n-\t\t\tif (CPU_ISSET(i, &cpuset)) {\n-\t\t\t\tRTE_LOG(DEBUG, EAL, \"lcore id = %u cpu=%u\\n\",\n-\t\t\t\t\tlcore_id, i);\n-\t\t\t\tif (dpaa2_cpu[lcore_id] != 0xffffffff) {\n-\t\t\t\t\tDPAA2_BUS_ERR(\n-\t\t\t\t    \"ERR:lcore map to multi-cpu not supported\");\n-\t\t\t\t\tret = -1;\n-\t\t\t\t} else  {\n-\t\t\t\t\tdpaa2_cpu[lcore_id] = i;\n-\t\t\t\t}\n+\t\trte_cpuset_t cpuset = rte_lcore_cpuset(lcore_id);\n+\n+\t\tfor (i = 0; i < CPU_SETSIZE; i++) {\n+\t\t\tif (!CPU_ISSET(i, &cpuset))\n+\t\t\t\tcontinue;\n+\t\t\tif (i >= RTE_MAX_LCORE) {\n+\t\t\t\tDPAA2_BUS_ERR(\"ERR:lcore map to core %u (>= %u) not supported\",\n+\t\t\t\t\ti, RTE_MAX_LCORE);\n+\t\t\t\tret = -1;\n+\t\t\t\tcontinue;\n \t\t\t}\n+\t\t\tRTE_LOG(DEBUG, EAL, \"lcore id = %u cpu=%u\\n\",\n+\t\t\t\tlcore_id, i);\n+\t\t\tif (dpaa2_cpu[lcore_id] != 0xffffffff) {\n+\t\t\t\tDPAA2_BUS_ERR(\"ERR:lcore map to multi-cpu not supported\");\n+\t\t\t\tret = -1;\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\tdpaa2_cpu[lcore_id] = i;\n \t\t}\n \t}\n \treturn ret;\ndiff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c\nindex 68f7d1cd73..5920233bcd 100644\n--- a/lib/librte_eal/common/eal_common_options.c\n+++ b/lib/librte_eal/common/eal_common_options.c\n@@ -658,14 +658,14 @@ eal_parse_master_lcore(const char *arg)\n  *                       ',' used for a single number.\n  */\n static int\n-eal_parse_set(const char *input, uint16_t set[], unsigned num)\n+eal_parse_set(const char *input, rte_cpuset_t *set)\n {\n \tunsigned idx;\n \tconst char *str = input;\n \tchar *end = NULL;\n \tunsigned min, max;\n \n-\tmemset(set, 0, num * sizeof(uint16_t));\n+\tCPU_ZERO(set);\n \n \twhile (isblank(*str))\n \t\tstr++;\n@@ -678,7 +678,7 @@ eal_parse_set(const char *input, uint16_t set[], unsigned num)\n \tif (*str != '(') {\n \t\terrno = 0;\n \t\tidx = strtoul(str, &end, 10);\n-\t\tif (errno || end == NULL || idx >= num)\n+\t\tif (errno || end == NULL || idx >= CPU_SETSIZE)\n \t\t\treturn -1;\n \t\telse {\n \t\t\twhile (isblank(*end))\n@@ -696,7 +696,7 @@ eal_parse_set(const char *input, uint16_t set[], unsigned num)\n \n \t\t\t\terrno = 0;\n \t\t\t\tidx = strtoul(end, &end, 10);\n-\t\t\t\tif (errno || end == NULL || idx >= num)\n+\t\t\t\tif (errno || end == NULL || idx >= CPU_SETSIZE)\n \t\t\t\t\treturn -1;\n \t\t\t\tmax = idx;\n \t\t\t\twhile (isblank(*end))\n@@ -711,7 +711,7 @@ eal_parse_set(const char *input, uint16_t set[], unsigned num)\n \n \t\t\tfor (idx = RTE_MIN(min, max);\n \t\t\t     idx <= RTE_MAX(min, max); idx++)\n-\t\t\t\tset[idx] = 1;\n+\t\t\t\tCPU_SET(idx, set);\n \n \t\t\treturn end - input;\n \t\t}\n@@ -736,7 +736,7 @@ eal_parse_set(const char *input, uint16_t set[], unsigned num)\n \t\t/* get the digit value */\n \t\terrno = 0;\n \t\tidx = strtoul(str, &end, 10);\n-\t\tif (errno || end == NULL || idx >= num)\n+\t\tif (errno || end == NULL || idx >= CPU_SETSIZE)\n \t\t\treturn -1;\n \n \t\t/* go ahead to separator '-',',' and ')' */\n@@ -753,7 +753,7 @@ eal_parse_set(const char *input, uint16_t set[], unsigned num)\n \t\t\t\tmin = idx;\n \t\t\tfor (idx = RTE_MIN(min, max);\n \t\t\t     idx <= RTE_MAX(min, max); idx++)\n-\t\t\t\tset[idx] = 1;\n+\t\t\t\tCPU_SET(idx, set);\n \n \t\t\tmin = RTE_MAX_LCORE;\n \t\t} else\n@@ -772,17 +772,13 @@ eal_parse_set(const char *input, uint16_t set[], unsigned num)\n \treturn str - input;\n }\n \n-/* convert from set array to cpuset bitmap */\n static int\n-convert_to_cpuset(rte_cpuset_t *cpusetp,\n-\t      uint16_t *set, unsigned num)\n+check_cpuset(rte_cpuset_t *set)\n {\n-\tunsigned idx;\n-\n-\tCPU_ZERO(cpusetp);\n+\tunsigned int idx;\n \n-\tfor (idx = 0; idx < num; idx++) {\n-\t\tif (!set[idx])\n+\tfor (idx = 0; idx < CPU_SETSIZE; idx++) {\n+\t\tif (!CPU_ISSET(idx, set))\n \t\t\tcontinue;\n \n \t\tif (eal_cpu_detected(idx) == 0) {\n@@ -790,10 +786,7 @@ convert_to_cpuset(rte_cpuset_t *cpusetp,\n \t\t\t\t\"unavailable\\n\", idx);\n \t\t\treturn -1;\n \t\t}\n-\n-\t\tCPU_SET(idx, cpusetp);\n \t}\n-\n \treturn 0;\n }\n \n@@ -815,7 +808,8 @@ static int\n eal_parse_lcores(const char *lcores)\n {\n \tstruct rte_config *cfg = rte_eal_get_configuration();\n-\tstatic uint16_t set[RTE_MAX_LCORE];\n+\trte_cpuset_t lcore_set;\n+\tunsigned int set_count;\n \tunsigned idx = 0;\n \tunsigned count = 0;\n \tconst char *lcore_start = NULL;\n@@ -864,18 +858,13 @@ eal_parse_lcores(const char *lcores)\n \t\tlcores += strcspn(lcores, \"@,\");\n \n \t\tif (*lcores == '@') {\n-\t\t\t/* explicit assign cpu_set */\n-\t\t\toffset = eal_parse_set(lcores + 1, set, RTE_DIM(set));\n+\t\t\t/* explicit assign cpuset and update the end cursor */\n+\t\t\toffset = eal_parse_set(lcores + 1, &cpuset);\n \t\t\tif (offset < 0)\n \t\t\t\tgoto err;\n-\n-\t\t\t/* prepare cpu_set and update the end cursor */\n-\t\t\tif (0 > convert_to_cpuset(&cpuset,\n-\t\t\t\t\t\t  set, RTE_DIM(set)))\n-\t\t\t\tgoto err;\n \t\t\tend = lcores + 1 + offset;\n \t\t} else { /* ',' or '\\0' */\n-\t\t\t/* haven't given cpu_set, current loop done */\n+\t\t\t/* haven't given cpuset, current loop done */\n \t\t\tend = lcores;\n \n \t\t\t/* go back to check <number>-<number> */\n@@ -889,18 +878,19 @@ eal_parse_lcores(const char *lcores)\n \t\t\tgoto err;\n \n \t\t/* parse lcore_set from start point */\n-\t\tif (0 > eal_parse_set(lcore_start, set, RTE_DIM(set)))\n+\t\tif (eal_parse_set(lcore_start, &lcore_set) < 0)\n \t\t\tgoto err;\n \n-\t\t/* without '@', by default using lcore_set as cpu_set */\n-\t\tif (*lcores != '@' &&\n-\t\t    0 > convert_to_cpuset(&cpuset, set, RTE_DIM(set)))\n-\t\t\tgoto err;\n+\t\t/* without '@', by default using lcore_set as cpuset */\n+\t\tif (*lcores != '@')\n+\t\t\trte_memcpy(&cpuset, &lcore_set, sizeof(cpuset));\n \n+\t\tset_count = CPU_COUNT(&lcore_set);\n \t\t/* start to update lcore_set */\n \t\tfor (idx = 0; idx < RTE_MAX_LCORE; idx++) {\n-\t\t\tif (!set[idx])\n+\t\t\tif (!CPU_ISSET(idx, &lcore_set))\n \t\t\t\tcontinue;\n+\t\t\tset_count--;\n \n \t\t\tif (cfg->lcore_role[idx] != ROLE_RTE) {\n \t\t\t\tlcore_config[idx].core_index = count;\n@@ -912,10 +902,17 @@ eal_parse_lcores(const char *lcores)\n \t\t\t\tCPU_ZERO(&cpuset);\n \t\t\t\tCPU_SET(idx, &cpuset);\n \t\t\t}\n+\n+\t\t\tif (check_cpuset(&cpuset) < 0)\n+\t\t\t\tgoto err;\n \t\t\trte_memcpy(&lcore_config[idx].cpuset, &cpuset,\n \t\t\t\t   sizeof(rte_cpuset_t));\n \t\t}\n \n+\t\t/* some cores from the lcore_set can't be handled by EAL */\n+\t\tif (set_count != 0)\n+\t\t\tgoto err;\n+\n \t\tlcores = end + 1;\n \t} while (*end != '\\0');\n \ndiff --git a/lib/librte_eal/common/eal_common_thread.c b/lib/librte_eal/common/eal_common_thread.c\nindex f9a8cf14d2..78581753c0 100644\n--- a/lib/librte_eal/common/eal_common_thread.c\n+++ b/lib/librte_eal/common/eal_common_thread.c\n@@ -61,7 +61,7 @@ eal_cpuset_socket_id(rte_cpuset_t *cpusetp)\n \t\t\tbreak;\n \t\t}\n \n-\t} while (++cpu < RTE_MAX_LCORE);\n+\t} while (++cpu < CPU_SETSIZE);\n \n \treturn socket_id;\n }\n@@ -118,7 +118,7 @@ eal_thread_dump_affinity(char *str, unsigned size)\n \n \trte_thread_get_affinity(&cpuset);\n \n-\tfor (cpu = 0; cpu < RTE_MAX_LCORE; cpu++) {\n+\tfor (cpu = 0; cpu < CPU_SETSIZE; cpu++) {\n \t\tif (!CPU_ISSET(cpu, &cpuset))\n \t\t\tcontinue;\n \n",
    "prefixes": [
        "4/4"
    ]
}