Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/70683/?format=api
http://patchwork.dpdk.org/api/patches/70683/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/ceb97619dcaa91188757e6cf330870a6dfe97de6.1590656906.git.anatoly.burakov@intel.com/", "project": { "id": 1, "url": "http://patchwork.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": "<ceb97619dcaa91188757e6cf330870a6dfe97de6.1590656906.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/ceb97619dcaa91188757e6cf330870a6dfe97de6.1590656906.git.anatoly.burakov@intel.com", "date": "2020-05-28T09:13:51", "name": "[3/3] l3fwd-power: add interrupt-only mode", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "86777f3a5a1278186c9d41c0c0d5ac4ea6240bcc", "submitter": { "id": 4, "url": "http://patchwork.dpdk.org/api/people/4/?format=api", "name": "Anatoly Burakov", "email": "anatoly.burakov@intel.com" }, "delegate": null, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/ceb97619dcaa91188757e6cf330870a6dfe97de6.1590656906.git.anatoly.burakov@intel.com/mbox/", "series": [ { "id": 10267, "url": "http://patchwork.dpdk.org/api/series/10267/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=10267", "date": "2020-05-28T09:13:48", "name": "Add interrupt-only mode to l3fwd-power", "version": 1, "mbox": "http://patchwork.dpdk.org/series/10267/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/70683/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/70683/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 71D28A00BE;\n\tThu, 28 May 2020 11:14:12 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 21E071DB6D;\n\tThu, 28 May 2020 11:13:55 +0200 (CEST)", "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n by dpdk.org (Postfix) with ESMTP id 6BD3D1D9C8\n for <dev@dpdk.org>; Thu, 28 May 2020 11:13:50 +0200 (CEST)", "from orsmga002.jf.intel.com ([10.7.209.21])\n by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 28 May 2020 02:13:49 -0700", "from silpixa00399498.ir.intel.com (HELO\n silpixa00399498.ger.corp.intel.com) ([10.237.222.52])\n by orsmga002.jf.intel.com with ESMTP; 28 May 2020 02:13:48 -0700" ], "IronPort-SDR": [ "\n pTnQCRkHlgK72LQ2StudDpuvSozZO7P/mfKP3eLGMsMG8gPwNrch/qiLxhYoqkGvWLy3qNpqIi\n ThBxoD7tHu4g==", "\n sMUiEnl96vEmN0k3aMFYyUF0ibO4zHnSWDT0K/KDalSemt62lFNXr+r4yjEXxogHeB4JoqaCLE\n fS/9Oa8QI/UQ==" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.73,444,1583222400\"; d=\"scan'208\";a=\"285106521\"", "From": "Anatoly Burakov <anatoly.burakov@intel.com>", "To": "dev@dpdk.org", "Cc": "David Hunt <david.hunt@intel.com>, liang.j.ma@intel.com,\n reshma.pattan@intel.com", "Date": "Thu, 28 May 2020 10:13:51 +0100", "Message-Id": "\n <ceb97619dcaa91188757e6cf330870a6dfe97de6.1590656906.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": [ "<cover.1590656906.git.anatoly.burakov@intel.com>", "<cover.1590656906.git.anatoly.burakov@intel.com>" ], "References": [ "<cover.1590656906.git.anatoly.burakov@intel.com>", "<cover.1590656906.git.anatoly.burakov@intel.com>" ], "Subject": "[dpdk-dev] [PATCH 3/3] l3fwd-power: add interrupt-only mode", "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": "In addition to existing modes, add a mode which is very similar to\nlegacy mode, but does not do frequency scaling, and thus does not\ndepend on the power library.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n examples/l3fwd-power/main.c | 215 +++++++++++++++++++++++++++++++++---\n 1 file changed, 202 insertions(+), 13 deletions(-)", "diff": "diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c\nindex 5cee9d5387..4161e01974 100644\n--- a/examples/l3fwd-power/main.c\n+++ b/examples/l3fwd-power/main.c\n@@ -195,9 +195,11 @@ static int parse_ptype; /**< Parse packet type using rx callback, and */\n \t\t\t/**< disabled by default */\n \n enum appmode {\n-\tAPP_MODE_LEGACY = 0,\n+\tAPP_MODE_DEFAULT = 0,\n+\tAPP_MODE_LEGACY,\n \tAPP_MODE_EMPTY_POLL,\n-\tAPP_MODE_TELEMETRY\n+\tAPP_MODE_TELEMETRY,\n+\tAPP_MODE_INTERRUPT\n };\n \n enum appmode app_mode;\n@@ -900,6 +902,170 @@ static int event_register(struct lcore_conf *qconf)\n \n \treturn 0;\n }\n+\n+/* main processing loop */\n+static int main_intr_loop(__rte_unused void *dummy)\n+{\n+\tstruct rte_mbuf *pkts_burst[MAX_PKT_BURST];\n+\tunsigned int lcore_id;\n+\tuint64_t prev_tsc, diff_tsc, cur_tsc;\n+\tint i, j, nb_rx;\n+\tuint8_t queueid;\n+\tuint16_t portid;\n+\tstruct lcore_conf *qconf;\n+\tstruct lcore_rx_queue *rx_queue;\n+\tuint32_t lcore_rx_idle_count = 0;\n+\tuint32_t lcore_idle_hint = 0;\n+\tint intr_en = 0;\n+\n+\tconst uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) /\n+\t\t\t\t US_PER_S * BURST_TX_DRAIN_US;\n+\n+\tprev_tsc = 0;\n+\n+\tlcore_id = rte_lcore_id();\n+\tqconf = &lcore_conf[lcore_id];\n+\n+\tif (qconf->n_rx_queue == 0) {\n+\t\tRTE_LOG(INFO, L3FWD_POWER, \"lcore %u has nothing to do\\n\",\n+\t\t\t\tlcore_id);\n+\t\treturn 0;\n+\t}\n+\n+\tRTE_LOG(INFO, L3FWD_POWER, \"entering main interrupt loop on lcore %u\\n\",\n+\t\t\tlcore_id);\n+\n+\tfor (i = 0; i < qconf->n_rx_queue; i++) {\n+\t\tportid = qconf->rx_queue_list[i].port_id;\n+\t\tqueueid = qconf->rx_queue_list[i].queue_id;\n+\t\tRTE_LOG(INFO, L3FWD_POWER,\n+\t\t\t\t\" -- lcoreid=%u portid=%u rxqueueid=%hhu\\n\",\n+\t\t\t\tlcore_id, portid, queueid);\n+\t}\n+\n+\t/* add into event wait list */\n+\tif (event_register(qconf) == 0)\n+\t\tintr_en = 1;\n+\telse\n+\t\tRTE_LOG(INFO, L3FWD_POWER, \"RX interrupt won't enable.\\n\");\n+\n+\twhile (!is_done()) {\n+\t\tstats[lcore_id].nb_iteration_looped++;\n+\n+\t\tcur_tsc = rte_rdtsc();\n+\n+\t\t/*\n+\t\t * TX burst queue drain\n+\t\t */\n+\t\tdiff_tsc = cur_tsc - prev_tsc;\n+\t\tif (unlikely(diff_tsc > drain_tsc)) {\n+\t\t\tfor (i = 0; i < qconf->n_tx_port; ++i) {\n+\t\t\t\tportid = qconf->tx_port_id[i];\n+\t\t\t\trte_eth_tx_buffer_flush(portid,\n+\t\t\t\t\t\tqconf->tx_queue_id[portid],\n+\t\t\t\t\t\tqconf->tx_buffer[portid]);\n+\t\t\t}\n+\t\t\tprev_tsc = cur_tsc;\n+\t\t}\n+\n+start_rx:\n+\t\t/*\n+\t\t * Read packet from RX queues\n+\t\t */\n+\t\tlcore_rx_idle_count = 0;\n+\t\tfor (i = 0; i < qconf->n_rx_queue; ++i) {\n+\t\t\trx_queue = &(qconf->rx_queue_list[i]);\n+\t\t\trx_queue->idle_hint = 0;\n+\t\t\tportid = rx_queue->port_id;\n+\t\t\tqueueid = rx_queue->queue_id;\n+\n+\t\t\tnb_rx = rte_eth_rx_burst(portid, queueid, pkts_burst,\n+\t\t\t\t\tMAX_PKT_BURST);\n+\n+\t\t\tstats[lcore_id].nb_rx_processed += nb_rx;\n+\t\t\tif (unlikely(nb_rx == 0)) {\n+\t\t\t\t/**\n+\t\t\t\t * no packet received from rx queue, try to\n+\t\t\t\t * sleep for a while forcing CPU enter deeper\n+\t\t\t\t * C states.\n+\t\t\t\t */\n+\t\t\t\trx_queue->zero_rx_packet_count++;\n+\n+\t\t\t\tif (rx_queue->zero_rx_packet_count <=\n+\t\t\t\t\t\tMIN_ZERO_POLL_COUNT)\n+\t\t\t\t\tcontinue;\n+\n+\t\t\t\trx_queue->idle_hint = power_idle_heuristic(\n+\t\t\t\t\t\trx_queue->zero_rx_packet_count);\n+\t\t\t\tlcore_rx_idle_count++;\n+\t\t\t} else {\n+\t\t\t\trx_queue->zero_rx_packet_count = 0;\n+\t\t\t}\n+\n+\t\t\t/* Prefetch first packets */\n+\t\t\tfor (j = 0; j < PREFETCH_OFFSET && j < nb_rx; j++) {\n+\t\t\t\trte_prefetch0(rte_pktmbuf_mtod(\n+\t\t\t\t\t\tpkts_burst[j], void *));\n+\t\t\t}\n+\n+\t\t\t/* Prefetch and forward already prefetched packets */\n+\t\t\tfor (j = 0; j < (nb_rx - PREFETCH_OFFSET); j++) {\n+\t\t\t\trte_prefetch0(rte_pktmbuf_mtod(\n+\t\t\t\t\t\tpkts_burst[j + PREFETCH_OFFSET],\n+\t\t\t\t\t\tvoid *));\n+\t\t\t\tl3fwd_simple_forward(\n+\t\t\t\t\t\tpkts_burst[j], portid, qconf);\n+\t\t\t}\n+\n+\t\t\t/* Forward remaining prefetched packets */\n+\t\t\tfor (; j < nb_rx; j++) {\n+\t\t\t\tl3fwd_simple_forward(\n+\t\t\t\t\t\tpkts_burst[j], portid, qconf);\n+\t\t\t}\n+\t\t}\n+\n+\t\tif (unlikely(lcore_rx_idle_count == qconf->n_rx_queue)) {\n+\t\t\t/**\n+\t\t\t * All Rx queues empty in recent consecutive polls,\n+\t\t\t * sleep in a conservative manner, meaning sleep as\n+\t\t\t * less as possible.\n+\t\t\t */\n+\t\t\tfor (i = 1,\n+\t\t\t lcore_idle_hint = qconf->rx_queue_list[0].idle_hint;\n+\t\t\t\t\ti < qconf->n_rx_queue; ++i) {\n+\t\t\t\trx_queue = &(qconf->rx_queue_list[i]);\n+\t\t\t\tif (rx_queue->idle_hint < lcore_idle_hint)\n+\t\t\t\t\tlcore_idle_hint = rx_queue->idle_hint;\n+\t\t\t}\n+\n+\t\t\tif (lcore_idle_hint < SUSPEND_THRESHOLD)\n+\t\t\t\t/**\n+\t\t\t\t * execute \"pause\" instruction to avoid context\n+\t\t\t\t * switch which generally take hundred of\n+\t\t\t\t * microseconds for short sleep.\n+\t\t\t\t */\n+\t\t\t\trte_delay_us(lcore_idle_hint);\n+\t\t\telse {\n+\t\t\t\t/* suspend until rx interrupt triggers */\n+\t\t\t\tif (intr_en) {\n+\t\t\t\t\tturn_on_off_intr(qconf, 1);\n+\t\t\t\t\tsleep_until_rx_interrupt(\n+\t\t\t\t\t\t\tqconf->n_rx_queue);\n+\t\t\t\t\tturn_on_off_intr(qconf, 0);\n+\t\t\t\t\t/**\n+\t\t\t\t\t * start receiving packets immediately\n+\t\t\t\t\t */\n+\t\t\t\t\tif (likely(!is_done()))\n+\t\t\t\t\t\tgoto start_rx;\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tstats[lcore_id].sleep_time += lcore_idle_hint;\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n /* main processing loop */\n static int\n main_telemetry_loop(__rte_unused void *dummy)\n@@ -1126,7 +1292,7 @@ main_empty_poll_loop(__rte_unused void *dummy)\n }\n /* main processing loop */\n static int\n-main_loop(__rte_unused void *dummy)\n+main_legacy_loop(__rte_unused void *dummy)\n {\n \tstruct rte_mbuf *pkts_burst[MAX_PKT_BURST];\n \tunsigned lcore_id;\n@@ -1438,7 +1604,8 @@ print_usage(const char *prgname)\n \t\t\" --empty-poll: enable empty poll detection\"\n \t\t\" follow (training_flag, high_threshold, med_threshold)\\n\"\n \t\t\" --telemetry: enable telemetry mode, to update\"\n-\t\t\" empty polls, full polls, and core busyness to telemetry\\n\",\n+\t\t\" empty polls, full polls, and core busyness to telemetry\\n\"\n+\t\t\" --interrupt-only: enable interrupt-only mode\\n\",\n \t\tprgname);\n }\n \n@@ -1582,6 +1749,7 @@ parse_ep_config(const char *q_arg)\n }\n #define CMD_LINE_OPT_PARSE_PTYPE \"parse-ptype\"\n #define CMD_LINE_OPT_TELEMETRY \"telemetry\"\n+#define CMD_LINE_OPT_INTERRUPT_ONLY \"interrupt-only\"\n \n /* Parse the argument given in the command line of the application */\n static int\n@@ -1601,6 +1769,7 @@ parse_args(int argc, char **argv)\n \t\t{\"empty-poll\", 1, 0, 0},\n \t\t{CMD_LINE_OPT_PARSE_PTYPE, 0, 0, 0},\n \t\t{CMD_LINE_OPT_TELEMETRY, 0, 0, 0},\n+\t\t{CMD_LINE_OPT_INTERRUPT_ONLY, 0, 0, 0},\n \t\t{NULL, 0, 0, 0}\n \t};\n \n@@ -1674,8 +1843,8 @@ parse_args(int argc, char **argv)\n \n \t\t\tif (!strncmp(lgopts[option_index].name,\n \t\t\t\t\t\t\"empty-poll\", 10)) {\n-\t\t\t\tif (app_mode == APP_MODE_TELEMETRY) {\n-\t\t\t\t\tprintf(\" empty-poll cannot be enabled as telemetry mode is enabled\\n\");\n+\t\t\t\tif (app_mode != APP_MODE_DEFAULT) {\n+\t\t\t\t\tprintf(\" empty-poll mode is mutually exclusive with other modes\\n\");\n \t\t\t\t\treturn -1;\n \t\t\t\t}\n \t\t\t\tapp_mode = APP_MODE_EMPTY_POLL;\n@@ -1692,14 +1861,25 @@ parse_args(int argc, char **argv)\n \t\t\tif (!strncmp(lgopts[option_index].name,\n \t\t\t\t\tCMD_LINE_OPT_TELEMETRY,\n \t\t\t\t\tsizeof(CMD_LINE_OPT_TELEMETRY))) {\n-\t\t\t\tif (app_mode == APP_MODE_EMPTY_POLL) {\n-\t\t\t\t\tprintf(\"telemetry mode cannot be enabled as empty poll mode is enabled\\n\");\n+\t\t\t\tif (app_mode != APP_MODE_DEFAULT) {\n+\t\t\t\t\tprintf(\" telemetry mode is mutually exclusive with other modes\\n\");\n \t\t\t\t\treturn -1;\n \t\t\t\t}\n \t\t\t\tapp_mode = APP_MODE_TELEMETRY;\n \t\t\t\tprintf(\"telemetry mode is enabled\\n\");\n \t\t\t}\n \n+\t\t\tif (!strncmp(lgopts[option_index].name,\n+\t\t\t\t\tCMD_LINE_OPT_INTERRUPT_ONLY,\n+\t\t\t\t\tsizeof(CMD_LINE_OPT_INTERRUPT_ONLY))) {\n+\t\t\t\tif (app_mode != APP_MODE_DEFAULT) {\n+\t\t\t\t\tprintf(\" interrupt-only mode is mutually exclusive with other modes\\n\");\n+\t\t\t\t\treturn -1;\n+\t\t\t\t}\n+\t\t\t\tapp_mode = APP_MODE_INTERRUPT;\n+\t\t\t\tprintf(\"interrupt-only mode is enabled\\n\");\n+\t\t\t}\n+\n \t\t\tif (!strncmp(lgopts[option_index].name,\n \t\t\t\t\t\"enable-jumbo\", 12)) {\n \t\t\t\tstruct option lenopts =\n@@ -2253,7 +2433,12 @@ main(int argc, char **argv)\n \tif (ret < 0)\n \t\trte_exit(EXIT_FAILURE, \"Invalid L3FWD parameters\\n\");\n \n-\tif (app_mode != APP_MODE_TELEMETRY && init_power_library())\n+\tif (app_mode == APP_MODE_DEFAULT)\n+\t\tapp_mode = APP_MODE_LEGACY;\n+\n+\t/* only legacy and empty poll mode rely on power library */\n+\tif ((app_mode == APP_MODE_LEGACY || app_mode == APP_MODE_EMPTY_POLL) &&\n+\t\t\tinit_power_library())\n \t\trte_exit(EXIT_FAILURE, \"init_power_library failed\\n\");\n \n \tif (update_lcore_params() < 0)\n@@ -2277,7 +2462,8 @@ main(int argc, char **argv)\n \tRTE_ETH_FOREACH_DEV(portid) {\n \t\tstruct rte_eth_conf local_port_conf = port_conf;\n \t\t/* not all app modes need interrupts */\n-\t\tbool need_intr = app_mode == APP_MODE_LEGACY;\n+\t\tbool need_intr = app_mode == APP_MODE_LEGACY ||\n+\t\t\t\tapp_mode == APP_MODE_INTERRUPT;\n \n \t\t/* skip ports that are not enabled */\n \t\tif ((enabled_port_mask & (1 << portid)) == 0) {\n@@ -2526,12 +2712,12 @@ main(int argc, char **argv)\n \n \t/* launch per-lcore init on every lcore */\n \tif (app_mode == APP_MODE_LEGACY) {\n-\t\trte_eal_mp_remote_launch(main_loop, NULL, CALL_MASTER);\n+\t\trte_eal_mp_remote_launch(main_legacy_loop, NULL, CALL_MASTER);\n \t} else if (app_mode == APP_MODE_EMPTY_POLL) {\n \t\tempty_poll_stop = false;\n \t\trte_eal_mp_remote_launch(main_empty_poll_loop, NULL,\n \t\t\t\tSKIP_MASTER);\n-\t} else {\n+\t} else if (app_mode == APP_MODE_TELEMETRY) {\n \t\tunsigned int i;\n \n \t\t/* Init metrics library */\n@@ -2555,6 +2741,8 @@ main(int argc, char **argv)\n \t\t\t\t\"Returns global power stats. Parameters: None\");\n \t\trte_eal_mp_remote_launch(main_telemetry_loop, NULL,\n \t\t\t\t\t\tSKIP_MASTER);\n+\t} else if (app_mode == APP_MODE_INTERRUPT) {\n+\t\trte_eal_mp_remote_launch(main_intr_loop, NULL, CALL_MASTER);\n \t}\n \n \tif (app_mode == APP_MODE_EMPTY_POLL || app_mode == APP_MODE_TELEMETRY)\n@@ -2577,7 +2765,8 @@ main(int argc, char **argv)\n \tif (app_mode == APP_MODE_EMPTY_POLL)\n \t\trte_power_empty_poll_stat_free();\n \n-\tif (app_mode != APP_MODE_TELEMETRY && deinit_power_library())\n+\tif ((app_mode == APP_MODE_LEGACY || app_mode == APP_MODE_EMPTY_POLL) &&\n+\t\t\tdeinit_power_library())\n \t\trte_exit(EXIT_FAILURE, \"deinit_power_library failed\\n\");\n \n \tif (rte_eal_cleanup() < 0)\n", "prefixes": [ "3/3" ] }{ "id": 70683, "url": "