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 0BDEDA034C; Thu, 29 Sep 2022 20:10:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0415A4114E; Thu, 29 Sep 2022 20:10:52 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2040.outbound.protection.outlook.com [40.107.237.40]) by mails.dpdk.org (Postfix) with ESMTP id 3BB614114E for ; Thu, 29 Sep 2022 20:10:50 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IChN5vBZJzNKFwJQ5FYMNI+XwTRFPHF3dL/1/Ix6IfJnuawSWAAsWbEEKgHbx7DMKhYkOY7Y2UaRWGqU2pSvmYpna95q1mLRwifJRZvui8cAkzpWv3NAUKdPGE/TXu0R044MZ2Y0Xy4CMfkrcUgnR3UJwUwEzIxtGsSWDinL2VgH/eKlxqwj+VbO9D2lOks/ex06wnS6laVJMnDgIiP5GwGh4rguhlBYBpkDExjxXiPQQc1PJ9B5pu0oF1db24XkCj9nf/dlRNqcrNfQAleMy7weds16vySW6dlauFwSVrVmjhK7DddCRJZmkxSL5F+hG8N6egxqeyLStFLUA4qxlA== 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=IAacjX6iFWo1Ea+zTX1zAPgsyfcv6k7rM1pbqyUYvYU=; b=XEG9Yn9x+BY+A7fpE0YJMAj443upVXE3heelIjne/jpiaITmAVLadNb0js3BqmjNw7OlWnfwnSjS9U7MNxBf7zHKseN53GR7RvFheP/Nj8z9AKwtpPY7lusdT8fJLD2RqKsOFVwZJaN0bbgFoGmxdCmy8Gd8CKEdVqWH8ZepGoHf8QqYFKn9RoR02Yno/nwUZC5J+1N01ejrUuLbl4Bcb2/A5LLsptReZXUYxab/kTamEtBbf54+irFMOgROFX75Bl4MVqIz9bxh2nHvvc/oV3jMRpdtBAYut5mnsQ8HqGgjvz2YpZsn6miFOoArcDpHAFWzswlenOfTMHseD7f6og== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=softfail (sender ip is 149.199.80.198) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=fail (p=quarantine sp=quarantine pct=100) action=quarantine header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IAacjX6iFWo1Ea+zTX1zAPgsyfcv6k7rM1pbqyUYvYU=; b=heX/43FQ6WGS5UNDu179y0kwpslQSl+GVPuzMt1+A5yOO3A23460QJhkzonbJ453GF0O4re809JRcpq9eEmDtLwRdaSHVw2fguUeRPPYHFGkjaxMAfyLTBYzbZS2AkIBQVpM8QHmfbUv/qzqAqzmFgC/ha3oSGu+JTWzaZ4QPco= Received: from SA9PR13CA0065.namprd13.prod.outlook.com (2603:10b6:806:23::10) by MN2PR02MB6781.namprd02.prod.outlook.com (2603:10b6:208:1d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.24; Thu, 29 Sep 2022 18:10:48 +0000 Received: from SN1NAM02FT0019.eop-nam02.prod.protection.outlook.com (2603:10b6:806:23:cafe::e1) by SA9PR13CA0065.outlook.office365.com (2603:10b6:806:23::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.20 via Frontend Transport; Thu, 29 Sep 2022 18:10:48 +0000 X-MS-Exchange-Authentication-Results: spf=softfail (sender IP is 149.199.80.198) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=fail action=quarantine header.from=amd.com; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning amd.com discourages use of 149.199.80.198 as permitted sender) Received: from xir-pvapexch02.xlnx.xilinx.com (149.199.80.198) by SN1NAM02FT0019.mail.protection.outlook.com (10.97.4.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5676.17 via Frontend Transport; Thu, 29 Sep 2022 18:10:47 +0000 Received: from xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) by xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 29 Sep 2022 19:10:34 +0100 Received: from smtp.xilinx.com (172.21.105.198) by xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) with Microsoft SMTP Server id 15.1.2375.24 via Frontend Transport; Thu, 29 Sep 2022 19:10:34 +0100 Envelope-to: ferruh.yigit@xilinx.com, nicolas.chautru@intel.com, gakhil@marvell.com, dev@dpdk.org, maxime.coquelin@redhat.com, mdr@ashroe.eu, thomas@monjalon.net, trix@redhat.com, bruce.richardson@intel.com, david.marchand@redhat.com, stephen@networkplumber.org, mingshan.zhang@intel.com, hemant.agrawal@nxp.com Received: from [172.21.36.148] (port=53488) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1odxzT-0004tF-8G; Thu, 29 Sep 2022 19:10:31 +0100 Message-ID: <198c3707-abad-40df-a0ee-0e1b2aa330ee@amd.com> Date: Thu, 29 Sep 2022 19:10:31 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: [EXT] [PATCH v7 6/7] bbdev: add queue related warning and status information Content-Language: en-US To: "Chautru, Nicolas" , Akhil Goyal , "dev@dpdk.org" , Maxime Coquelin , "ferruh.yigit@xilinx.com" , Ray Kinsella CC: "thomas@monjalon.net" , "trix@redhat.com" , "Richardson, Bruce" , "david.marchand@redhat.com" , "stephen@networkplumber.org" , "Zhang, Mingshan" , "hemant.agrawal@nxp.com" References: <1655491040-183649-6-git-send-email-nicolas.chautru@intel.com> <1661796438-204861-1-git-send-email-nicolas.chautru@intel.com> <1661796438-204861-7-git-send-email-nicolas.chautru@intel.com> <88a06267-0cf3-a6cd-0785-b5b2a419fc02@amd.com> From: Ferruh Yigit In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1NAM02FT0019:EE_|MN2PR02MB6781:EE_ X-MS-Office365-Filtering-Correlation-Id: f78410ac-ca61-4bdf-34e7-08daa245ef75 X-MS-Exchange-SenderADCheck: 2 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GhTQEjvVxR9UpcqkYpRmbkS6oyx8oxrvv8Th5QCO8xzLCmRMc9MKg8M8DRcz66NL9IFAvFJ7DnJz63EKqg7LUhT29UP3FMzjc5ZogDfE4gb21+OtX2JoFCtdmENwFFHJw34+Lx//qY0niGuWVqlh0uxggr5micq0kNs/REq2J/NhokqqL/nbzgTQAwVfJiSyxP1+LPhTGC0iTEldY/n0iIqRxC6TUO2cjkQDdI3HgB6r867UFQHgbfIj+6mBFYjzUHfvCHN+tSojeaayW7SgSi75kK3+05OQfkI+RUu6j7CmhYVz77hsHOJ9u1HkqGg+phPs3ShBOfHjVL3hsVBSEwQEmqN163lbOXHTZm7w02vBYixZ+AcjBlqZARnlVdXhN21kH8elc+Y1FP9K5F//QRP2tGPpWXy1rjz3vU2Tk3eyzjxtuo1E/pzIhLN6rJSMacaXNplLadsUlzRHj6KBbYx3ZTyRP3w0jy5ANuzSgZ+vgeACSwsIobGmoL+RSFylOq7rSMzpMPl58d13pXS6ZH63frN1OduYC2byBPyBv0VZ85HfQuJpgplS92zjfZjdS40k3wVc1RDPLFS1QEQbJVW5qWir/1Cck7W9wjhMiVidRNfItQ/+ngdImw4Z/VdE1vEXebGhFSsp+VGE/MPdRGC+Lgp5MRgJF5yUFEY7AB6c6FAmpde7uF0Lihh+qkOpiN1g7zm/Ewr/v1q9wvAk3vIy9qqJwxDMI7pJpy/oHAhHc4rUeSN33pjQsnv5C6j+/8tp8ibvtScciXFtdrC4Bzk1rA1+7vmq453NBW0J6V0huagrpJIt61wTJo0uaFftBD8fhCiARwtLAxffaIzZrA== X-Forefront-Antispam-Report: CIP:149.199.80.198; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:xir-pvapexch02.xlnx.xilinx.com; PTR:unknown-80-198.xilinx.com; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(376002)(136003)(346002)(396003)(451199015)(46966006)(40470700004)(498600001)(82310400005)(54906003)(5660300002)(7416002)(40460700003)(8936002)(26005)(9786002)(30864003)(40480700001)(110136005)(8676002)(36756003)(336012)(316002)(70206006)(4326008)(31696002)(2616005)(70586007)(47076005)(35950700001)(41300700001)(53546011)(83380400001)(86362001)(44832011)(7636003)(31686004)(82740400003)(2906002)(356005)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2022 18:10:47.7881 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f78410ac-ca61-4bdf-34e7-08daa245ef75 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.80.198]; Helo=[xir-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0019.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR02MB6781 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 On 9/27/2022 9:59 PM, Chautru, Nicolas wrote: > CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email. > > > Hi Ferruh, > > Thanks for your comment. > To be totally honest I don't yet see how your suggestion would be better, but I quite possibly miss something. I did not reply in line with your comments so that to try to be clearer and avoid spreading the argument to much. Ray and Bruce feel free to chime in as well. > > First to state the obvious: Nothing will change the fact that in case new enums are being added in DPDK, and if the application doesn't change, then user would not be able to interpret any such additional status/capability (backward compatible only feature parity and still ABI compliant) which is totally accepted as fine and up to the user, but the intention is at least not to have adverse effect even when they don’t update their code for such new features (notably in case they just use an older PMD not supporting such new features as a basic typical example in the ecosystem). I think we agree on that problematic. > > In term of history of not using MAX value for enum, I believe there is already well documented and you agree with the reasoning of why we had to move away from this [1]. Not just cosmetically where the max value is called an enum or a #define but to have application making hardcoded assumption on the possible maximum range for such enum notably when sizing array. The only caveat being that at the time, the community did spot the weakness but did not come to an agreement with regards to the best way to manage this moving forward. > > In case your point is purely cosmetic to rename the PADDED_MAX value from the enum to a #define (both public) I don't see how this would make thing clearer by obfuscating the fact it is genuinely a padded value and to have that value directly related to the enum structure. Also note that there is already an actual max value defined for these enums (but kept private on purpose) which is used by the lib/bbdev functions to restrict usage to what is actually supported in the given implementation (distinct from padded max value). > > Arguably the only concern I could understand in your message would be this one " my concern was if user assumes all values valid until PADDED_MAX and tries to iterate array until that value". > But really the fact that it is indeed a padded value implies fairly explicitly that we have padded the supported enums with placeholders enums not yet defined. That is fairly tautological! I cannot see how it could confuse anyone. That is indeed to avoid such confusion that we went on that direction to expose a public future-proof padded maximum value. > > Then looking at usage in practice: when integrating the bbdev api with higher level SW stacks (such as FlexRAN reference sw or 3rd party stacks) I don’t see how any of this theoretical concerns you raised would be relevant for any of these very cases (enqueue status, new capability etc...). The only genuine concern was sizing array based on MAX value being not ABI compliant. > I cannot think of any code in the application presently deployed or future that would then do what you are concerned about and cause an issue, and we definitely don’t do such things in any example for bbdev-test or in FlexRAN reference code provided to the ecosystem. The application would already have a default case when an enum being provided has no matching application, or more accurately in practice they would purely not look for these and hence these would be ignored seamlessly. > > Thanks again for the discussion. I wish this had happened earlier (we only discussed this with Ray and Bruce while you were still at Intel), let me know what you think. > It may be more generally good moving forward to come to a general agreement at your technical forum level to avoid confusion. When we discussed earlier we came to the conclusion that the DPDK community had well documented what not to do to avoid ABI breakage but not necessarily what are the best alternatives. > Hopefully such future discussion should not delay this serie to be applied but still let me know. > Hi Nic, I believe it is more clear/safe to convert to SIZE_MAX macros, although it is not a blocker. Anyway, I am not sure about the value of continuing this discussion, perhaps it is better to clarify the guidance for similar case with ABI maintainer and techboard, so it can proceed according to the decision. Thanks, ferruh > Thanks again > > [1] > * lib: will fix extending some enum/define breaking the ABI. There are multiple > samples in DPDK that enum/define terminated with a ``.*MAX.*`` value which is > used by iterators, and arrays holding these values are sized with this > ``.*MAX.*`` value. So extending this enum/define increases the ``.*MAX.*`` > value which increases the size of the array and depending on how/where the > array is used this may break the ABI. > ``RTE_ETH_FLOW_MAX`` is one sample of the mentioned case, adding a new flow > type will break the ABI because of ``flex_mask[RTE_ETH_FLOW_MAX]`` array > usage in following public struct hierarchy: > ``rte_eth_fdir_flex_conf -> rte_eth_fdir_conf -> rte_eth_conf (in the middle)``. > Need to identify this kind of usages and fix in 20.11, otherwise this blocks > us extending existing enum/define. > One solution can be using a fixed size array instead of ``.*MAX.*`` value. > > >> -----Original Message----- >> From: Chautru, Nicolas >> Sent: Saturday, September 24, 2022 9:35 AM >> To: 'Akhil Goyal' ; dev@dpdk.org; Maxime Coquelin >> ; ferruh.yigit@xilinx.com; Ray Kinsella >> >> Cc: 'Akhil Goyal' ; Chautru, Nicolas >> ; 'thomas@monjalon.net' >> ; 'Ray Kinsella' ; >> 'trix@redhat.com' ; Richardson, Bruce >> ; 'david.marchand@redhat.com' >> ; stephen@networkplumber.org; Zhang, >> Mingshan ; 'hemant.agrawal@nxp.com' >> >> Subject: RE: [EXT] [PATCH v7 6/7] bbdev: add queue related warning and >> status information >> >> Hi Ferruh, Ray, Akhil, >> >> >>>> -----Original Message----- >>>> From: Ferruh Yigit >>>> Sent: Friday, September 23, 2022 4:28 PM >>>> To: Akhil Goyal ; Nicolas Chautru >>>> ; dev@dpdk.org; thomas@monjalon.net; >>>> hemant.agrawal@nxp.com; Ray Kinsella >>>> Cc: maxime.coquelin@redhat.com; trix@redhat.com; >>>> bruce.richardson@intel.com; david.marchand@redhat.com; >>>> stephen@networkplumber.org; mingshan.zhang@intel.com >>>> Subject: Re: [EXT] [PATCH v7 6/7] bbdev: add queue related warning >>>> and status information >>>> >>>> On 9/21/2022 8:21 PM, Akhil Goyal wrote: >>>>>> diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h index >>>>>> ed528b8..b7ecf94 100644 >>>>>> --- a/lib/bbdev/rte_bbdev.h >>>>>> +++ b/lib/bbdev/rte_bbdev.h >>>>>> @@ -224,6 +224,19 @@ struct rte_bbdev_queue_conf { >>>>>> rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id); >>>>>> >>>>>> /** >>>>>> + * Flags indicate the reason why a previous enqueue may not have >>>>>> + * consumed all requested operations >>>>>> + * In case of multiple reasons the latter superdes a previous >>>>>> + one >>>>> Spell check - supersedes. >>>>> >>>>>> + */ >>>>>> +enum rte_bbdev_enqueue_status { >>>>>> + RTE_BBDEV_ENQ_STATUS_NONE, /**< Nothing to >> report */ >>>>>> + RTE_BBDEV_ENQ_STATUS_QUEUE_FULL, /**< Not >> enough room >>> in >>>>>> queue */ >>>>>> + RTE_BBDEV_ENQ_STATUS_RING_FULL, /**< Not >> enough room >>> in >>>>>> ring */ >>>>>> + RTE_BBDEV_ENQ_STATUS_INVALID_OP, /**< Operation >> was >>>>>> rejected as invalid */ >>>>>> + RTE_BBDEV_ENQ_STATUS_PADDED_MAX = 6, /**< >> Maximum enq >>>>>> status number including padding */ >>>>> >>>>> Are we ok to have this kind of padding across DPDK for all the >>>>> enums to avoid >>>> ABI issues? >>>>> @Ray, @Thomas: any thoughts? >>>>> >>>>> >>>> >>>> This kind of usage can prevent ABI tool warning, and can fix issues >>>> caused by application using returned enum as index [1]. >>>> >>>> But I think it is still problematic in case application tries to >>>> walk through till MAX, that is a common usage [2], user may miss that >> this >>>> is PADDED. >> >> Hi Ferruh, >> I don’t believe that case can happen here. Even if application was using an >> undefined index, the related functions are protected for that : >> See rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status) >> The reason for having padded max, is that the application may use this for >> array sizing if required without concern, we will never return a value that >> would exceeds this. >> In the other direction that is not a problem either since application (even it >> needs to store thigs in array) can used the padded version. >> Note that this discussed with Ray notably as a BKM. >> >>>> >>>> Overall exchanging enum values between library and application is >>>> possible trouble for binary compatibility. If application and >>>> library uses enum values independently, this is OK. >>>> Since enum cases not deleted but added in new version of the >>>> libraries, more problematic usage is passing enum value from library >>>> to application, and bbdev seems doing this in a few places. >> >> I don’t see a case where it is a genuine issue. >> An enum is being reported from library, even if due to future enum insertion >> there is a new enum reported between 2 ABI changes, that would still be >> within bounds. >> >>>> >>>> With current approach PADDED_MAX usage is more like #define usage, >>>> it is not dynamic but a hardcoded value that is used as array size value. >>>> >>>> Not providing a MAX enum case restricts the application, application >>>> can't use it as size of an array or can't use it walk through >>>> related array, usage reduces to if/switch comparisons. >> >> It can use the padded_max to size application array. Even if application was >> walking through these, there is no adverse effect. >> >>>> Although this may not be most convenient for application, it can >>>> provide safer usage for binary compatibility. >>>> >>>> >>>> @Nic, what do you think provide these PADDED_MAX as #define >> SIZE_MAX >>>> macros? >>>> With this application still can allocate a relevant array with >>>> correct size, or know the size of library provided array, but can't >>>> use it to iterate on these arrays. >>>> >> >> That would be back to how it was done before which made things very >> inflexible and prevented to change these enums between ABIs versions. >> >> This change was highlighted and discussed many months ago and flagged in >> the deprecation notice in previous release for that very reason. >> >> Ray, can you please chime in since you know best. >> >> Thanks Ferruh, >> Nic >> >> >> >>>> >>>> >>>> >>>> [1] >>>> --------------- library old version ---------------------------- enum >>>> type { >>>> CASE_A, >>>> CASE_B, >>>> CASE_MAX, >>>> }; >>>> >>>> struct data { >>>> enum type type; >>>> union { >>>> type specific struct >>>> }; >>>> }; >>>> >>>> int api_get(struct data *data); >>>> >>>> >>>> --------------- application ---------------------------- >>>> >>>> struct data data; >>>> int array[CASE_MAX]; >>>> >>>> api_get(&data); >>>> foo(array[data.type]); >>>> >>>> >>>> --------------- library NEW version ---------------------------- >>>> >>>> enum type { >>>> CASE_A, >>>> CASE_B, >>>> CASE_C, >>>> CASE_D, >>>> CASE_MAX, >>>> }; >>>> >>>> >>>> When application is NOT recompiled but using new version of the >>>> library, values 'CASE_C' & 'CASE_D' will crash application, so this >>>> will create a ABI compatibility issue. >>>> >>>> Note: In the past I have claimed that application should check >>>> 'CASE_MAX', instead of using returned value directly as index, but >>>> this is refused by argument that we can't control the application and >>>> should play safe assuming application behaves wrong. >>>> >>>> >>>> >>>> >>>> [2] >>>> >>>> --------------- library ---------------------------- >>>> >>>> enum type { >>>> CASE_NONE, >>>> CASE_A, >>>> CASE_B, >>>> CASE_C, >>>> CASE_D, >>>> CASE_PADDED_MAX = 666, >>>> }; >>>> >>>> --------------- application ---------------------------- >>>> >>>> for (int i = CASE_NONE; i < CASE_PADDED_MAX; i++) >>>> fragile_init(i); >>>> >>>> --- >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >