[{"id":1760387,"web_url":"http://patchwork.ozlabs.org/comment/1760387/","msgid":"<DFE132D2-EEF5-4E49-AA1D-C44FA40A8EF3@vmware.com>","list_archive_url":null,"date":"2017-08-30T18:01:59","subject":"Re: [ovs-dev] [PATCH 3/3] dpif-netdev: Calculate rxq cycles prior\n\tto rxq_cycle_sort calls.","submitter":{"id":68212,"url":"http://patchwork.ozlabs.org/api/people/68212/","name":"Darrell Ball","email":"dball@vmware.com"},"content":"Thanks for the patch Kevin\r\n\r\nOn 8/30/17, 10:45 AM, \"Kevin Traynor\" <ktraynor@redhat.com> wrote:\r\n\r\n    rxq_cycle_sort summed the latest cycles from each queue for sorting.\r\n    While each comparison was correct with the latest cycles, the cycles\r\n    could change between calls to rxq_cycle_sort. In order to use\r\n    consistent values through each call to rxq_cycle_sort, sum the cycles\r\n    prior to rxq_cycle_sort being called.\r\n\r\nAs discussed, these changes are optional and have some tradeoffs, but\r\noverall, I don’t see any major issue introduced here, since this is understood to be a\r\nrough comparison anyways.\r\n    \r\n    Also, change return to 0 when values are equal.\r\n\r\nAs discussed, this means the equal tie-breaker is done by qsort instead of\r\nthe compare function; the net practical effect of this is nil, but this is more\r\nstandard.\r\n\r\n    Reported-by: Ilya Maximets <i.maximets@samsung.com>\r\n    Signed-off-by: Kevin Traynor <ktraynor@redhat.com>\r\n    ---\r\n     lib/dpif-netdev.c | 22 +++++++++++++---------\r\n     1 file changed, 13 insertions(+), 9 deletions(-)\r\n    \r\n    diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c\r\n    index 1db9f10..7c21ee5 100644\r\n    --- a/lib/dpif-netdev.c\r\n    +++ b/lib/dpif-netdev.c\r\n    @@ -3432,18 +3432,14 @@ rxq_cycle_sort(const void *a, const void *b)\r\n         struct dp_netdev_rxq *qb;\r\n         uint64_t total_qa, total_qb;\r\n    -    unsigned i;\r\n     \r\n         qa = *(struct dp_netdev_rxq **) a;\r\n         qb = *(struct dp_netdev_rxq **) b;\r\n     \r\n    -    total_qa = total_qb = 0;\r\n    -    for (i = 0; i < PMD_RXQ_INTERVAL_MAX; i++) {\r\n    -        total_qa += dp_netdev_rxq_get_intrvl_cycles(qa, i);\r\n    -        total_qb += dp_netdev_rxq_get_intrvl_cycles(qb, i);\r\n    -    }\r\n    -    dp_netdev_rxq_set_cycles(qa, RXQ_CYCLES_PROC_HIST, total_qa);\r\n    -    dp_netdev_rxq_set_cycles(qb, RXQ_CYCLES_PROC_HIST, total_qb);\r\n    +    total_qa = dp_netdev_rxq_get_cycles(qa, RXQ_CYCLES_PROC_HIST);\r\n    +    total_qb = dp_netdev_rxq_get_cycles(qb, RXQ_CYCLES_PROC_HIST);\r\n     \r\n    -    if (total_qa >= total_qb) {\r\n    +    if (total_qa == total_qb) {\r\n    +        return 0;\r\n    +    } else if (total_qa > total_qb) {\r\n             return -1;\r\n         }\r\n    @@ -3493,4 +3489,6 @@ rxq_scheduling(struct dp_netdev *dp, bool pinned) OVS_REQUIRES(dp->port_mutex)\r\n                     }\r\n                 } else if (!pinned && q->core_id == OVS_CORE_UNSPEC) {\r\n    +                uint64_t cycle_hist = 0;\r\n    +\r\n                     if (n_rxqs == 0) {\r\n                         rxqs = xmalloc(sizeof *rxqs);\r\n    @@ -3498,4 +3496,10 @@ rxq_scheduling(struct dp_netdev *dp, bool pinned) OVS_REQUIRES(dp->port_mutex)\r\n                         rxqs = xrealloc(rxqs, sizeof *rxqs * (n_rxqs + 1));\r\n                     }\r\n    +\r\n    +                for (unsigned i = 0; i < PMD_RXQ_INTERVAL_MAX; i++) {\r\n    +                    cycle_hist += dp_netdev_rxq_get_intrvl_cycles(q, i);\r\n    +                }\r\n    +                dp_netdev_rxq_set_cycles(q, RXQ_CYCLES_PROC_HIST, cycle_hist);\r\n    +\r\n                     /* Store the queue. */\r\n                     rxqs[n_rxqs++] = q;\r\n    -- \r\n    1.8.3.1","headers":{"Return-Path":"<ovs-dev-bounces@openvswitch.org>","X-Original-To":["incoming@patchwork.ozlabs.org","dev@openvswitch.org"],"Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","ovs-dev@mail.linuxfoundation.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=openvswitch.org\n\t(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;\n\tenvelope-from=ovs-dev-bounces@openvswitch.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=onevmw.onmicrosoft.com\n\theader.i=@onevmw.onmicrosoft.com header.b=\"RFU8JlAg\"; \n\tdkim-atps=neutral","spf=none (sender IP is )\n\tsmtp.mailfrom=dball@vmware.com; "],"Received":["from mail.linuxfoundation.org (mail.linuxfoundation.org\n\t[140.211.169.12])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xjCy54Tlpz9sNc\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 04:02:05 +1000 (AEST)","from mail.linux-foundation.org (localhost [127.0.0.1])\n\tby mail.linuxfoundation.org (Postfix) with ESMTP id 9F760C78;\n\tWed, 30 Aug 2017 18:02:03 +0000 (UTC)","from smtp1.linuxfoundation.org (smtp1.linux-foundation.org\n\t[172.17.192.35])\n\tby mail.linuxfoundation.org (Postfix) with ESMTPS id 89EF3C48\n\tfor <dev@openvswitch.org>; Wed, 30 Aug 2017 18:02:02 +0000 (UTC)","from NAM03-DM3-obe.outbound.protection.outlook.com\n\t(mail-dm3nam03on0079.outbound.protection.outlook.com [104.47.41.79])\n\tby smtp1.linuxfoundation.org (Postfix) with ESMTPS id B3E8941D\n\tfor <dev@openvswitch.org>; Wed, 30 Aug 2017 18:02:01 +0000 (UTC)","from BLUPR05MB611.namprd05.prod.outlook.com (10.141.204.27) by\n\tBLUPR05MB610.namprd05.prod.outlook.com (10.141.204.13) with Microsoft\n\tSMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id\n\t15.20.35.3; Wed, 30 Aug 2017 18:01:59 +0000","from BLUPR05MB611.namprd05.prod.outlook.com ([10.141.204.27]) by\n\tBLUPR05MB611.namprd05.prod.outlook.com ([10.141.204.27]) with mapi id\n\t15.20.0013.011; Wed, 30 Aug 2017 18:01:59 +0000"],"X-Greylist":"whitelisted by SQLgrey-1.7.6","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=onevmw.onmicrosoft.com; s=selector1-vmware-com;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version;\n\tbh=K/vKv6XYMeqFncBif5Cb51sx+bRDTQ+6ce8ew0kHdTA=;\n\tb=RFU8JlAg99yv48qV5X1oLaNi4vIC6pWaWzbWMvvqBxT+GX2qlhfYuM0IgOt8EfgjlLZOfcn1jNhWyTtnq73Xrw3nF/1u1gcxWSZTr11gdZiel0JxLMEQC8QBDnjDtIP77eh8X74ZZVI7poKK/Ma3F4xsSHjDjbhEfx0UnkV/jBY=","From":"Darrell Ball <dball@vmware.com>","To":"Kevin Traynor <ktraynor@redhat.com>, \"dev@openvswitch.org\"\n\t<dev@openvswitch.org>, \"i.maximets@samsung.com\" <i.maximets@samsung.com>","Thread-Topic":"[PATCH 3/3] dpif-netdev: Calculate rxq cycles prior to\n\trxq_cycle_sort calls.","Thread-Index":"AQHTIbfaNOKvd6XNQ0GJgP8gL64g7qKcu1wA","Date":"Wed, 30 Aug 2017 18:01:59 +0000","Message-ID":"<DFE132D2-EEF5-4E49-AA1D-C44FA40A8EF3@vmware.com>","References":"<1504115149-26864-1-git-send-email-ktraynor@redhat.com>\n\t<1504115149-26864-3-git-send-email-ktraynor@redhat.com>","In-Reply-To":"<1504115149-26864-3-git-send-email-ktraynor@redhat.com>","Accept-Language":"en-US","Content-Language":"en-US","X-MS-Has-Attach":"","X-MS-TNEF-Correlator":"","user-agent":"Microsoft-MacOutlook/f.23.0.170610","authentication-results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=openvswitch.org\n\t(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;\n\tenvelope-from=ovs-dev-bounces@openvswitch.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=onevmw.onmicrosoft.com\n\theader.i=@onevmw.onmicrosoft.com header.b=\"RFU8JlAg\"; \n\tdkim-atps=neutral","spf=none (sender IP is )\n\tsmtp.mailfrom=dball@vmware.com; "],"x-originating-ip":"[73.162.236.45]","x-ms-publictraffictype":"Email","x-microsoft-exchange-diagnostics":"1; BLUPR05MB610;\n\t20:H+dErkL2o3HwGkoUwaxw/KlbJC+gA6tA4VyshEeVNJMV/9T1pT2cvxRBKI5tQKl/VbyOKbfJ41N4U+E4LB0rDQ97HZcl2BbtGE11203NsRlsNbNCqsWkAJJkBYi/FUpdYUml/UzAbWNMKcb96UXfze7LhL1O3cThVnetLY5xP+U=","x-ms-exchange-antispam-srfa-diagnostics":"SSOS;","x-ms-office365-filtering-correlation-id":"39a6e105-4539-409b-b10d-08d4efd135b9","x-microsoft-antispam":"UriScan:; BCL:0; PCL:0;\n\tRULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);\n\tSRVR:BLUPR05MB610; ","x-ms-traffictypediagnostic":"BLUPR05MB610:","x-exchange-antispam-report-test":"UriScan:(7411616537696);","x-microsoft-antispam-prvs":"<BLUPR05MB61040E9A9CA5750219D0E44C89C0@BLUPR05MB610.namprd05.prod.outlook.com>","x-exchange-antispam-report-cfa-test":"BCL:0; PCL:0;\n\tRULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(6041248)(20161123558100)(20161123560025)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);\n\tSRVR:BLUPR05MB610; BCL:0; PCL:0;\n\tRULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);\n\tSRVR:BLUPR05MB610; ","x-forefront-prvs":"041517DFAB","x-forefront-antispam-report":"SFV:NSPM;\n\tSFS:(10009020)(6009001)(51914003)(377454003)(24454002)(199003)(189002)(4001350100001)(97736004)(6116002)(83716003)(3846002)(2900100001)(102836003)(53936002)(33656002)(83506001)(66066001)(6512007)(7736002)(99286003)(305945005)(53546010)(2906002)(68736007)(8676002)(3280700002)(229853002)(77096006)(6486002)(478600001)(6436002)(2201001)(2950100002)(8936002)(50986999)(105586002)(189998001)(86362001)(81166006)(106356001)(81156014)(3660700001)(6506006)(36756003)(5660300001)(101416001)(14454004)(82746002)(54356999)(76176999)(6246003)(2501003)(25786009);\n\tDIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR05MB610;\n\tH:BLUPR05MB611.namprd05.prod.outlook.com; FPR:; SPF:None;\n\tPTR:InfoNoRecords; A:1; MX:1; LANG:en; ","received-spf":"None (protection.outlook.com: vmware.com does not designate\n\tpermitted sender hosts)","spamdiagnosticoutput":"1:99","spamdiagnosticmetadata":"NSPM","Content-ID":"<CABC091F63761A44972DA4076DCEF122@namprd05.prod.outlook.com>","MIME-Version":"1.0","X-OriginatorOrg":"vmware.com","X-MS-Exchange-CrossTenant-originalarrivaltime":"30 Aug 2017 18:01:59.2929\n\t(UTC)","X-MS-Exchange-CrossTenant-fromentityheader":"Hosted","X-MS-Exchange-CrossTenant-id":"b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0","X-MS-Exchange-Transport-CrossTenantHeadersStamped":"BLUPR05MB610","X-Spam-Status":"No, score=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,\n\tRCVD_IN_DNSWL_NONE autolearn=disabled version=3.3.1","X-Spam-Checker-Version":"SpamAssassin 3.3.1 (2010-03-16) on\n\tsmtp1.linux-foundation.org","Subject":"Re: [ovs-dev] [PATCH 3/3] dpif-netdev: Calculate rxq cycles prior\n\tto rxq_cycle_sort calls.","X-BeenThere":"ovs-dev@openvswitch.org","X-Mailman-Version":"2.1.12","Precedence":"list","List-Id":"<ovs-dev.openvswitch.org>","List-Unsubscribe":"<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>","List-Archive":"<http://mail.openvswitch.org/pipermail/ovs-dev/>","List-Post":"<mailto:ovs-dev@openvswitch.org>","List-Help":"<mailto:ovs-dev-request@openvswitch.org?subject=help>","List-Subscribe":"<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Sender":"ovs-dev-bounces@openvswitch.org","Errors-To":"ovs-dev-bounces@openvswitch.org"}},{"id":1773835,"web_url":"http://patchwork.ozlabs.org/comment/1773835/","msgid":"<64B4D824-A6A2-48D6-AE38-FF9BBD4DAB3C@vmware.com>","list_archive_url":null,"date":"2017-09-22T19:21:18","subject":"Re: [ovs-dev] [PATCH 3/3] dpif-netdev: Calculate rxq cycles prior\n\tto rxq_cycle_sort calls.","submitter":{"id":68212,"url":"http://patchwork.ozlabs.org/api/people/68212/","name":"Darrell Ball","email":"dball@vmware.com"},"content":"Are there any other comments for this patch?\r\n\r\n\r\nOn 8/30/17, 11:01 AM, \"Darrell Ball\" <dball@vmware.com> wrote:\r\n\r\n    Thanks for the patch Kevin\r\n    \r\n    On 8/30/17, 10:45 AM, \"Kevin Traynor\" <ktraynor@redhat.com> wrote:\r\n    \r\n        rxq_cycle_sort summed the latest cycles from each queue for sorting.\r\n        While each comparison was correct with the latest cycles, the cycles\r\n        could change between calls to rxq_cycle_sort. In order to use\r\n        consistent values through each call to rxq_cycle_sort, sum the cycles\r\n        prior to rxq_cycle_sort being called.\r\n    \r\n    As discussed, these changes are optional and have some tradeoffs, but\r\n    overall, I don’t see any major issue introduced here, since this is understood to be a\r\n    rough comparison anyways.\r\n        \r\n        Also, change return to 0 when values are equal.\r\n    \r\n    As discussed, this means the equal tie-breaker is done by qsort instead of\r\n    the compare function; the net practical effect of this is nil, but this is more\r\n    standard.\r\n    \r\n        Reported-by: Ilya Maximets <i.maximets@samsung.com>\r\n        Signed-off-by: Kevin Traynor <ktraynor@redhat.com>\r\n        ---\r\n         lib/dpif-netdev.c | 22 +++++++++++++---------\r\n         1 file changed, 13 insertions(+), 9 deletions(-)\r\n        \r\n        diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c\r\n        index 1db9f10..7c21ee5 100644\r\n        --- a/lib/dpif-netdev.c\r\n        +++ b/lib/dpif-netdev.c\r\n        @@ -3432,18 +3432,14 @@ rxq_cycle_sort(const void *a, const void *b)\r\n             struct dp_netdev_rxq *qb;\r\n             uint64_t total_qa, total_qb;\r\n        -    unsigned i;\r\n         \r\n             qa = *(struct dp_netdev_rxq **) a;\r\n             qb = *(struct dp_netdev_rxq **) b;\r\n         \r\n        -    total_qa = total_qb = 0;\r\n        -    for (i = 0; i < PMD_RXQ_INTERVAL_MAX; i++) {\r\n        -        total_qa += dp_netdev_rxq_get_intrvl_cycles(qa, i);\r\n        -        total_qb += dp_netdev_rxq_get_intrvl_cycles(qb, i);\r\n        -    }\r\n        -    dp_netdev_rxq_set_cycles(qa, RXQ_CYCLES_PROC_HIST, total_qa);\r\n        -    dp_netdev_rxq_set_cycles(qb, RXQ_CYCLES_PROC_HIST, total_qb);\r\n        +    total_qa = dp_netdev_rxq_get_cycles(qa, RXQ_CYCLES_PROC_HIST);\r\n        +    total_qb = dp_netdev_rxq_get_cycles(qb, RXQ_CYCLES_PROC_HIST);\r\n         \r\n        -    if (total_qa >= total_qb) {\r\n        +    if (total_qa == total_qb) {\r\n        +        return 0;\r\n        +    } else if (total_qa > total_qb) {\r\n                 return -1;\r\n             }\r\n        @@ -3493,4 +3489,6 @@ rxq_scheduling(struct dp_netdev *dp, bool pinned) OVS_REQUIRES(dp->port_mutex)\r\n                         }\r\n                     } else if (!pinned && q->core_id == OVS_CORE_UNSPEC) {\r\n        +                uint64_t cycle_hist = 0;\r\n        +\r\n                         if (n_rxqs == 0) {\r\n                             rxqs = xmalloc(sizeof *rxqs);\r\n        @@ -3498,4 +3496,10 @@ rxq_scheduling(struct dp_netdev *dp, bool pinned) OVS_REQUIRES(dp->port_mutex)\r\n                             rxqs = xrealloc(rxqs, sizeof *rxqs * (n_rxqs + 1));\r\n                         }\r\n        +\r\n        +                for (unsigned i = 0; i < PMD_RXQ_INTERVAL_MAX; i++) {\r\n        +                    cycle_hist += dp_netdev_rxq_get_intrvl_cycles(q, i);\r\n        +                }\r\n        +                dp_netdev_rxq_set_cycles(q, RXQ_CYCLES_PROC_HIST, cycle_hist);\r\n        +\r\n                         /* Store the queue. */\r\n                         rxqs[n_rxqs++] = q;\r\n        -- \r\n        1.8.3.1","headers":{"Return-Path":"<ovs-dev-bounces@openvswitch.org>","X-Original-To":["incoming@patchwork.ozlabs.org","dev@openvswitch.org"],"Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","ovs-dev@mail.linuxfoundation.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=openvswitch.org\n\t(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;\n\tenvelope-from=ovs-dev-bounces@openvswitch.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=onevmw.onmicrosoft.com\n\theader.i=@onevmw.onmicrosoft.com header.b=\"UbPfjSkz\"; \n\tdkim-atps=neutral","spf=none (sender IP is )\n\tsmtp.mailfrom=dball@vmware.com; "],"Received":["from mail.linuxfoundation.org (mail.linuxfoundation.org\n\t[140.211.169.12])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xzNd34YN6z9sxR\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 23 Sep 2017 05:21:26 +1000 (AEST)","from mail.linux-foundation.org (localhost [127.0.0.1])\n\tby mail.linuxfoundation.org (Postfix) with ESMTP id E71D8ACB;\n\tFri, 22 Sep 2017 19:21:22 +0000 (UTC)","from smtp1.linuxfoundation.org (smtp1.linux-foundation.org\n\t[172.17.192.35])\n\tby mail.linuxfoundation.org (Postfix) with ESMTPS id B111FA86\n\tfor <dev@openvswitch.org>; Fri, 22 Sep 2017 19:21:21 +0000 (UTC)","from NAM03-BY2-obe.outbound.protection.outlook.com\n\t(mail-by2nam03on0073.outbound.protection.outlook.com [104.47.42.73])\n\tby smtp1.linuxfoundation.org (Postfix) with ESMTPS id E7C3F44D\n\tfor <dev@openvswitch.org>; Fri, 22 Sep 2017 19:21:20 +0000 (UTC)","from MWHPR05MB3406.namprd05.prod.outlook.com (10.174.175.155) by\n\tMWHPR05MB3405.namprd05.prod.outlook.com (10.174.175.154) with\n\tMicrosoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id\n\t15.20.77.5; Fri, 22 Sep 2017 19:21:19 +0000","from MWHPR05MB3406.namprd05.prod.outlook.com ([10.174.175.155]) by\n\tMWHPR05MB3406.namprd05.prod.outlook.com ([10.174.175.155]) with\n\tmapi id 15.20.0077.007; Fri, 22 Sep 2017 19:21:19 +0000"],"X-Greylist":"whitelisted by SQLgrey-1.7.6","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=onevmw.onmicrosoft.com; s=selector1-vmware-com;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version;\n\tbh=hBflB9V/7K9ZkoZnvNqKCDoYScM+0kfqPpycs2lt9n8=;\n\tb=UbPfjSkz4DlKKYPIIOZtjoI9+6cm3SBogUFoRgUi3qluonBMQ5013iJv5vMESykOX2vVj1ZLCMIMJZkGHYbnvsmyUeMw9FON/tk9b0r0LxXfXgSRHSMnZkYc596yec+7Xfq7E67XxSHKZ/tH/4Nhl8XoEyAYsohAcXvVycD/MEk=","From":"Darrell Ball <dball@vmware.com>","To":"Kevin Traynor <ktraynor@redhat.com>, \"dev@openvswitch.org\"\n\t<dev@openvswitch.org>, \"i.maximets@samsung.com\" <i.maximets@samsung.com>","Thread-Topic":"[PATCH 3/3] dpif-netdev: Calculate rxq cycles prior to\n\trxq_cycle_sort calls.","Thread-Index":"AQHTIbfaNOKvd6XNQ0GJgP8gL64g7qKcu1wAgCSxIgA=","Date":"Fri, 22 Sep 2017 19:21:18 +0000","Message-ID":"<64B4D824-A6A2-48D6-AE38-FF9BBD4DAB3C@vmware.com>","References":"<1504115149-26864-1-git-send-email-ktraynor@redhat.com>\n\t<1504115149-26864-3-git-send-email-ktraynor@redhat.com>\n\t<DFE132D2-EEF5-4E49-AA1D-C44FA40A8EF3@vmware.com>","In-Reply-To":"<DFE132D2-EEF5-4E49-AA1D-C44FA40A8EF3@vmware.com>","Accept-Language":"en-US","Content-Language":"en-US","X-MS-Has-Attach":"","X-MS-TNEF-Correlator":"","user-agent":"Microsoft-MacOutlook/f.26.0.170902","authentication-results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=openvswitch.org\n\t(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;\n\tenvelope-from=ovs-dev-bounces@openvswitch.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=onevmw.onmicrosoft.com\n\theader.i=@onevmw.onmicrosoft.com header.b=\"UbPfjSkz\"; \n\tdkim-atps=neutral","spf=none (sender IP is )\n\tsmtp.mailfrom=dball@vmware.com; "],"x-originating-ip":"[73.162.236.45]","x-ms-publictraffictype":"Email","x-microsoft-exchange-diagnostics":"1; MWHPR05MB3405;\n\t20:25wVMzNZE4bnkCAoFlKtj6EdwbdDuyFN6dWfJfJfh5kx+WGaSzfqb/RcN1bBJGSVu46uaOvSn3dcMRS/F8JuiQ1jA1ABpMNkTjzTfABeD7o6LFGPQ4sZoAyFy2qwLmhqbry25Fu8eYV5CPIDUC5lVd9Sqe5TKR/tOq1wUdI+6pU=","x-ms-exchange-antispam-srfa-diagnostics":"SSOS;","x-ms-office365-filtering-correlation-id":"bd83f362-9fb3-46bc-6b8c-08d501ef1a40","x-microsoft-antispam":"UriScan:; BCL:0; PCL:0;\n\tRULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);\n\tSRVR:MWHPR05MB3405; ","x-ms-traffictypediagnostic":"MWHPR05MB3405:","x-exchange-antispam-report-test":"UriScan:(61668805478150)(7411616537696);","x-microsoft-antispam-prvs":"<MWHPR05MB3405E82E044150DE294E8D8AC8670@MWHPR05MB3405.namprd05.prod.outlook.com>","x-exchange-antispam-report-cfa-test":"BCL:0; PCL:0;\n\tRULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(3002001)(93006095)(93001095)(10201501046)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123555025)(20161123560025)(20161123562025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);\n\tSRVR:MWHPR05MB3405; BCL:0; PCL:0;\n\tRULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);\n\tSRVR:MWHPR05MB3405; ","x-forefront-prvs":"0438F90F17","x-forefront-antispam-report":"SFV:NSPM;\n\tSFS:(10009020)(6009001)(376002)(346002)(199003)(24454002)(377454003)(189002)(51914003)(25786009)(229853002)(2900100001)(36756003)(54356999)(2950100002)(8936002)(6512007)(101416001)(99286003)(189998001)(50986999)(316002)(106356001)(6246003)(2201001)(14454004)(77096006)(53546010)(305945005)(58126008)(7736002)(110136005)(53936002)(2906002)(66066001)(2501003)(33656002)(81166006)(105586002)(83506001)(6486002)(97736004)(6436002)(3660700001)(478600001)(3280700002)(68736007)(83716003)(5660300001)(6116002)(6506006)(81156014)(76176999)(3846002)(8676002)(82746002)(86362001)(102836003);\n\tDIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR05MB3405;\n\tH:MWHPR05MB3406.namprd05.prod.outlook.com; FPR:; SPF:None;\n\tPTR:InfoNoRecords; A:1; MX:1; LANG:en; ","received-spf":"None (protection.outlook.com: vmware.com does not designate\n\tpermitted sender hosts)","spamdiagnosticoutput":"1:99","spamdiagnosticmetadata":"NSPM","Content-ID":"<6F172F366C905E49B22BDCC2F41843C9@namprd05.prod.outlook.com>","MIME-Version":"1.0","X-OriginatorOrg":"vmware.com","X-MS-Exchange-CrossTenant-originalarrivaltime":"22 Sep 2017 19:21:19.0002\n\t(UTC)","X-MS-Exchange-CrossTenant-fromentityheader":"Hosted","X-MS-Exchange-CrossTenant-id":"b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0","X-MS-Exchange-Transport-CrossTenantHeadersStamped":"MWHPR05MB3405","X-Spam-Status":"No, score=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,\n\tRCVD_IN_DNSWL_NONE autolearn=disabled version=3.3.1","X-Spam-Checker-Version":"SpamAssassin 3.3.1 (2010-03-16) on\n\tsmtp1.linux-foundation.org","Subject":"Re: [ovs-dev] [PATCH 3/3] dpif-netdev: Calculate rxq cycles prior\n\tto rxq_cycle_sort calls.","X-BeenThere":"ovs-dev@openvswitch.org","X-Mailman-Version":"2.1.12","Precedence":"list","List-Id":"<ovs-dev.openvswitch.org>","List-Unsubscribe":"<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>","List-Archive":"<http://mail.openvswitch.org/pipermail/ovs-dev/>","List-Post":"<mailto:ovs-dev@openvswitch.org>","List-Help":"<mailto:ovs-dev-request@openvswitch.org?subject=help>","List-Subscribe":"<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Sender":"ovs-dev-bounces@openvswitch.org","Errors-To":"ovs-dev-bounces@openvswitch.org"}},{"id":1791316,"web_url":"http://patchwork.ozlabs.org/comment/1791316/","msgid":"<97159ce5-2e66-0908-ff6c-94a5b520432c@redhat.com>","list_archive_url":null,"date":"2017-10-20T10:40:47","subject":"Re: [ovs-dev] [PATCH 3/3] dpif-netdev: Calculate rxq cycles prior\n\tto rxq_cycle_sort calls.","submitter":{"id":70482,"url":"http://patchwork.ozlabs.org/api/people/70482/","name":"Kevin Traynor","email":"ktraynor@redhat.com"},"content":"Ping again. This was requested to make the sort function behave in a\nmore standard manner. I don't think there's anything controversial in it.\n\nthanks,\nKevin.\n\nOn 09/22/2017 08:21 PM, Darrell Ball wrote:\n> Are there any other comments for this patch?\n> \n> \n> On 8/30/17, 11:01 AM, \"Darrell Ball\" <dball@vmware.com> wrote:\n> \n>     Thanks for the patch Kevin\n>     \n>     On 8/30/17, 10:45 AM, \"Kevin Traynor\" <ktraynor@redhat.com> wrote:\n>     \n>         rxq_cycle_sort summed the latest cycles from each queue for sorting.\n>         While each comparison was correct with the latest cycles, the cycles\n>         could change between calls to rxq_cycle_sort. In order to use\n>         consistent values through each call to rxq_cycle_sort, sum the cycles\n>         prior to rxq_cycle_sort being called.\n>     \n>     As discussed, these changes are optional and have some tradeoffs, but\n>     overall, I don’t see any major issue introduced here, since this is understood to be a\n>     rough comparison anyways.\n>         \n>         Also, change return to 0 when values are equal.\n>     \n>     As discussed, this means the equal tie-breaker is done by qsort instead of\n>     the compare function; the net practical effect of this is nil, but this is more\n>     standard.\n>     \n>         Reported-by: Ilya Maximets <i.maximets@samsung.com>\n>         Signed-off-by: Kevin Traynor <ktraynor@redhat.com>\n>         ---\n>          lib/dpif-netdev.c | 22 +++++++++++++---------\n>          1 file changed, 13 insertions(+), 9 deletions(-)\n>         \n>         diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c\n>         index 1db9f10..7c21ee5 100644\n>         --- a/lib/dpif-netdev.c\n>         +++ b/lib/dpif-netdev.c\n>         @@ -3432,18 +3432,14 @@ rxq_cycle_sort(const void *a, const void *b)\n>              struct dp_netdev_rxq *qb;\n>              uint64_t total_qa, total_qb;\n>         -    unsigned i;\n>          \n>              qa = *(struct dp_netdev_rxq **) a;\n>              qb = *(struct dp_netdev_rxq **) b;\n>          \n>         -    total_qa = total_qb = 0;\n>         -    for (i = 0; i < PMD_RXQ_INTERVAL_MAX; i++) {\n>         -        total_qa += dp_netdev_rxq_get_intrvl_cycles(qa, i);\n>         -        total_qb += dp_netdev_rxq_get_intrvl_cycles(qb, i);\n>         -    }\n>         -    dp_netdev_rxq_set_cycles(qa, RXQ_CYCLES_PROC_HIST, total_qa);\n>         -    dp_netdev_rxq_set_cycles(qb, RXQ_CYCLES_PROC_HIST, total_qb);\n>         +    total_qa = dp_netdev_rxq_get_cycles(qa, RXQ_CYCLES_PROC_HIST);\n>         +    total_qb = dp_netdev_rxq_get_cycles(qb, RXQ_CYCLES_PROC_HIST);\n>          \n>         -    if (total_qa >= total_qb) {\n>         +    if (total_qa == total_qb) {\n>         +        return 0;\n>         +    } else if (total_qa > total_qb) {\n>                  return -1;\n>              }\n>         @@ -3493,4 +3489,6 @@ rxq_scheduling(struct dp_netdev *dp, bool pinned) OVS_REQUIRES(dp->port_mutex)\n>                          }\n>                      } else if (!pinned && q->core_id == OVS_CORE_UNSPEC) {\n>         +                uint64_t cycle_hist = 0;\n>         +\n>                          if (n_rxqs == 0) {\n>                              rxqs = xmalloc(sizeof *rxqs);\n>         @@ -3498,4 +3496,10 @@ rxq_scheduling(struct dp_netdev *dp, bool pinned) OVS_REQUIRES(dp->port_mutex)\n>                              rxqs = xrealloc(rxqs, sizeof *rxqs * (n_rxqs + 1));\n>                          }\n>         +\n>         +                for (unsigned i = 0; i < PMD_RXQ_INTERVAL_MAX; i++) {\n>         +                    cycle_hist += dp_netdev_rxq_get_intrvl_cycles(q, i);\n>         +                }\n>         +                dp_netdev_rxq_set_cycles(q, RXQ_CYCLES_PROC_HIST, cycle_hist);\n>         +\n>                          /* Store the queue. */\n>                          rxqs[n_rxqs++] = q;\n>         -- \n>         1.8.3.1\n>         \n>         \n>     \n>     \n>","headers":{"Return-Path":"<ovs-dev-bounces@openvswitch.org>","X-Original-To":["incoming@patchwork.ozlabs.org","dev@openvswitch.org"],"Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","ovs-dev@mail.linuxfoundation.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=openvswitch.org\n\t(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;\n\tenvelope-from=ovs-dev-bounces@openvswitch.org;\n\treceiver=<UNKNOWN>)","ext-mx04.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx04.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=ktraynor@redhat.com"],"Received":["from mail.linuxfoundation.org (mail.linuxfoundation.org\n\t[140.211.169.12])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yJMlX1SPpz9t6m\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 20 Oct 2017 21:40:56 +1100 (AEDT)","from mail.linux-foundation.org (localhost [127.0.0.1])\n\tby mail.linuxfoundation.org (Postfix) with ESMTP id 9F4C7BD3;\n\tFri, 20 Oct 2017 10:40:54 +0000 (UTC)","from smtp1.linuxfoundation.org (smtp1.linux-foundation.org\n\t[172.17.192.35])\n\tby mail.linuxfoundation.org (Postfix) with ESMTPS id 644F1A47\n\tfor <dev@openvswitch.org>; Fri, 20 Oct 2017 10:40:53 +0000 (UTC)","from mx1.redhat.com (mx1.redhat.com [209.132.183.28])\n\tby smtp1.linuxfoundation.org (Postfix) with ESMTPS id 9D4994CE\n\tfor <dev@openvswitch.org>; Fri, 20 Oct 2017 10:40:52 +0000 (UTC)","from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id E89C67E394;\n\tFri, 20 Oct 2017 10:40:51 +0000 (UTC)","from ktraynor.remote.csb (ovpn-116-70.ams2.redhat.com\n\t[10.36.116.70])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 0135B5C3FA;\n\tFri, 20 Oct 2017 10:40:48 +0000 (UTC)"],"X-Greylist":["domain auto-whitelisted by SQLgrey-1.7.6","Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.28]);\n\tFri, 20 Oct 2017 10:40:52 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com E89C67E394","To":"Darrell Ball <dball@vmware.com>, \"dev@openvswitch.org\"\n\t<dev@openvswitch.org>,\n\t\"i.maximets@samsung.com\" <i.maximets@samsung.com>, \n\tIan Stokes <ian.stokes@intel.com>","References":"<1504115149-26864-1-git-send-email-ktraynor@redhat.com>\n\t<1504115149-26864-3-git-send-email-ktraynor@redhat.com>\n\t<DFE132D2-EEF5-4E49-AA1D-C44FA40A8EF3@vmware.com>\n\t<64B4D824-A6A2-48D6-AE38-FF9BBD4DAB3C@vmware.com>","From":"Kevin Traynor <ktraynor@redhat.com>","Organization":"Red Hat","Message-ID":"<97159ce5-2e66-0908-ff6c-94a5b520432c@redhat.com>","Date":"Fri, 20 Oct 2017 11:40:47 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.2.0","MIME-Version":"1.0","In-Reply-To":"<64B4D824-A6A2-48D6-AE38-FF9BBD4DAB3C@vmware.com>","Content-Language":"en-US","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.16","X-Spam-Status":"No, score=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,\n\tRP_MATCHES_RCVD autolearn=disabled version=3.3.1","X-Spam-Checker-Version":"SpamAssassin 3.3.1 (2010-03-16) on\n\tsmtp1.linux-foundation.org","Subject":"Re: [ovs-dev] [PATCH 3/3] dpif-netdev: Calculate rxq cycles prior\n\tto rxq_cycle_sort calls.","X-BeenThere":"ovs-dev@openvswitch.org","X-Mailman-Version":"2.1.12","Precedence":"list","List-Id":"<ovs-dev.openvswitch.org>","List-Unsubscribe":"<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>","List-Archive":"<http://mail.openvswitch.org/pipermail/ovs-dev/>","List-Post":"<mailto:ovs-dev@openvswitch.org>","List-Help":"<mailto:ovs-dev-request@openvswitch.org?subject=help>","List-Subscribe":"<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Sender":"ovs-dev-bounces@openvswitch.org","Errors-To":"ovs-dev-bounces@openvswitch.org"}}]