DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@redhat.com>
To: Akhil Goyal <gakhil@marvell.com>
Cc: Dodji Seketeli <dodji@redhat.com>,
	 Ferruh Yigit <ferruh.yigit@amd.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	 "thomas@monjalon.net" <thomas@monjalon.net>,
	 "david.marchand@redhat.com" <david.marchand@redhat.com>,
	 "hemant.agrawal@nxp.com" <hemant.agrawal@nxp.com>,
	 Anoob Joseph <anoobj@marvell.com>,
	"pablo.de.lara.guarch@intel.com" <pablo.de.lara.guarch@intel.com>,
	"fiona.trahe@intel.com" <fiona.trahe@intel.com>,
	"declan.doherty@intel.com" <declan.doherty@intel.com>,
	"matan@nvidia.com" <matan@nvidia.com>,
	 "g.singh@nxp.com" <g.singh@nxp.com>,
	 "fanzhang.oss@gmail.com" <fanzhang.oss@gmail.com>,
	"jianjay.zhou@huawei.com" <jianjay.zhou@huawei.com>,
	 "asomalap@amd.com" <asomalap@amd.com>,
	 "ruifeng.wang@arm.com" <ruifeng.wang@arm.com>,
	"konstantin.v.ananyev@yandex.ru" <konstantin.v.ananyev@yandex.ru>,
	"radu.nicolau@intel.com" <radu.nicolau@intel.com>,
	"ajit.khaparde@broadcom.com" <ajit.khaparde@broadcom.com>,
	 Nagadheeraj Rottela <rnagadheeraj@marvell.com>,
	 "mdr@ashroe.eu" <mdr@ashroe.eu>
Subject: Re: [EXTERNAL] Re: [PATCH] [RFC] cryptodev: replace LIST_END enumerators with APIs
Date: Mon, 28 Oct 2024 11:55:18 +0100	[thread overview]
Message-ID: <87r08033ah.fsf@redhat.com> (raw)
In-Reply-To: <CO6PR18MB448457699F3B656AFB80A081D8722@CO6PR18MB4484.namprd18.prod.outlook.com> (Akhil Goyal's message of "Fri, 4 Oct 2024 17:45:23 +0000")

Hello,

Akhil Goyal <gakhil@marvell.com> writes:

[...]


>> I believe that if you want to know if an enumerator value is *USED* by a
>> type (which I believe is at the root of what you are alluding to), then
>> you would need a static analysis tool that works at the source level.
>> Or, you need a human review of the code once the binary analysis tool
>> told you that that value of the enumerator changed.
>> 
>> Why ? please let me give you an example:
>> 
>>     enum foo_enum
>>     {
>>      FOO_FIRST,
>>      FOO_SECOND,
>>      FOO_END
>>     };
>> 
>>     int array[FOO_END];
>> 
>> Once this is compiled into binary, what libabigail is going to see by
>> analyzing the binary is that 'array' is an array of 2 integers.  The
>> information about the size of the array being initially an enumerator
>> value is lost.  To detect that, you need source level analysis.
>> 
>> But then, by reviewing the code, this is a construct that you can spot
>> and allow or forbid, depending on your goals as a project.
>> 
> In the above example if in newer library a FOO_THIRD is added.
> FOO_END value will change and will cause ABI break for change in existing value.
> But if we replace it with inline function to get the list_end and use it in array like below.
> So if FOO_THIRD is added, we will also update foo_enum_list_end() function to return (FOO_THIRD+1)
>
>      enum foo_enum
>      {
>       FOO_FIRST,
>       FOO_SECOND,
>      };
>      static inline int foo_enum_list_end()
>      {
>             return FOO_SECOND + 1;
>      }
>      int array[foo_enum_list_end()];
>
> Will this cause an ABI break if we add this array in application or in library?

I think this (inline function) construct is essentially the same as just
adding a FOO_END enumerator after FOO_SECOND.  Using either
foo_enum_list_end() or FOO_END result in having the value '2' in the
application using the library to get FOO_END or foo_enum_list_end().

Newer versions of the library being linked to the application won't
change that value '2', regardless of the newer values of FOO_END or
foo_enum_list_end().

So, adding a FOO_THIRD right after FOO_END, induces and ABI change.

This change being "breaking" (incompatible) or not, really depends on
what the application expects, I would say.  Sorry if that looks "vague",
but this whole concept is quite blurry.

For instance, if you add FOO_THIRD after FOO_SECOND in the newer version
of the library and the application still gets the value '2' rather than
getting the value '3', and that value is actually multiplied by "two
trillions" in the application to get the value of the dividend to be
payed to investors, then, then that's a very big error induced by that
change.  That might be considered by the application as a "breaking" ABI
change and you might get a call or two from the CEO of an S&P500 company
that uses the library.

Other applications might consider that "off-by-one" error not being
problematic at all and thus might consider it not "breaking".

Note that REMOVING an enumerator however is always considered an
incompatible (breaking) ABI change.

Adding an enumerator however has this annoying "grey topic" (not black or
white) property that I am not sure how to address at this point.

Cheers,

-- 
		Dodji


  reply	other threads:[~2024-10-28 10:55 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-05 10:14 Akhil Goyal
2024-09-05 15:09 ` Morten Brørup
2024-09-05 15:26   ` Kusztal, ArkadiuszX
2024-09-06  6:32   ` fengchengwen
2024-09-06  7:45     ` [EXTERNAL] " Akhil Goyal
2024-10-04  3:56       ` Ferruh Yigit
2024-09-06  7:54     ` Morten Brørup
2024-09-23 20:41       ` Akhil Goyal
2024-10-03  7:00         ` Akhil Goyal
2024-10-06 11:10           ` Morten Brørup
2024-10-09 11:21             ` Akhil Goyal
2024-10-04  4:00         ` Ferruh Yigit
2024-10-04 17:26           ` [EXTERNAL] " Akhil Goyal
2024-10-04  3:54 ` Ferruh Yigit
2024-10-04  7:04   ` David Marchand
2024-10-04 17:27     ` [EXTERNAL] " Akhil Goyal
2024-10-10  0:49     ` Ferruh Yigit
2024-10-10  6:18       ` [EXTERNAL] " Akhil Goyal
2024-10-28 11:15         ` Dodji Seketeli
2024-10-04  9:38   ` Dodji Seketeli
2024-10-04 17:45     ` [EXTERNAL] " Akhil Goyal
2024-10-28 10:55       ` Dodji Seketeli [this message]
2024-10-10  0:35     ` Ferruh Yigit
2024-10-28 10:12       ` Dodji Seketeli
2024-10-09 11:24 ` [PATCH] cryptodev: remove unnecessary list end Akhil Goyal
2024-10-09 12:52   ` Morten Brørup
2024-10-09 20:38     ` Akhil Goyal
2024-10-09 14:06   ` Hemant Agrawal
2024-10-10  0:51   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r08033ah.fsf@redhat.com \
    --to=dodji@redhat.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=anoobj@marvell.com \
    --cc=asomalap@amd.com \
    --cc=david.marchand@redhat.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=fanzhang.oss@gmail.com \
    --cc=ferruh.yigit@amd.com \
    --cc=fiona.trahe@intel.com \
    --cc=g.singh@nxp.com \
    --cc=gakhil@marvell.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=jianjay.zhou@huawei.com \
    --cc=konstantin.v.ananyev@yandex.ru \
    --cc=matan@nvidia.com \
    --cc=mdr@ashroe.eu \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=radu.nicolau@intel.com \
    --cc=rnagadheeraj@marvell.com \
    --cc=ruifeng.wang@arm.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).