From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0082.outbound.protection.outlook.com [104.47.38.82]) by dpdk.org (Postfix) with ESMTP id 182B81B01B for ; Tue, 16 Jan 2018 13:32:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=qYcXwb+p3sVZ+ojQwdFCiuSVNTYJKUj4klJaM7spHLI=; b=iEfbkBb9fhogc0FJTdaeB/YMwqxo0cyiqzCNnki38d8ImNujBtvs8S1W+cArrFNmtDvE10MnQNNzU7qIN8EeY6ucjTvWXeTYdlMaIR0GGmP6qkr7WG7c/HzKummp3Bd8Ahb+pGP0TarCC0zhBfGjR5O+0x57EkUCIPmOsjGyGRs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from Pavan-LT (111.93.218.67) by BN6PR07MB3460.namprd07.prod.outlook.com (10.161.153.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Tue, 16 Jan 2018 12:32:04 +0000 Date: Tue, 16 Jan 2018 18:01:41 +0530 From: Pavan Nikhilesh To: "Van Haaren, Harry" , "jerin.jacob@caviumnetworks.com" , "santosh.shukla@caviumnetworks.com" , "Eads, Gage" , "hemant.agrawal@nxp.com" , "nipun.gupta@nxp.com" , "Ma, Liang J" Cc: dev@dpdk.org Message-ID: <20180116123140.q6jlvotppdxn7w6r@Pavan-LT> References: <20171130072406.15605-1-pbhagavatula@caviumnetworks.com> <20180112164416.21374-1-pbhagavatula@caviumnetworks.com> <20180112164416.21374-10-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170609 (1.8.3) X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR01CA0082.INDPRD01.PROD.OUTLOOK.COM (10.174.208.150) To BN6PR07MB3460.namprd07.prod.outlook.com (10.161.153.23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c20f6a2f-6c5c-40b0-fbc8-08d55cdd27f9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534125)(4602075)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:BN6PR07MB3460; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3460; 3:PsPkO3s0XLG9ob5ZDhuJNWmz8Xne7HcC/92yLkNP8HFBqzulvT4dG216CxdEnBK9NlwnnHgvCjwnR0m2TSnycbvZHc5kr3Pi2iqTTOG7bQ+P2WqoN2RQ8niHPgIrq1MSVUpjTg0EpEAdO2UANQS1uDDThQAOq/hy+N/ouLtWCTioo8PzRsYjYg5PoGOATzqVC9CLKQDlq3uV5m7JvCHAnjjg8RrSqzWHwSQqxbkFqyHa4twzdFYIkcDoEPLPB6FF; 25:6FJGB2E7iJ3ishlloa8UgzX3Hhsl8nmUW6v5ev3fkxWEhHSppKErdX86+UZQ0fmTxordU9T4wqEyFU9oH4Ko+4I5U+TwO5TsMnyUyvz0sZ+VeLMNUYUT+GKETqJ5LSPqu0FnIEHqI1bOHwP9qqPHpWk5ODYeCI4BmBYOCIHtPlkp9iBRYrLBzrM+jHuSXKVJ7cBJrBRlycPsFn40qOCBAHw9ytch/TyNryQzGWT95/pOtHKkTaB/9rfWWPUE++cWpNRuE/KWLPcJOkSY0baIhg2jcuf/1wWf5h4ECVvrJ6ruMmUEIf/G8U5BG6gFLa6NPrCcjoBSedfFlV/RfuU1dg==; 31:lcdfTHonomQCAA9LqfJ0XeY82G4bKJSOvccQlIaRYvjE1ubzh3Mfu3Go6eCWt/iONOP5mqsMM+Y8t/7wY6ZP9538r+ZSSAYMFKMcxJEw29hgVoHwYwetBmDG8+xxaWllKrcTuY13EjsviWow9rF16EFmbR6pBFfp7HqLlZc/rdbdN62RK5NF1iiOxiZlH1dwS0SkX7MLWUnGC1ggzZOaDOUFv2ei3noEH2c15xKo+Q8= X-MS-TrafficTypeDiagnostic: BN6PR07MB3460: X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3460; 20:skV6k8NNNGOkJniVNn2e0DAoMvlQWLzowlpbjXeadv20SuLQcJtSOtZF9bifMr9Su7H3SlSNxw9bvHsw8h7CTLq2arzd0APwijEgSs39p5HKl+zZ5YrDrmPFL9c+71wcTKzPmaiwayIfG9qAXgsKEkMHmAbv3nab2v4D6o1vaOg2KcEltN+bzvJ77QB8ThsK5lYv7cky3XKgmHOEsUNs/DTBPl4YJwZd04p7lKrziN6aF0jzyGyz2qzrotRqVYszdUKk4oKlyJZRkc4veTzHzduMRQvgtOX6mB+qIhGzqbpNlwvo9F/OLLqOYfAGSbqXEf4YfeW46jfeu0YnOI4oXV8JdMnA5uSQA6z3NboKYH+L7IH1Dxma0NhxW1pJBV0SdlsxAmslZD5D6WoT/SutRNeBm4tAUFg7b/S+365PX4jsp+eK4YBfVM/Oc0EcrqIAEzrwXS+wIFZgaYGu5u/6CJZN561U5dgKGLgJKFQM8b+0SdrWAd0AR+QtNwDzfqhrmxLMzqDIL3Ep1bhDcu1y0XoHqyj3hXDA56h+AZ3Kvzs/tPnexw/u+jRRyS5dHuruIEYHSP4Zs/pSjN7qKTfqpnw5dTs+31ogRo/eJD+rifM= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3002001)(93006095)(3231023)(944501161)(10201501046)(6041268)(20161123562045)(20161123564045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:BN6PR07MB3460; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BN6PR07MB3460; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3460; 4:zjSgmIT/GdBeBSTQI1SDfyY8ICbZD0vVE4p4Fq6Q0RfBJ77qXqzBlfj40oqtfbtQbcrPU1w2ekNbNuZzs84EfubjnxT681Ieqexm2+3J26EtOWO3hC9bCRGRGNaVnRxQi0i9CDr34aEWIcaaio6Xgv9vpexwKod6hRwDFOmUoqFfpw3z/fDoX1sJzYXBCr3rkiGaCgbGDBRfzaxlAYFwajIw1M6GNGGMdLJ3ATo/JuzEEf2xAlPFUkUUqNIsNss/d6zFMC0xGtIADsKFchcwAcN5SVX3nkOnwQRpnVIUSFukIuMvrvWejSJ3BYzG87UtDoPtx6V8HRzalfNSdMqLPBAz+Jdm9skd+FWVNBC0aoI= X-Forefront-PRVS: 0554B1F54F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(39380400002)(376002)(396003)(39860400002)(366004)(189003)(199004)(24454002)(51914003)(68736007)(16526018)(110136005)(8656006)(66066001)(316002)(58126008)(16586007)(8676002)(81156014)(81166006)(47776003)(6666003)(8936002)(42882006)(2950100002)(97736004)(93886005)(76176011)(2906002)(52116002)(386003)(33896004)(26005)(106356001)(478600001)(105586002)(83506002)(72206003)(5660300001)(6496006)(53546011)(7736002)(5009440100003)(305945005)(33716001)(4326008)(6116002)(3846002)(6246003)(2201001)(229853002)(2501003)(23726003)(1076002)(25786009)(55016002)(50466002)(9686003)(53936002)(107986001)(921003)(1121003)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB3460; H:Pavan-LT; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR07MB3460; 23:d+ozYJB1tiC7eFrnl4as0T1tE3RhftpkM6kZoGzQz?= =?us-ascii?Q?I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fDmTh6OzmVx5jbNt2JElT/Vwl+B6zwQJHS+35ptd9oZKNNCU3Kp8cxXdGHSdWNIio0FDtqgMXpopQP6btoSpw3edjiFZZn2heYstQUIBSRRMuwxg3x/IPtL79UfhinNI9jcD8NY=; 24:7C5eV8M7tWRxlOaMISN0Zo7YOtXRpU/sQiLdsDKVafzj0ZnNLFYwFoJhPcPURuLrwEh6xX4wDVBSSj2jqSM6aK4GN39YD+QurPYXZH3LSHc=; 7:KVXWGJQXheY+iT4kaWDhpX9xOoCfCu+ZYMVA9xUwsFqqyUvp8vgYg4QsvDcQk/bxcG4q66TQqr9afrB8lEvfJYKVHZRKb61qeRYIgj8zSNkzBDzBGXg1SbjfHmOKjmnP5JCNH15un1bf4EB1K+Op6gM/0QNyxh3gbPbAFKrgPiLwFle1dpISww0vb5d62FxcwxNhpQLaH07BvZcxQ3WFJz9JQEawDiDauHFe2Dok+cizSG6N9CWEr2PPLGSvtonj SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2018 12:32:04.7734 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c20f6a2f-6c5c-40b0-fbc8-08d55cdd27f9 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3460 Subject: Re: [dpdk-dev] [PATCH v4 10/13] app/eventdev: add pipeline queue worker functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jan 2018 12:32:08 -0000 Hi Harry, Thanks for the review. On Tue, Jan 16, 2018 at 12:05:48PM +0000, Van Haaren, Harry wrote: > > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com] > > Sent: Friday, January 12, 2018 4:44 PM > > To: jerin.jacob@caviumnetworks.com; santosh.shukla@caviumnetworks.com; Van > > Haaren, Harry ; Eads, Gage > > ; hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Ma, > > Liang J > > Cc: dev@dpdk.org; Pavan Nikhilesh > > Subject: [dpdk-dev] [PATCH v4 10/13] app/eventdev: add pipeline queue worker > > functions > > > > Signed-off-by: Pavan Nikhilesh > > Some of the code feels like duplication - but there are differences in each implementation as far as I can see. The common initialization parts are "macro-ed" to ensure minimal duplication. In short, I'm not aware of a better solution/implementation. > > Please see note on branch-optimization in the code below. > > Acked-by: Harry van Haaren > > > > static int > > worker_wrapper(void *arg) > > { > > - RTE_SET_USED(arg); > > + struct worker_data *w = arg; > > + struct evt_options *opt = w->t->opt; > > + const bool burst = evt_has_burst_mode(w->dev_id); > > + const bool mt_safe = !w->t->mt_unsafe; > > + const uint8_t nb_stages = opt->nb_stages; > > + RTE_SET_USED(opt); > > + > > + /* allow compiler to optimize */ > > + if (nb_stages == 1) { > > + if (!burst && mt_safe) > > + return pipeline_queue_worker_single_stage_tx(arg); > > + else if (!burst && !mt_safe) > > + return pipeline_queue_worker_single_stage_fwd(arg); > > + else if (burst && mt_safe) > > + return pipeline_queue_worker_single_stage_burst_tx(arg); > > + else if (burst && !mt_safe) > > + return pipeline_queue_worker_single_stage_burst_fwd( > > + arg); > > + } else { > > + if (!burst && mt_safe) > > + return pipeline_queue_worker_multi_stage_tx(arg); > > + else if (!burst && !mt_safe) > > + return pipeline_queue_worker_multi_stage_fwd(arg); > > + else if (burst && mt_safe) > > + return pipeline_queue_worker_multi_stage_burst_tx(arg); > > + else if (burst && !mt_safe) > > + return pipeline_queue_worker_multi_stage_burst_fwd(arg); > > + > > + } > > > I don't think the compiler will optimize the below, as the nb_stages value comes from opt, which is a uint8 originating from a pointer-dereference... > > As far as I know, an optimizing compiler will do "constant propagation" through function calls, but I would be amazed if it found a pointer initialized to a specific value, and optimized the branches away here based on the contents of that pointer deref. > > So I see 2 options; > 1) accept as is - I'll ack this patch here > 2) Rework so that the worker_wrapper() accepts nb_stages, burst and mt_safe as function arguments, allowing constant propagation for optimizing away the branches. > > @Pavan, I'll leave that choice up to you! As the worker functions are not affected, I will keep the conditions as is and remove the comment for now. Cheers, Pavan. >