All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: "Mateusz Jończyk" <mat.jonczyk@o2.pl>
Cc: netdev@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	David Laight <David.Laight@ACULAB.COM>,
	Andrew Morton <akpm@linux-foundation.org>,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	Anshuman Khandual <anshuman.khandual@arm.com>,
	linux-rdma@vger.kernel.org
Subject: Re: "mm: uninline copy_overflow()" breaks i386 build in Mellanox MLX4
Date: Mon, 25 Apr 2022 20:13:05 -0300	[thread overview]
Message-ID: <20220425231305.GY64706@ziepe.ca> (raw)
In-Reply-To: <dbd203b1-3988-4c9c-909c-2d1f7f173a0d@o2.pl>

On Thu, Apr 21, 2022 at 10:47:01PM +0200, Mateusz Jończyk wrote:
> Hello,
> 
> commit ad7489d5262d ("mm: uninline copy_overflow()")
> 
> breaks for me a build for i386 in the Mellanox MLX4 driver:
> 
>         In file included from ./arch/x86/include/asm/preempt.h:7,
>                          from ./include/linux/preempt.h:78,
>                          from ./include/linux/percpu.h:6,
>                          from ./include/linux/context_tracking_state.h:5,
>                          from ./include/linux/hardirq.h:5,
>                          from drivers/net/ethernet/mellanox/mlx4/cq.c:37:
>         In function ‘check_copy_size’,
>             inlined from ‘copy_to_user’ at ./include/linux/uaccess.h:159:6,
>             inlined from ‘mlx4_init_user_cqes’ at drivers/net/ethernet/mellanox/mlx4/cq.c:317:9,
>             inlined from ‘mlx4_cq_alloc’ at drivers/net/ethernet/mellanox/mlx4/cq.c:394:10:
>         ./include/linux/thread_info.h:228:4: error: call to ‘__bad_copy_from’ declared with attribute error: copy source size is too small
>           228 |    __bad_copy_from();
>               |    ^~~~~~~~~~~~~~~~~
>         make[5]: *** [scripts/Makefile.build:288: drivers/net/ethernet/mellanox/mlx4/cq.o] Błąd 1
>         make[4]: *** [scripts/Makefile.build:550: drivers/net/ethernet/mellanox/mlx4] Błąd 2
>         make[3]: *** [scripts/Makefile.build:550: drivers/net/ethernet/mellanox] Błąd 2
>         make[2]: *** [scripts/Makefile.build:550: drivers/net/ethernet] Błąd 2
>         make[1]: *** [scripts/Makefile.build:550: drivers/net] Błąd 2
> 
> Reverting this commit fixes the build. Disabling Mellanox Ethernet drivers
> in Kconfig (tested only with also disabling of all Infiniband support) also fixes the build.
> 
> It appears that uninlining of copy_overflow() causes GCC to analyze the code deeper.

This looks like a compiler bug to me, array_size(entries, cqe_size)
cannot be known at compile time, so the __builtin_constant_p(bytes)
should be compile time false meaning the other two bad branches should
have been eliminated.

Jason

  reply	other threads:[~2022-04-25 23:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 20:47 "mm: uninline copy_overflow()" breaks i386 build in Mellanox MLX4 Mateusz Jończyk
2022-04-25 23:13 ` Jason Gunthorpe [this message]
2022-06-09 18:51   ` Linux kernel: " Mateusz Jończyk
2022-06-13  8:53     ` Richard Biener

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=20220425231305.GY64706@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=David.Laight@ACULAB.COM \
    --cc=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mat.jonczyk@o2.pl \
    --cc=netdev@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.