* [dpdk-stable] [PATCH] net/thunderx: fix build with gcc optimization on
@ 2018-06-21 18:14 Ferruh Yigit
2018-06-24 12:17 ` Jerin Jacob
0 siblings, 1 reply; 5+ messages in thread
From: Ferruh Yigit @ 2018-06-21 18:14 UTC (permalink / raw)
To: Jerin Jacob, Maciej Czekaj; +Cc: dev, Ferruh Yigit, stable
build error gcc version 6.3.1 20161221 (Red Hat 6.3.1-1),
with EXTRA_CFLAGS="-O3":
.../drivers/net/thunderx/nicvf_ethdev.c:907:9:
error: ‘txq’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
if (txq->pool_free == nicvf_single_pool_free_xmited_buffers)
~~~^~~~~~~~~~~
.../drivers/net/thunderx/nicvf_ethdev.c:886:20:
note: ‘txq’ was declared here
struct nicvf_txq *txq;
^~~
Same error on function 'nicvf_eth_dev_init' and 'nicvf_dev_start', it
seems 'nicvf_set_tx_function' inlined when optimization enabled.
Initialize the txq and add NULL check before using it to fix.
Fixes: 7413feee662d ("net/thunderx: add device start/stop and close")
Cc: stable@dpdk.org
Reported-by: Richard Walsh <richard.walsh@intel.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Btw, no compiler optimization enabled, only nicvf_rxtx.c has -Ofast,
is this intentional?
---
drivers/net/thunderx/nicvf_ethdev.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 99fcd516b..4ab1bfbe6 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -883,7 +883,7 @@ nicvf_dev_tx_queue_release(void *sq)
static void
nicvf_set_tx_function(struct rte_eth_dev *dev)
{
- struct nicvf_txq *txq;
+ struct nicvf_txq *txq = NULL;
size_t i;
bool multiseg = false;
@@ -904,6 +904,9 @@ nicvf_set_tx_function(struct rte_eth_dev *dev)
dev->tx_pkt_burst = nicvf_xmit_pkts;
}
+ if (!txq)
+ return;
+
if (txq->pool_free == nicvf_single_pool_free_xmited_buffers)
PMD_DRV_LOG(DEBUG, "Using single-mempool tx free method");
else
--
2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-stable] [PATCH] net/thunderx: fix build with gcc optimization on
2018-06-21 18:14 [dpdk-stable] [PATCH] net/thunderx: fix build with gcc optimization on Ferruh Yigit
@ 2018-06-24 12:17 ` Jerin Jacob
2018-06-26 9:17 ` [dpdk-stable] [dpdk-dev] " Ferruh Yigit
2018-06-26 17:10 ` Ferruh Yigit
0 siblings, 2 replies; 5+ messages in thread
From: Jerin Jacob @ 2018-06-24 12:17 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: Maciej Czekaj, dev, stable
-----Original Message-----
> Date: Thu, 21 Jun 2018 19:14:50 +0100
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> To: Jerin Jacob <jerin.jacob@caviumnetworks.com>, Maciej Czekaj
> <maciej.czekaj@caviumnetworks.com>
> CC: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>, stable@dpdk.org
> Subject: [PATCH] net/thunderx: fix build with gcc optimization on
> X-Mailer: git-send-email 2.17.1
>
>
> build error gcc version 6.3.1 20161221 (Red Hat 6.3.1-1),
> with EXTRA_CFLAGS="-O3":
>
> .../drivers/net/thunderx/nicvf_ethdev.c:907:9:
> error: ‘txq’ may be used uninitialized in this function
> [-Werror=maybe-uninitialized]
> if (txq->pool_free == nicvf_single_pool_free_xmited_buffers)
> ~~~^~~~~~~~~~~
> .../drivers/net/thunderx/nicvf_ethdev.c:886:20:
> note: ‘txq’ was declared here
> struct nicvf_txq *txq;
> ^~~
>
> Same error on function 'nicvf_eth_dev_init' and 'nicvf_dev_start', it
> seems 'nicvf_set_tx_function' inlined when optimization enabled.
>
> Initialize the txq and add NULL check before using it to fix.
>
> Fixes: 7413feee662d ("net/thunderx: add device start/stop and close")
> Cc: stable@dpdk.org
>
> Reported-by: Richard Walsh <richard.walsh@intel.com>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> ---
>
> Btw, no compiler optimization enabled, only nicvf_rxtx.c has -Ofast,
> is this intentional?
Yes. At least in our setup, -Ofast turns out to be super set of -O3.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] net/thunderx: fix build with gcc optimization on
2018-06-24 12:17 ` Jerin Jacob
@ 2018-06-26 9:17 ` Ferruh Yigit
2018-06-26 9:52 ` Jerin Jacob
2018-06-26 17:10 ` Ferruh Yigit
1 sibling, 1 reply; 5+ messages in thread
From: Ferruh Yigit @ 2018-06-26 9:17 UTC (permalink / raw)
To: Jerin Jacob; +Cc: Maciej Czekaj, dev, stable
On 6/24/2018 1:17 PM, Jerin Jacob wrote:
> -----Original Message-----
>> Date: Thu, 21 Jun 2018 19:14:50 +0100
>> From: Ferruh Yigit <ferruh.yigit@intel.com>
>> To: Jerin Jacob <jerin.jacob@caviumnetworks.com>, Maciej Czekaj
>> <maciej.czekaj@caviumnetworks.com>
>> CC: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>, stable@dpdk.org
>> Subject: [PATCH] net/thunderx: fix build with gcc optimization on
>> X-Mailer: git-send-email 2.17.1
>>
>>
>> build error gcc version 6.3.1 20161221 (Red Hat 6.3.1-1),
>> with EXTRA_CFLAGS="-O3":
>>
>> .../drivers/net/thunderx/nicvf_ethdev.c:907:9:
>> error: ‘txq’ may be used uninitialized in this function
>> [-Werror=maybe-uninitialized]
>> if (txq->pool_free == nicvf_single_pool_free_xmited_buffers)
>> ~~~^~~~~~~~~~~
>> .../drivers/net/thunderx/nicvf_ethdev.c:886:20:
>> note: ‘txq’ was declared here
>> struct nicvf_txq *txq;
>> ^~~
>>
>> Same error on function 'nicvf_eth_dev_init' and 'nicvf_dev_start', it
>> seems 'nicvf_set_tx_function' inlined when optimization enabled.
>>
>> Initialize the txq and add NULL check before using it to fix.
>>
>> Fixes: 7413feee662d ("net/thunderx: add device start/stop and close")
>> Cc: stable@dpdk.org
>>
>> Reported-by: Richard Walsh <richard.walsh@intel.com>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>
> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
>
>> ---
>>
>> Btw, no compiler optimization enabled, only nicvf_rxtx.c has -Ofast,
>> is this intentional?
>
> Yes. At least in our setup, -Ofast turns out to be super set of -O3.
That is what gcc documents about -Ofast, but again it is only for single
nicvf_rxtx.c file. The problem seen with -O3 case with other file.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] net/thunderx: fix build with gcc optimization on
2018-06-26 9:17 ` [dpdk-stable] [dpdk-dev] " Ferruh Yigit
@ 2018-06-26 9:52 ` Jerin Jacob
0 siblings, 0 replies; 5+ messages in thread
From: Jerin Jacob @ 2018-06-26 9:52 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: Maciej Czekaj, dev, stable
-----Original Message-----
> Date: Tue, 26 Jun 2018 10:17:14 +0100
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> CC: Maciej Czekaj <maciej.czekaj@caviumnetworks.com>, dev@dpdk.org,
> stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] net/thunderx: fix build with gcc
> optimization on
> User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
> Thunderbird/52.8.0
>
>
> On 6/24/2018 1:17 PM, Jerin Jacob wrote:
> > -----Original Message-----
> >> Date: Thu, 21 Jun 2018 19:14:50 +0100
> >> From: Ferruh Yigit <ferruh.yigit@intel.com>
> >> To: Jerin Jacob <jerin.jacob@caviumnetworks.com>, Maciej Czekaj
> >> <maciej.czekaj@caviumnetworks.com>
> >> CC: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>, stable@dpdk.org
> >> Subject: [PATCH] net/thunderx: fix build with gcc optimization on
> >> X-Mailer: git-send-email 2.17.1
> >>
> >>
> >> build error gcc version 6.3.1 20161221 (Red Hat 6.3.1-1),
> >> with EXTRA_CFLAGS="-O3":
> >>
> >> .../drivers/net/thunderx/nicvf_ethdev.c:907:9:
> >> error: ‘txq’ may be used uninitialized in this function
> >> [-Werror=maybe-uninitialized]
> >> if (txq->pool_free == nicvf_single_pool_free_xmited_buffers)
> >> ~~~^~~~~~~~~~~
> >> .../drivers/net/thunderx/nicvf_ethdev.c:886:20:
> >> note: ‘txq’ was declared here
> >> struct nicvf_txq *txq;
> >> ^~~
> >>
> >> Same error on function 'nicvf_eth_dev_init' and 'nicvf_dev_start', it
> >> seems 'nicvf_set_tx_function' inlined when optimization enabled.
> >>
> >> Initialize the txq and add NULL check before using it to fix.
> >>
> >> Fixes: 7413feee662d ("net/thunderx: add device start/stop and close")
> >> Cc: stable@dpdk.org
> >>
> >> Reported-by: Richard Walsh <richard.walsh@intel.com>
> >> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> >
> > Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> >
> >> ---
> >>
> >> Btw, no compiler optimization enabled, only nicvf_rxtx.c has -Ofast,
> >> is this intentional?
> >
> > Yes. At least in our setup, -Ofast turns out to be super set of -O3.
>
> That is what gcc documents about -Ofast, but again it is only for single
> nicvf_rxtx.c file. The problem seen with -O3 case with other file.
OK. For other files, we intentionally kept non -03 as it is in slow path.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] net/thunderx: fix build with gcc optimization on
2018-06-24 12:17 ` Jerin Jacob
2018-06-26 9:17 ` [dpdk-stable] [dpdk-dev] " Ferruh Yigit
@ 2018-06-26 17:10 ` Ferruh Yigit
1 sibling, 0 replies; 5+ messages in thread
From: Ferruh Yigit @ 2018-06-26 17:10 UTC (permalink / raw)
To: Jerin Jacob; +Cc: Maciej Czekaj, dev, stable
On 6/24/2018 1:17 PM, Jerin Jacob wrote:
> -----Original Message-----
>> Date: Thu, 21 Jun 2018 19:14:50 +0100
>> From: Ferruh Yigit <ferruh.yigit@intel.com>
>> To: Jerin Jacob <jerin.jacob@caviumnetworks.com>, Maciej Czekaj
>> <maciej.czekaj@caviumnetworks.com>
>> CC: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>, stable@dpdk.org
>> Subject: [PATCH] net/thunderx: fix build with gcc optimization on
>> X-Mailer: git-send-email 2.17.1
>>
>>
>> build error gcc version 6.3.1 20161221 (Red Hat 6.3.1-1),
>> with EXTRA_CFLAGS="-O3":
>>
>> .../drivers/net/thunderx/nicvf_ethdev.c:907:9:
>> error: ‘txq’ may be used uninitialized in this function
>> [-Werror=maybe-uninitialized]
>> if (txq->pool_free == nicvf_single_pool_free_xmited_buffers)
>> ~~~^~~~~~~~~~~
>> .../drivers/net/thunderx/nicvf_ethdev.c:886:20:
>> note: ‘txq’ was declared here
>> struct nicvf_txq *txq;
>> ^~~
>>
>> Same error on function 'nicvf_eth_dev_init' and 'nicvf_dev_start', it
>> seems 'nicvf_set_tx_function' inlined when optimization enabled.
>>
>> Initialize the txq and add NULL check before using it to fix.
>>
>> Fixes: 7413feee662d ("net/thunderx: add device start/stop and close")
>> Cc: stable@dpdk.org
>>
>> Reported-by: Richard Walsh <richard.walsh@intel.com>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>
> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-06-26 17:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-21 18:14 [dpdk-stable] [PATCH] net/thunderx: fix build with gcc optimization on Ferruh Yigit
2018-06-24 12:17 ` Jerin Jacob
2018-06-26 9:17 ` [dpdk-stable] [dpdk-dev] " Ferruh Yigit
2018-06-26 9:52 ` Jerin Jacob
2018-06-26 17:10 ` Ferruh Yigit
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).