From: fengchengwen <fengchengwen@huawei.com>
To: "Tyler Retzlaff" <roretzla@linux.microsoft.com>,
"Morten Brørup" <mb@smartsharesystems.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Ferruh Yigit <ferruh.yigit@amd.com>, <dev@dpdk.org>,
Dengdui Huang <huangdengdui@huawei.com>
Subject: Re: Strict aliasing problem with rte_eth_linkstatus_set()
Date: Thu, 11 Apr 2024 11:20:01 +0800 [thread overview]
Message-ID: <84929ae8-54cc-43e7-b37e-f38a8963b259@huawei.com> (raw)
In-Reply-To: <20240410195834.GA25134@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net>
Hi All,
On 2024/4/11 3:58, Tyler Retzlaff wrote:
> On Wed, Apr 10, 2024 at 07:54:27PM +0200, Morten Brørup wrote:
>>> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
>>> Sent: Wednesday, 10 April 2024 17.27
>>>
>>> On Wed, 10 Apr 2024 17:33:53 +0800
>>> fengchengwen <fengchengwen@huawei.com> wrote:
>>>
>>>> Last: We think there are two ways to solve this problem.
>>>> 1. Add the compilation option '-fno-strict-aliasing' for hold DPDK
>>> project.
>>>> 2. Use union to avoid such aliasing in rte_eth_linkstatus_set (please
>>> see above).
>>>> PS: We prefer first way.
>>>>
>>>
>>> Please send a patch to replace alias with union.
>>
>> +1
>>
>> Fixing this specific bug would be good.
OK for this,
and I already send a bugfix which use union.
Thanks
>>
>> Instinctively, I think we should build with -fno-strict-aliasing, so the compiler doesn't make the same mistake with similar code elsewhere in DPDK. I fear there is more than this instance.
>> I also wonder if -Wstrict-aliasing could help us instead, if we don't want -fno-strict-aliasing.
>
> agree, union is the correct way to get defined behavior. there are
> valuable optimizatons that the compiler can make with strict aliasing
> enabled so -Wstrict-aliasing is a good suggestion as opposed to
> disabling it.
>
> also the union won't break the abi if introduced correctly.
> .
>
next prev parent reply other threads:[~2024-04-11 3:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-10 9:33 fengchengwen
2024-04-10 10:30 ` Morten Brørup
2024-04-10 15:57 ` Ferruh Yigit
2024-04-11 2:03 ` fengchengwen
2024-04-10 15:27 ` Stephen Hemminger
2024-04-10 15:58 ` Ferruh Yigit
2024-04-10 17:54 ` Morten Brørup
2024-04-10 19:58 ` Tyler Retzlaff
2024-04-11 3:20 ` fengchengwen [this message]
2024-04-10 21:18 ` Stephen Hemminger
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=84929ae8-54cc-43e7-b37e-f38a8963b259@huawei.com \
--to=fengchengwen@huawei.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=huangdengdui@huawei.com \
--cc=mb@smartsharesystems.com \
--cc=roretzla@linux.microsoft.com \
--cc=stephen@networkplumber.org \
/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).