DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@redhat.com>
To: Ferruh Yigit <ferruh.yigit@amd.com>
Cc: Akhil Goyal <gakhil@marvell.com>,
	 dev@dpdk.org,  thomas@monjalon.net, david.marchand@redhat.com,
	 hemant.agrawal@nxp.com,  anoobj@marvell.com,
	pablo.de.lara.guarch@intel.com,  fiona.trahe@intel.com,
	declan.doherty@intel.com,  matan@nvidia.com,  g.singh@nxp.com,
	fanzhang.oss@gmail.com,  jianjay.zhou@huawei.com,
	 asomalap@amd.com, ruifeng.wang@arm.com,
	 konstantin.v.ananyev@yandex.ru, radu.nicolau@intel.com,
	 ajit.khaparde@broadcom.com, rnagadheeraj@marvell.com,
	 mdr@ashroe.eu
Subject: Re: [PATCH] [RFC] cryptodev: replace LIST_END enumerators with APIs
Date: Mon, 28 Oct 2024 11:12:19 +0100	[thread overview]
Message-ID: <87v7xc35a4.fsf@redhat.com> (raw)
In-Reply-To: <39e9241d-d6d5-4e94-a3cb-506af805880d@amd.com> (Ferruh Yigit's message of "Thu, 10 Oct 2024 01:35:34 +0100")

Hello,

Ferruh Yigit <ferruh.yigit@amd.com> writes:

[...]

>> This change cause the value of the the FOOD_END enumerator to increase.
>> And that increase might be problematic.  At the moment, for it being
>> problematic or not has to be the result of a careful review.
>> 
>
> As you said, FOOD_END value change can be sometimes problematic, but
> sometimes it is not.
> This what I referred as limitation that tool is not reporting only
> problematic case, but require human review.

Oh, I see. Thank you for clarifying.

> (btw, this is a very useful tool, I don't want to sound like negative
> about it, only want to address this recurring subject in dpdk.)

No problem, I never assume you mean anything negative :-)

[...]


>> So, by default, abidiff will complain by saying that the value of
>> FOO_END was changed.
>> 
>> But you, as a community of practice, can decide that this kind of change
>> to the value of the last enumerator is not a problematic change, after
>> careful review of your code and practice.  You thus can specify that
>> the tool using a suppression specification which has the following
>> syntax:
>> 
>>     [suppress_type]
>>       type_kind = enum
>>       changed_enumerators = FOO_END, ANOTHER_ENUM_END, AND_ANOTHER_ENUM_END
>> 
>> or, alternatively, you can specify the enumerators you want to suppress
>> the changes for as a list of regular expressions:
>> 
>>     [suppress_type]
>>       type_kind = enum
>>       changed_enumerators_regexp = .*_END$, .*_LAST$, .*_LIST_END$
>> 
>> Wouldn't that be enough to address your use case here (honest question)?
>> 
>
> We are already using suppress feature in dpdk.
>
> But difficulty is to decide if END (MAX) enum value change warning is an
> actual ABI break or not.
>
> When tool gives warning, tendency is to just make warning go away,
> mostly by removing END (MAX) enum without really analyzing if it is a
> real ABI break.

I see.

[...]

>>> [1] It would be better if tool gives END (MAX) enum value warnings only
>>> if it is exchanged in an API, but not sure if this can be possible to
>>> detect.
>> 
>> 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.
>> 
>
> I see the problem.
>
> Is this the main reason that changing FOO_END value reported as warning?

Yes, it is because of this class of issues.

Actually if ANY enumerator value is changed, that is actually an ABI
change.  And that ABI change is either compatible or not.

> If we forbid this kind of usage of the FOO_END, can we ignore this
> warning safely?

I would think so.


But then, you'd have to also forbid the use of all enumerators,
basically.  I am not sure that would be practical.

Rather I would tend to lean toward reviewing the use of enumerators, on
a case by case basis, using tools like 'grep' and whatnot.

What I would advise to forbid is the use of complicated macros or
constructs that makes the review of the use of enumerators
non-practical.  You should be able to grep "FOO_END" and see where it's
used in the source code.  Reviewing that shouldn't take more than a few
minutes whenever a tool warns about the change of its value.

>
>> 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.
>> 
>> [...]
>> 
>> Cheers,
>> 
>

-- 
		Dodji


  reply	other threads:[~2024-10-28 10:12 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
2024-10-10  0:35     ` Ferruh Yigit
2024-10-28 10:12       ` Dodji Seketeli [this message]
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=87v7xc35a4.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).