From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 70EEBA00C5; Wed, 12 Jan 2022 16:49:21 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E794642707; Wed, 12 Jan 2022 16:49:20 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id CD1C242703 for ; Wed, 12 Jan 2022 16:49:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1642002558; x=1673538558; h=message-id:date:subject:to:references:from:in-reply-to: content-transfer-encoding:mime-version; bh=J+S4sSBCmbWK/4xeJhNuZXNMUTXxeFVW1Zta3uOaqkM=; b=d1HIMAxQV+MwrSkKiRJR/khaPxTC6+FkvzcziOl4pg426jxH3CgfGwMQ tTcgfczNRohpg/0Ib0AO9MWUN70K87sP+O213pATG6mYtQnqBtGBMUrXs vwlTKxSPumxHN7I5geQf0c1Lo6hFuD6xOZwUCmwucnR/K9XR28VOWr5eV KZatzfXvZWlbOfqqLQdr5ojXdGYIWWCd7JOLEAOtxShZea7WITKpWx6SU Zh7rlfCL9g2ArJxQNfEMPIg1YjLJBK6kLLjqvFgD4hZE1m4jSaNawejbe J/z9Lb4oDsimXrJyumzJB2g5tqJwuSv6mYCfurFlZlJILQgz2bqxIZWq8 w==; X-IronPort-AV: E=McAfee;i="6200,9189,10224"; a="243965157" X-IronPort-AV: E=Sophos;i="5.88,282,1635231600"; d="scan'208";a="243965157" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2022 07:49:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,282,1635231600"; d="scan'208";a="765233019" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga005.fm.intel.com with ESMTP; 12 Jan 2022 07:49:17 -0800 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 12 Jan 2022 07:49:17 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Wed, 12 Jan 2022 07:49:17 -0800 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.103) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Wed, 12 Jan 2022 07:49:17 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gK2pxTmvmx1biNJHERmDRmxlCP+FTj9G/Wdxms4c1XGPvs6kliI8GKnu2xtWPq2sCo2LF9GXGtXqRO9tkITMa9Yzj1FCSc67TgFfpNUEVeGAt9I7VnOs/n8UYdblLVcpGgHwUaT09X8wn+v+JjsGJTwZNRHeBhn3VqWkdFmMbcFwjEL5o/Oeg+sva5rJqaCTEjQu5k7WqXz/GHv/daae/XHaqUXhZjDZtzjwvWOiXi9mJu2D5ezYCFL2rhn9COJhrR/F2MARPnszQS1jLIZtkAdfNKppx36vILfKBLey/aZsNh3PoGXhn7BQ4ulCtCksgyswOxmZkSabM5F9Z6Y2Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5F9nZ3VW26fAKOcvHscA5ZpYternSG75FnqD66+hgAk=; b=eOuSY7tli/gGizROP8ZuMgPOAlo+m2t5zXP3WnfxDCj89Lg0O+7Ozib/oqobYMNVOrCINQN1vb6aK1IBwsCiF6TpzA3IgBC4/aBobQw95CspvkP+AnVgrFIhthXzdQrELI0ZMAy/VNo0bwzRhaXmFF4xRH97q8/51UTnXB4reBei+EoKGFRHBAaw1VfkiCZKNmmHCq+swp1wz+9xVADyoZpYiubCi5ZcVHVfRn1HbAPhpQVINia9XfLcMD+Fu9ONzgZ/IjcQB6nCIM3BhESsL77py5SD4wKwr+OU4PIxw5KxZrZiTjLq0soa0P+GVnCmXr0bM8u994iN+Y0ac+97fw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from CH2PR11MB4213.namprd11.prod.outlook.com (2603:10b6:610:44::16) by CH2PR11MB4296.namprd11.prod.outlook.com (2603:10b6:610:3c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.9; Wed, 12 Jan 2022 15:49:16 +0000 Received: from CH2PR11MB4213.namprd11.prod.outlook.com ([fe80::35ca:393e:e595:b75f]) by CH2PR11MB4213.namprd11.prod.outlook.com ([fe80::35ca:393e:e595:b75f%5]) with mapi id 15.20.4867.012; Wed, 12 Jan 2022 15:49:16 +0000 Message-ID: <7dbf048e-27c0-6143-5b25-9644b87fc8c0@intel.com> Date: Wed, 12 Jan 2022 16:49:11 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.4.1 Subject: Re: [PATCH] app/test-fib: fix possible division by zero Content-Language: en-US To: Kevin Traynor , References: <20211223152519.758827-1-vladimir.medvedkin@intel.com> From: "Medvedkin, Vladimir" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P123CA0175.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18a::18) To CH2PR11MB4213.namprd11.prod.outlook.com (2603:10b6:610:44::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 696112f4-22a0-409c-c507-08d9d5e3163c X-MS-TrafficTypeDiagnostic: CH2PR11MB4296:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ny+kCpnjqinxJjrgUAvcp8n52fxoETrphuKfxj2+4RBkvUHciMkeYWtdV0k0SVy3jk4O+7KgdrUbHQVBSDYTPWfW+7arpuLbj4AZul3CvHpwekIG9eA+aZruvdWMP/nF3KEOmS2/tPyraMc00tQPPCdfhN1N8u4NYKC34+r/936y1xgVRU78O39R3HC1vEGM7gGPDOu2FC/sE6d9fo21j9DEbohVgRiXPC+cuDsKeXMw2zUTOxLIihPRV8smstzHUQOwTqyWAN5hPAdc/JMhPEByQmx/CUYIQvQJ+Q3dHYbHS6Ui1x5MA2q+kEXvo0QKAbWMHmweBo1/KZ6D2PIvq1/s9tiHPNOlKe39maV7wDLlRtO7pKRto1PD1wy1VXCCxhWWGVvDHGkFhfS00e61nlllzO+AQBmT314J2T/5Jz6ouVgtrYbP/nenwiS1p7qP1XoKeE51Ux9SQLXYd7WXhwlZBozgtr1fm1sLoLjOyR+SfZFyGRsUwSNkiuBKftd728R9R1koHLbc0M0BJL04mRFjdQLaEzlKlzA5jnvhhZpErP0TlsQjuYoFyY06FlIYqZjQXx95QXm8kdRJ0Xc4kUl0Z0UqauXr5+XMKaVe9yUyBFFahPe4vw08F/4FYdirv23RMU7msMoYEBVfDEB/PB0X2PhQEe8wEZUT7K7TB5doJWTmpbstyrX/beSOu0d8jG+73hKfhlb7ZfhtngWEOgnfF3b/1S/4OM2aMZ3LCOyHCFVyMmtMSUPG3+Cu9KnAzLnyTG0xW5MgRAubI5xyeg09IbqcTc1pg7UrEZ2KUdKU0jMWhq2uc6tK4VG5d473 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR11MB4213.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(66946007)(508600001)(2616005)(6512007)(31696002)(2906002)(66556008)(66476007)(5660300002)(8676002)(86362001)(6666004)(82960400001)(8936002)(6486002)(6506007)(36756003)(53546011)(31686004)(38100700002)(186003)(83380400001)(316002)(26005)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Skdwc2ljbUxzb28vS1FIb3o1aFo4NG5EZmtzQlQ2S0NmS2pSNHAyYk12b21W?= =?utf-8?B?ZWc2N0k5WVA2VG5WTjdKeW1tc2NmcnhDMTF5UnZPU3MxeTl4bk1Mdmx0QnV2?= =?utf-8?B?VGF4L3NLMlJoZ1lyZkMybVU4L0Q4THRRaHB5dHVBOEZ6eit4WGJIQzBldFQw?= =?utf-8?B?ZXVqb2Q2Y0xrWXZidkdXQUVza0gvcUlXeDh0ekNpSjRha3U1WTFOQU1BNUg5?= =?utf-8?B?UEsyYlFqdisvOHhsbnhLYWNuVFFJVmxRZVpzQWJmNDB1ZVlUbi9jenc3Sk5T?= =?utf-8?B?d05nSTVwT2djclBzSUcvd0VRQVMzUUhuU0wvZ2N3VnR5dEl1dEVndTd3K0RJ?= =?utf-8?B?b3M1cU5FWHRldk9NUVRtR0dEVlRXM3paTTFKMjFsR0hDb2NXaTV2Mn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3NyNXVuMWJXUmEraEgzbzBPSkhHQ2pEVXpL?= =?utf-8?Q?MsXt72ea6sbv46oefPfd9J4xyhNINHx5ezu82p2qmk=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 696112f4-22a0-409c-c507-08d9d5e3163c X-MS-Exchange-CrossTenant-AuthSource: CH2PR11MB4213.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 15:49:15.9509 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: dKqOPuZFgzuvkbEG6yzi0yoo/UKCY2+1cR4sGkO+45GnpHr+CDlu2UPVv6jbzx/Hr4o5tn88Y9s4vgWlL3UCeIQluC8iDpugHQCGeS5agR4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR11MB4296 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi Kevin, On 11/01/2022 17:15, Kevin Traynor wrote: > On 23/12/2021 15:25, Vladimir Medvedkin wrote: >> This patch fixes the division by 0, which occurs if the number of >> routes is less than 10. >> Can be triggered by passing -n argument with value < 10: >> > > 9 causing a divide by zero - another example of inflation :-) > Too bad that we are not working in a wheel (https://en.wikipedia.org/wiki/Wheel_theory), where division by 0 is always defined :) >> ./dpdk-test-fib -- -n 9 >> ... >> Floating point exception (core dumped) >> >> Fixes: 103809d032cd ("app/test-fib: add test application for FIB") >> Cc: vladimir.medvedkin@intel.com >> > > You probably want to add 'Cc: stable@dpdk.org' for this. > >> Signed-off-by: Vladimir Medvedkin >> --- >>   app/test-fib/main.c | 40 ++++++++++++++++++++++++---------------- >>   1 file changed, 24 insertions(+), 16 deletions(-) >> >> diff --git a/app/test-fib/main.c b/app/test-fib/main.c >> index ecd420116a..9bc8b8a7ca 100644 >> --- a/app/test-fib/main.c >> +++ b/app/test-fib/main.c >> @@ -902,8 +902,9 @@ run_v4(void) >>                   return -ret; >>               } >>           } >> -        printf("AVG FIB add %"PRIu64"\n", >> -            (rte_rdtsc_precise() - start) / j); >> +        if (j != 0) >> +            printf("AVG FIB add %"PRIu64"\n", >> +                (rte_rdtsc_precise() - start) / j); > > > You are just not printing the result for these cases. Do you think it is > worth to print a warning message (one), and update any documentation so > the user is aware of the acceptable bounds? > Agree, I'll send v2 >>           i += j; >>       } >> @@ -930,8 +931,9 @@ run_v4(void) >>                       return -ret; >>                   } >>               } >> -            printf("AVG LPM add %"PRIu64"\n", >> -                (rte_rdtsc_precise() - start) / j); >> +            if (j != 0) >> +                printf("AVG LPM add %"PRIu64"\n", >> +                    (rte_rdtsc_precise() - start) / j); >>               i += j; >>           } >>       } >> @@ -984,8 +986,9 @@ run_v4(void) >>           for (j = 0; j < (config.nb_routes - i) / k; j++) >>               rte_fib_delete(fib, rt[i + j].addr, rt[i + j].depth); >> -        printf("AVG FIB delete %"PRIu64"\n", >> -            (rte_rdtsc_precise() - start) / j); >> +        if (j != 0) >> +            printf("AVG FIB delete %"PRIu64"\n", >> +                (rte_rdtsc_precise() - start) / j); >>           i += j; >>       } >> @@ -996,8 +999,9 @@ run_v4(void) >>                   rte_lpm_delete(lpm, rt[i + j].addr, >>                       rt[i + j].depth); >> -            printf("AVG LPM delete %"PRIu64"\n", >> -                (rte_rdtsc_precise() - start) / j); >> +            if (j != 0) >> +                printf("AVG LPM delete %"PRIu64"\n", >> +                    (rte_rdtsc_precise() - start) / j); >>               i += j; >>           } >>       } >> @@ -1097,8 +1101,9 @@ run_v6(void) >>                   return -ret; >>               } >>           } >> -        printf("AVG FIB add %"PRIu64"\n", >> -            (rte_rdtsc_precise() - start) / j); >> +        if (j != 0) >> +            printf("AVG FIB add %"PRIu64"\n", >> +                (rte_rdtsc_precise() - start) / j); >>           i += j; >>       } >> @@ -1125,8 +1130,9 @@ run_v6(void) >>                       return -ret; >>                   } >>               } >> -            printf("AVG LPM add %"PRIu64"\n", >> -                (rte_rdtsc_precise() - start) / j); >> +            if (j != 0) >> +                printf("AVG LPM add %"PRIu64"\n", >> +                    (rte_rdtsc_precise() - start) / j); >>               i += j; >>           } >>       } >> @@ -1183,8 +1189,9 @@ run_v6(void) >>           for (j = 0; j < (config.nb_routes - i) / k; j++) >>               rte_fib6_delete(fib, rt[i + j].addr, rt[i + j].depth); >> -        printf("AVG FIB delete %"PRIu64"\n", >> -            (rte_rdtsc_precise() - start) / j); >> +        if (j != 0) >> +            printf("AVG FIB delete %"PRIu64"\n", >> +                (rte_rdtsc_precise() - start) / j); >>           i += j; >>       } >> @@ -1195,8 +1202,9 @@ run_v6(void) >>                   rte_lpm6_delete(lpm, rt[i + j].addr, >>                       rt[i + j].depth); >> -            printf("AVG LPM delete %"PRIu64"\n", >> -                (rte_rdtsc_precise() - start) / j); >> +            if (j != 0) >> +                printf("AVG LPM delete %"PRIu64"\n", >> +                    (rte_rdtsc_precise() - start) / j); >>               i += j; >>           } >>       } >> > -- Regards, Vladimir