2020-06-18 18:14:28

by Niklas Cassel

[permalink] [raw]
Subject: [PATCH 2/2] nvmet: remove workarounds for gcc bug wrt unnamed fields in initializers

Workarounds for gcc issues with initializers and anon unions was first
introduced in commit e44ac588cd61 ("drivers/block/nvme-core.c: fix build
with gcc-4.4.4").

The gcc bug in question has been fixed since gcc 4.6.0:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676

The minimum gcc version for building the kernel has been 4.6.0 since
commit cafa0010cd51 ("Raise the minimum required gcc version to 4.6"),
and has since been updated to gcc 4.8.0 in
commit 5429ef62bcf3 ("compiler/gcc: Raise minimum GCC version for
kernel builds to 4.8").

For that reason, it should now be safe to remove these workarounds
and make the code look like it did before
commit e44ac588cd61 ("drivers/block/nvme-core.c: fix build with gcc-4.4.4")
was introduced.

Signed-off-by: Niklas Cassel <[email protected]>
---
If, for some reason, we want to allow builds with gcc < 4.6.0
even though the minimum gcc version is now 4.8.0,
there is another less intrusive workaround where you add an extra pair of
curly braces, see e.g. commit 6cc65be4f6f2 ("locking/qspinlock: Fix build
for anonymous union in older GCC compilers").

drivers/nvme/target/rdma.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index 6731e0349480..85c6ff0b0e44 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -1535,19 +1535,20 @@ static int nvmet_rdma_cm_accept(struct rdma_cm_id *cm_id,
struct nvmet_rdma_queue *queue,
struct rdma_conn_param *p)
{
- struct rdma_conn_param param = { };
- struct nvme_rdma_cm_rep priv = { };
+ struct rdma_conn_param param = {
+ .rnr_retry_count = 7,
+ .flow_control = 1,
+ .initiator_depth = min_t(u8, p->initiator_depth,
+ queue->dev->device->attrs.max_qp_init_rd_atom),
+ .private_data = &priv,
+ .private_data_len = sizeof(priv),
+ };
+ struct nvme_rdma_cm_rep priv = {
+ .recfmt = cpu_to_le16(NVME_RDMA_CM_FMT_1_0),
+ .crqsize = cpu_to_le16(queue->recv_queue_size),
+ };
int ret = -ENOMEM;

- param.rnr_retry_count = 7;
- param.flow_control = 1;
- param.initiator_depth = min_t(u8, p->initiator_depth,
- queue->dev->device->attrs.max_qp_init_rd_atom);
- param.private_data = &priv;
- param.private_data_len = sizeof(priv);
- priv.recfmt = cpu_to_le16(NVME_RDMA_CM_FMT_1_0);
- priv.crqsize = cpu_to_le16(queue->recv_queue_size);
-
ret = rdma_accept(cm_id, &param);
if (ret)
pr_err("rdma_accept failed (error code = %d)\n", ret);
--
2.26.2


2020-06-18 19:13:38

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 2/2] nvmet: remove workarounds for gcc bug wrt unnamed fields in initializers

Hi Niklas,

I love your patch! Yet something to improve:

[auto build test ERROR on block/for-next]
[also build test ERROR on linus/master v5.8-rc1 next-20200618]
[cannot apply to hch-configfs/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Niklas-Cassel/nvme-remove-workarounds-for-gcc-bug-wrt-unnamed-fields-in-initializers/20200618-223525
base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

In file included from arch/m68k/include/asm/io_mm.h:25,
from arch/m68k/include/asm/io.h:8,
from include/linux/scatterlist.h:9,
from include/linux/dma-mapping.h:11,
from include/linux/skbuff.h:31,
from include/net/net_namespace.h:39,
from include/linux/inet.h:42,
from drivers/nvme/target/rdma.c:17:
arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsb':
arch/m68k/include/asm/raw_io.h:83:7: warning: variable '__w' set but not used [-Wunused-but-set-variable]
83 | ({u8 __w, __v = (b); u32 _addr = ((u32) (addr)); \
| ^~~
arch/m68k/include/asm/raw_io.h:430:3: note: in expansion of macro 'rom_out_8'
430 | rom_out_8(port, *buf++);
| ^~~~~~~~~
arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsw':
arch/m68k/include/asm/raw_io.h:86:8: warning: variable '__w' set but not used [-Wunused-but-set-variable]
86 | ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); \
| ^~~
arch/m68k/include/asm/raw_io.h:448:3: note: in expansion of macro 'rom_out_be16'
448 | rom_out_be16(port, *buf++);
| ^~~~~~~~~~~~
arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsw_swapw':
arch/m68k/include/asm/raw_io.h:90:8: warning: variable '__w' set but not used [-Wunused-but-set-variable]
90 | ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); \
| ^~~
arch/m68k/include/asm/raw_io.h:466:3: note: in expansion of macro 'rom_out_le16'
466 | rom_out_le16(port, *buf++);
| ^~~~~~~~~~~~
In file included from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/preempt.h:11,
from arch/m68k/include/asm/irqflags.h:6,
from include/linux/irqflags.h:16,
from arch/m68k/include/asm/atomic.h:6,
from include/linux/atomic.h:7,
from drivers/nvme/target/rdma.c:7:
include/linux/scatterlist.h: In function 'sg_set_buf':
arch/m68k/include/asm/page_mm.h:169:49: warning: ordered comparison of pointer with null pointer [-Wextra]
169 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
| ^~
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
78 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~
include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~~~~~~~~~~
In file included from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from include/asm-generic/preempt.h:5,
from ./arch/m68k/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:78,
from arch/m68k/include/asm/irqflags.h:6,
from include/linux/irqflags.h:16,
from arch/m68k/include/asm/atomic.h:6,
from include/linux/atomic.h:7,
from drivers/nvme/target/rdma.c:7:
include/linux/dma-mapping.h: In function 'dma_map_resource':
arch/m68k/include/asm/page_mm.h:169:49: warning: ordered comparison of pointer with null pointer [-Wextra]
169 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
| ^~
include/asm-generic/bug.h:144:27: note: in definition of macro 'WARN_ON_ONCE'
144 | int __ret_warn_once = !!(condition); \
| ^~~~~~~~~
arch/m68k/include/asm/page_mm.h:170:25: note: in expansion of macro 'virt_addr_valid'
170 | #define pfn_valid(pfn) virt_addr_valid(pfn_to_virt(pfn))
| ^~~~~~~~~~~~~~~
include/linux/dma-mapping.h:352:19: note: in expansion of macro 'pfn_valid'
352 | if (WARN_ON_ONCE(pfn_valid(PHYS_PFN(phys_addr))))
| ^~~~~~~~~
drivers/nvme/target/rdma.c: In function 'nvmet_rdma_cm_accept':
>> drivers/nvme/target/rdma.c:1543:20: error: 'priv' undeclared (first use in this function)
1543 | .private_data = &priv,
| ^~~~
drivers/nvme/target/rdma.c:1543:20: note: each undeclared identifier is reported only once for each function it appears in
drivers/nvme/target/rdma.c:1546:26: warning: unused variable 'priv' [-Wunused-variable]
1546 | struct nvme_rdma_cm_rep priv = {
| ^~~~

vim +/priv +1543 drivers/nvme/target/rdma.c

1533
1534 static int nvmet_rdma_cm_accept(struct rdma_cm_id *cm_id,
1535 struct nvmet_rdma_queue *queue,
1536 struct rdma_conn_param *p)
1537 {
1538 struct rdma_conn_param param = {
1539 .rnr_retry_count = 7,
1540 .flow_control = 1,
1541 .initiator_depth = min_t(u8, p->initiator_depth,
1542 queue->dev->device->attrs.max_qp_init_rd_atom),
> 1543 .private_data = &priv,
1544 .private_data_len = sizeof(priv),
1545 };
1546 struct nvme_rdma_cm_rep priv = {
1547 .recfmt = cpu_to_le16(NVME_RDMA_CM_FMT_1_0),
1548 .crqsize = cpu_to_le16(queue->recv_queue_size),
1549 };
1550 int ret = -ENOMEM;
1551
1552 ret = rdma_accept(cm_id, &param);
1553 if (ret)
1554 pr_err("rdma_accept failed (error code = %d)\n", ret);
1555
1556 return ret;
1557 }
1558

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (7.14 kB)
.config.gz (55.87 kB)
Download all attachments

2020-06-19 02:44:45

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 2/2] nvmet: remove workarounds for gcc bug wrt unnamed fields in initializers

Hi Niklas,

I love your patch! Yet something to improve:

[auto build test ERROR on block/for-next]
[also build test ERROR on linus/master v5.8-rc1 next-20200618]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Niklas-Cassel/nvme-remove-workarounds-for-gcc-bug-wrt-unnamed-fields-in-initializers/20200618-223525
base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
config: x86_64-allyesconfig (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 487ca07fcc75d52755c9fe2ee05bcb3b6eeeec44)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

>> drivers/nvme/target/rdma.c:1543:20: error: use of undeclared identifier 'priv'
.private_data = &priv,
^
drivers/nvme/target/rdma.c:1544:30: error: use of undeclared identifier 'priv'
.private_data_len = sizeof(priv),
^
2 errors generated.

vim +/priv +1543 drivers/nvme/target/rdma.c

1533
1534 static int nvmet_rdma_cm_accept(struct rdma_cm_id *cm_id,
1535 struct nvmet_rdma_queue *queue,
1536 struct rdma_conn_param *p)
1537 {
1538 struct rdma_conn_param param = {
1539 .rnr_retry_count = 7,
1540 .flow_control = 1,
1541 .initiator_depth = min_t(u8, p->initiator_depth,
1542 queue->dev->device->attrs.max_qp_init_rd_atom),
> 1543 .private_data = &priv,
1544 .private_data_len = sizeof(priv),
1545 };
1546 struct nvme_rdma_cm_rep priv = {
1547 .recfmt = cpu_to_le16(NVME_RDMA_CM_FMT_1_0),
1548 .crqsize = cpu_to_le16(queue->recv_queue_size),
1549 };
1550 int ret = -ENOMEM;
1551
1552 ret = rdma_accept(cm_id, &param);
1553 if (ret)
1554 pr_err("rdma_accept failed (error code = %d)\n", ret);
1555
1556 return ret;
1557 }
1558

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (2.67 kB)
.config.gz (73.53 kB)
Download all attachments