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 EB3AF42CAC; Tue, 13 Jun 2023 22:00:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9158F41138; Tue, 13 Jun 2023 22:00:43 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id BDAFC40ED6 for ; Tue, 13 Jun 2023 22:00:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686686441; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nF97goLjQZXnAdzW9TOuYjRtA6bwVA74dhIKFGmoB38=; b=QGxbGjh69tNMFl8t59UBUvSjaS2oBkGAELJYm0Hz/WosgqmXV+b2/dNBWpMWc20JCqADre rIrQXFl+vvv42Y8u4GAGQsTiVzTcNUn5mmr5LURm7mAX5hpGk2IElS+InVEa52tHhX5KKG 1gctqFisfj3+Bz7kgnXK9BNY1mj25lM= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-175-EEL5e0IlMwexXJsQ7c1IQQ-1; Tue, 13 Jun 2023 16:00:34 -0400 X-MC-Unique: EEL5e0IlMwexXJsQ7c1IQQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DB15A381D4C4; Tue, 13 Jun 2023 20:00:28 +0000 (UTC) Received: from [10.39.208.37] (unknown [10.39.208.37]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 58E7E140E952; Tue, 13 Jun 2023 20:00:27 +0000 (UTC) Message-ID: <8f201884-8a40-468e-c02a-52bc5e646024@redhat.com> Date: Tue, 13 Jun 2023 22:00:25 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 To: "Chautru, Nicolas" , David Marchand Cc: Stephen Hemminger , "dev@dpdk.org" , "Rix, Tom" , "hemant.agrawal@nxp.com" , "Vargas, Hernan" References: <20230526021132.41413-1-nicolas.chautru@intel.com> <20230526021132.41413-2-nicolas.chautru@intel.com> <20230525204722.73635324@hermes.local> <874c2179-6dfd-caba-0a8a-75137cb1a418@redhat.com> <30fbed4d-9f04-9a44-d77d-156e7a6257f5@redhat.com> From: Maxime Coquelin Subject: Re: [PATCH v1 1/1] doc: announce change in bbdev api related to operation extension In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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, On 6/13/23 19:16, Chautru, Nicolas wrote: > Hi Maxime, > >> -----Original Message----- >> From: Maxime Coquelin > >> >> On 6/12/23 22:53, Chautru, Nicolas wrote: >>> Hi Maxime, David, >>> >>>> -----Original Message----- >>>> From: Maxime Coquelin >>>> >>>> On 6/6/23 23:01, Chautru, Nicolas wrote: >>>>> Hi David, >>>>> >>>>>> -----Original Message----- >>>>>> From: David Marchand > >> On Mon, Jun >> 5, >>>>>> 2023 at 10:08 PM Chautru, Nicolas >>>>>> wrote: >>>>>>> Wrt the MLD functions: these are new into the related serie but >>>>>>> still the >>>>>> break the ABI since the struct rte_bbdev includes these functions >>>>>> hence causing offset changes. >>>>>>> >>>>>>> Should I then just rephrase as: >>>>>>> >>>>>>> +* bbdev: Will extend the API to support the new operation type >>>>>>> +``RTE_BBDEV_OP_MLDTS`` as per >>>>>>> + this `v1 >>>>>>> +`. >>>>>>> This >>>>>>> + will notably introduce + new symbols for >>>>>>> ``rte_bbdev_dequeue_mldts_ops``, +``rte_bbdev_enqueue_mldts_ops`` >>>>>>> into the stuct rte_bbdev. >>>>>> >>>>>> I don't think we need this deprecation notice. >>>>>> >>>>>> >>>>>> Do you need to expose those new mldts ops in rte_bbdev? >>>>>> Can't they go to dev_ops? >>>>>> If you can't, at least moving those new ops at the end of the >>>>>> structure would avoid the breakage on rte_bbdev. >>>>> >>>>> It would probably be best to move all these ops at the end of the >>>>> structure >>>> (ie. keep them together). >>>>> In that case the deprecation notice would call out that the >>>>> rte_bbdev >>>> structure content is more generally modified. Probably best for the >>>> longer run. >>>>> David, Maxime, ok with that option? >>>>> >>>>> struct __rte_cache_aligned rte_bbdev { >>>>> rte_bbdev_enqueue_enc_ops_t enqueue_enc_ops; >>>>> rte_bbdev_enqueue_dec_ops_t enqueue_dec_ops; >>>>> rte_bbdev_dequeue_enc_ops_t dequeue_enc_ops; >>>>> rte_bbdev_dequeue_dec_ops_t dequeue_dec_ops; >>>>> rte_bbdev_enqueue_enc_ops_t enqueue_ldpc_enc_ops; >>>>> rte_bbdev_enqueue_dec_ops_t enqueue_ldpc_dec_ops; >>>>> rte_bbdev_dequeue_enc_ops_t dequeue_ldpc_enc_ops; >>>>> rte_bbdev_dequeue_dec_ops_t dequeue_ldpc_dec_ops; >>>>> rte_bbdev_enqueue_fft_ops_t enqueue_fft_ops; >>>>> rte_bbdev_dequeue_fft_ops_t dequeue_fft_ops; >>>>> const struct rte_bbdev_ops *dev_ops; >>>>> struct rte_bbdev_data *data; >>>>> enum rte_bbdev_state state; >>>>> struct rte_device *device; >>>>> struct rte_bbdev_cb_list list_cbs; >>>>> struct rte_intr_handle *intr_handle; >>>>> }; >>>> >>>> The best thing, as suggested by David, would be to move all the ops >>>> out of struct rte_bbdev, as these should not be visible to the application. >>> >>> That would be quite disruptive across all PMDs and possible perf impact to >> validate. I don’t think this is anywhere realistic to consider such a change in >> 23.11. >>> I believe moving these function at the end of the structure is a good >> compromise to avoid future breakage of rte_bbdev structure with almost >> seamless impact (purely a ABI break when moving into 23.11 which is not >> avoidable. Retrospectively we should have done that in 22.11 really. >> >> If we are going to break the ABI, better to do the right rework directly. Otherwise >> we'll end-up breaking it again next year. > > With the suggested change, this will not break ABI next year. Any future functions are added at the end of the structure anyway. I'm not so sure, it depends if adding a new field at the end cross a cacheline boundary or not: /* * Global array of all devices. This is not static because it's used by the * inline enqueue and dequeue functions */ struct rte_bbdev rte_bbdev_devices[RTE_BBDEV_MAX_DEVS]; If the older inlined functions used by the application retrieve the dev pointer from the array directly (they do) and added new fields in new version cross a cacheline, then there will be a misalignement between the new lib version and the application using the older inlined functions. ABI-wise, this is not really future proof. > >> >> IMHO, moving these ops should be quite trivial and not much work. >> >> Otherwise, if we just placed the rte_bbdev_dequeue_mldts_ops and >> rte_bbdev_enqueue_mldts_ops at the bottom of struct rte_bbdev, it may not >> break the ABI, but that's a bit fragile: >> - rte_bbdev_devices[] is not static, but is placed in the BSS section so >> should be OK >> - struct rte_bbdev is cache-aligned, so it may work if adding these two >> ops do not overlap a cacheline which depends on the CPU architecture. > > If you prefer to add the only 2 new functions at the end of the structure that is okay. I believe it would be cleaner to move all these enqueue/dequeue funs down together without drawback I can think of. Let me know. Adding the new ones at the end is not future proof, but at least it does not break ABI just for cosmetic reasons (that's a big drawback IMHO). I just checked using pahole: struct rte_bbdev { rte_bbdev_enqueue_enc_ops_t enqueue_enc_ops; /* 0 8 */ rte_bbdev_enqueue_dec_ops_t enqueue_dec_ops; /* 8 8 */ rte_bbdev_dequeue_enc_ops_t dequeue_enc_ops; /* 16 8 */ rte_bbdev_dequeue_dec_ops_t dequeue_dec_ops; /* 24 8 */ rte_bbdev_enqueue_enc_ops_t enqueue_ldpc_enc_ops; /* 32 8 */ rte_bbdev_enqueue_dec_ops_t enqueue_ldpc_dec_ops; /* 40 8 */ rte_bbdev_dequeue_enc_ops_t dequeue_ldpc_enc_ops; /* 48 8 */ rte_bbdev_dequeue_dec_ops_t dequeue_ldpc_dec_ops; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ rte_bbdev_enqueue_fft_ops_t enqueue_fft_ops; /* 64 8 */ rte_bbdev_dequeue_fft_ops_t dequeue_fft_ops; /* 72 8 */ const struct rte_bbdev_ops * dev_ops; /* 80 8 */ struct rte_bbdev_data * data; /* 88 8 */ enum rte_bbdev_state state; /* 96 4 */ /* XXX 4 bytes hole, try to pack */ struct rte_device * device; /* 104 8 */ struct rte_bbdev_cb_list list_cbs; /* 112 16 */ /* --- cacheline 2 boundary (128 bytes) --- */ struct rte_intr_handle * intr_handle; /* 128 8 */ /* size: 192, cachelines: 3, members: 16 */ /* sum members: 132, holes: 1, sum holes: 4 */ /* padding: 56 */ } __attribute__((__aligned__(64))); We're lucky on x86, we still have 56 bytes, so we can add 7 new ops at the end before breaking the ABI if I'm not mistaken. I checked the other architecture, and it seems we don't support any with 32B cacheline size so we're good for a while. Maxime > >> >> Maxime >> >>> What do you think Maxime, David? Based on this I can adjust the change for >> 23.11 and update slightly the deprecation notice accordingly. >>> >>> Thanks >>> Nic >>> >