All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 12804/13809] include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
@ 2020-04-04 23:57 kbuild test robot
  2020-04-05  9:00 ` Michael S. Tsirkin
  0 siblings, 1 reply; 16+ messages in thread
From: kbuild test robot @ 2020-04-04 23:57 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4657 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   dff79597431045a775f2e5d4d9de31bfa0d32a34
commit: 20c384f1ea1a0bc7320bc445c72dd02d2970d594 [12804/13809] vhost: refine vhost and vringh kconfig
config: arm-randconfig-a001-20200405 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 20c384f1ea1a0bc7320bc445c72dd02d2970d594
        # save the attached .config to linux build tree
        GCC_VERSION=9.3.0 make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/kernel.h:11,
                    from include/linux/list.h:9,
                    from include/linux/preempt.h:11,
                    from include/linux/spinlock.h:51,
                    from include/linux/seqlock.h:36,
                    from include/linux/time.h:6,
                    from include/linux/stat.h:19,
                    from include/linux/fcntl.h:5,
                    from include/linux/eventfd.h:12,
                    from drivers/vhost/vhost.c:13:
   In function 'vhost_vring_set_addr',
       inlined from 'vhost_vring_set_num_addr' at drivers/vhost/vhost.c:1581:7,
       inlined from 'vhost_vring_ioctl' at drivers/vhost/vhost.c:1614:10:
>> include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
     350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
         |                                      ^
   include/linux/compiler.h:331:4: note: in definition of macro '__compiletime_assert'
     331 |    prefix ## suffix();    \
         |    ^~~~~~
   include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
     350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
         |  ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |  ^~~~~~~~~~~~~~~~
>> drivers/vhost/vhost.c:1533:2: note: in expansion of macro 'BUILD_BUG_ON'
    1533 |  BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE);
         |  ^~~~~~~~~~~~

vim +/__compiletime_assert_1533 +350 include/linux/compiler.h

9a8ab1c39970a4 Daniel Santos 2013-02-21  336  
9a8ab1c39970a4 Daniel Santos 2013-02-21  337  #define _compiletime_assert(condition, msg, prefix, suffix) \
9a8ab1c39970a4 Daniel Santos 2013-02-21  338  	__compiletime_assert(condition, msg, prefix, suffix)
9a8ab1c39970a4 Daniel Santos 2013-02-21  339  
9a8ab1c39970a4 Daniel Santos 2013-02-21  340  /**
9a8ab1c39970a4 Daniel Santos 2013-02-21  341   * compiletime_assert - break build and emit msg if condition is false
9a8ab1c39970a4 Daniel Santos 2013-02-21  342   * @condition: a compile-time constant condition to check
9a8ab1c39970a4 Daniel Santos 2013-02-21  343   * @msg:       a message to emit if condition is false
9a8ab1c39970a4 Daniel Santos 2013-02-21  344   *
9a8ab1c39970a4 Daniel Santos 2013-02-21  345   * In tradition of POSIX assert, this macro will break the build if the
9a8ab1c39970a4 Daniel Santos 2013-02-21  346   * supplied condition is *false*, emitting the supplied error message if the
9a8ab1c39970a4 Daniel Santos 2013-02-21  347   * compiler has support to do so.
9a8ab1c39970a4 Daniel Santos 2013-02-21  348   */
9a8ab1c39970a4 Daniel Santos 2013-02-21  349  #define compiletime_assert(condition, msg) \
9a8ab1c39970a4 Daniel Santos 2013-02-21 @350  	_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
9a8ab1c39970a4 Daniel Santos 2013-02-21  351  

:::::: The code at line 350 was first introduced by commit
:::::: 9a8ab1c39970a4938a72d94e6fd13be88a797590 bug.h, compiler.h: introduce compiletime_assert & BUILD_BUG_ON_MSG

:::::: TO: Daniel Santos <daniel.santos@pobox.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 26922 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [linux-next:master 12804/13809] include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
  2020-04-04 23:57 [linux-next:master 12804/13809] include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE kbuild test robot
@ 2020-04-05  9:00 ` Michael S. Tsirkin
  2020-04-05 16:43     ` Michael S. Tsirkin
  0 siblings, 1 reply; 16+ messages in thread
From: Michael S. Tsirkin @ 2020-04-05  9:00 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 5374 bytes --]

On Sun, Apr 05, 2020 at 07:57:24AM +0800, kbuild test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   dff79597431045a775f2e5d4d9de31bfa0d32a34
> commit: 20c384f1ea1a0bc7320bc445c72dd02d2970d594 [12804/13809] vhost: refine vhost and vringh kconfig
> config: arm-randconfig-a001-20200405 (attached as .config)
> compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
> reproduce:
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         git checkout 20c384f1ea1a0bc7320bc445c72dd02d2970d594
>         # save the attached .config to linux build tree
>         GCC_VERSION=9.3.0 make.cross ARCH=arm 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kbuild test robot <lkp@intel.com>
> 
> All error/warnings (new ones prefixed by >>):
> 
>    In file included from include/linux/kernel.h:11,
>                     from include/linux/list.h:9,
>                     from include/linux/preempt.h:11,
>                     from include/linux/spinlock.h:51,
>                     from include/linux/seqlock.h:36,
>                     from include/linux/time.h:6,
>                     from include/linux/stat.h:19,
>                     from include/linux/fcntl.h:5,
>                     from include/linux/eventfd.h:12,
>                     from drivers/vhost/vhost.c:13:
>    In function 'vhost_vring_set_addr',
>        inlined from 'vhost_vring_set_num_addr' at drivers/vhost/vhost.c:1581:7,
>        inlined from 'vhost_vring_ioctl' at drivers/vhost/vhost.c:1614:10:
> >> include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
>      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
>          |                                      ^
>    include/linux/compiler.h:331:4: note: in definition of macro '__compiletime_assert'
>      331 |    prefix ## suffix();    \
>          |    ^~~~~~
>    include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
>      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
>          |  ^~~~~~~~~~~~~~~~~~~
>    include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
>       39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
>          |                                     ^~~~~~~~~~~~~~~~~~
>    include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
>       50 |  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
>          |  ^~~~~~~~~~~~~~~~
> >> drivers/vhost/vhost.c:1533:2: note: in expansion of macro 'BUILD_BUG_ON'
>     1533 |  BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE);
>          |  ^~~~~~~~~~~~

This compiler seems to be broken. We have:
#define VRING_AVAIL_ALIGN_SIZE 2
and

        struct vring_avail __user *avail;

and
struct vring_avail {
        __virtio16 flags;
        __virtio16 idx;
        __virtio16 ring[];
};      

A compiler that decides to require alignment of > 2 bytes on
a struct of packed u16's is likely broken in a bunch of other
ways that just happen not to trigger a BUILD_BUG.


The commit referenced just enables build on more platforms ...

> vim +/__compiletime_assert_1533 +350 include/linux/compiler.h
> 
> 9a8ab1c39970a4 Daniel Santos 2013-02-21  336  
> 9a8ab1c39970a4 Daniel Santos 2013-02-21  337  #define _compiletime_assert(condition, msg, prefix, suffix) \
> 9a8ab1c39970a4 Daniel Santos 2013-02-21  338  	__compiletime_assert(condition, msg, prefix, suffix)
> 9a8ab1c39970a4 Daniel Santos 2013-02-21  339  
> 9a8ab1c39970a4 Daniel Santos 2013-02-21  340  /**
> 9a8ab1c39970a4 Daniel Santos 2013-02-21  341   * compiletime_assert - break build and emit msg if condition is false
> 9a8ab1c39970a4 Daniel Santos 2013-02-21  342   * @condition: a compile-time constant condition to check
> 9a8ab1c39970a4 Daniel Santos 2013-02-21  343   * @msg:       a message to emit if condition is false
> 9a8ab1c39970a4 Daniel Santos 2013-02-21  344   *
> 9a8ab1c39970a4 Daniel Santos 2013-02-21  345   * In tradition of POSIX assert, this macro will break the build if the
> 9a8ab1c39970a4 Daniel Santos 2013-02-21  346   * supplied condition is *false*, emitting the supplied error message if the
> 9a8ab1c39970a4 Daniel Santos 2013-02-21  347   * compiler has support to do so.
> 9a8ab1c39970a4 Daniel Santos 2013-02-21  348   */
> 9a8ab1c39970a4 Daniel Santos 2013-02-21  349  #define compiletime_assert(condition, msg) \
> 9a8ab1c39970a4 Daniel Santos 2013-02-21 @350  	_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> 9a8ab1c39970a4 Daniel Santos 2013-02-21  351  
> 
> :::::: The code at line 350 was first introduced by commit
> :::::: 9a8ab1c39970a4938a72d94e6fd13be88a797590 bug.h, compiler.h: introduce compiletime_assert & BUILD_BUG_ON_MSG
> 
> :::::: TO: Daniel Santos <daniel.santos@pobox.com>
> :::::: CC: Linus Torvalds <torvalds@linux-foundation.org>
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [linux-next:master 12804/13809] include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
  2020-04-05  9:00 ` Michael S. Tsirkin
@ 2020-04-05 16:43     ` Michael S. Tsirkin
  0 siblings, 0 replies; 16+ messages in thread
From: Michael S. Tsirkin @ 2020-04-05 16:43 UTC (permalink / raw)
  To: kbuild test robot
  Cc: kbuild-all, Jason Wang, daniel.santos, Russell King,
	Ard Biesheuvel, linux-arm-kernel

Hello!
I would appreciate ARM maintainers take on the following
(sorry if I forgot someone, pls feel free to add people to CC):


On Sun, Apr 05, 2020 at 05:01:01AM -0400, Michael S. Tsirkin wrote:
> On Sun, Apr 05, 2020 at 07:57:24AM +0800, kbuild test robot wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > head:   dff79597431045a775f2e5d4d9de31bfa0d32a34
> > commit: 20c384f1ea1a0bc7320bc445c72dd02d2970d594 [12804/13809] vhost: refine vhost and vringh kconfig
> > config: arm-randconfig-a001-20200405 (attached as .config)
> > compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
> > reproduce:
> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         git checkout 20c384f1ea1a0bc7320bc445c72dd02d2970d594
> >         # save the attached .config to linux build tree
> >         GCC_VERSION=9.3.0 make.cross ARCH=arm 
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kbuild test robot <lkp@intel.com>
> > 
> > All error/warnings (new ones prefixed by >>):
> > 
> >    In file included from include/linux/kernel.h:11,
> >                     from include/linux/list.h:9,
> >                     from include/linux/preempt.h:11,
> >                     from include/linux/spinlock.h:51,
> >                     from include/linux/seqlock.h:36,
> >                     from include/linux/time.h:6,
> >                     from include/linux/stat.h:19,
> >                     from include/linux/fcntl.h:5,
> >                     from include/linux/eventfd.h:12,
> >                     from drivers/vhost/vhost.c:13:
> >    In function 'vhost_vring_set_addr',
> >        inlined from 'vhost_vring_set_num_addr' at drivers/vhost/vhost.c:1581:7,
> >        inlined from 'vhost_vring_ioctl' at drivers/vhost/vhost.c:1614:10:
> > >> include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
> >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> >          |                                      ^
> >    include/linux/compiler.h:331:4: note: in definition of macro '__compiletime_assert'
> >      331 |    prefix ## suffix();    \
> >          |    ^~~~~~
> >    include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
> >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> >          |  ^~~~~~~~~~~~~~~~~~~
> >    include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
> >       39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
> >          |                                     ^~~~~~~~~~~~~~~~~~
> >    include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
> >       50 |  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
> >          |  ^~~~~~~~~~~~~~~~
> > >> drivers/vhost/vhost.c:1533:2: note: in expansion of macro 'BUILD_BUG_ON'
> >     1533 |  BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE);
> >          |  ^~~~~~~~~~~~
> 
> This compiler seems to be broken. We have:
> #define VRING_AVAIL_ALIGN_SIZE 2
> and
> 
>         struct vring_avail __user *avail;
> 
> and
> struct vring_avail {
>         __virtio16 flags;
>         __virtio16 idx;
>         __virtio16 ring[];
> };      
> 
> A compiler that decides to require alignment of > 2 bytes on
> a struct of packed u16's is likely broken in a bunch of other
> ways that just happen not to trigger a BUILD_BUG.
> 
> 
> The commit referenced just enables build on more platforms ...

OK after some research, it seems that the issue triggers with
latest gcc too.
To trigger it, supply -mabi=apcs-gnu on command line.

Dropping  -mabi=apcs-gnu fixes the build.

I am still researching this flag.




> > vim +/__compiletime_assert_1533 +350 include/linux/compiler.h
> > 
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  336  
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  337  #define _compiletime_assert(condition, msg, prefix, suffix) \
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  338  	__compiletime_assert(condition, msg, prefix, suffix)
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  339  
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  340  /**
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  341   * compiletime_assert - break build and emit msg if condition is false
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  342   * @condition: a compile-time constant condition to check
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  343   * @msg:       a message to emit if condition is false
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  344   *
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  345   * In tradition of POSIX assert, this macro will break the build if the
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  346   * supplied condition is *false*, emitting the supplied error message if the
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  347   * compiler has support to do so.
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  348   */
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  349  #define compiletime_assert(condition, msg) \
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21 @350  	_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  351  
> > 
> > :::::: The code at line 350 was first introduced by commit
> > :::::: 9a8ab1c39970a4938a72d94e6fd13be88a797590 bug.h, compiler.h: introduce compiletime_assert & BUILD_BUG_ON_MSG
> > 
> > :::::: TO: Daniel Santos <daniel.santos@pobox.com>
> > :::::: CC: Linus Torvalds <torvalds@linux-foundation.org>
> > 
> > ---
> > 0-DAY CI Kernel Test Service, Intel Corporation
> > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
> 
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [linux-next:master 12804/13809] include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
@ 2020-04-05 16:43     ` Michael S. Tsirkin
  0 siblings, 0 replies; 16+ messages in thread
From: Michael S. Tsirkin @ 2020-04-05 16:43 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 6003 bytes --]

Hello!
I would appreciate ARM maintainers take on the following
(sorry if I forgot someone, pls feel free to add people to CC):


On Sun, Apr 05, 2020 at 05:01:01AM -0400, Michael S. Tsirkin wrote:
> On Sun, Apr 05, 2020 at 07:57:24AM +0800, kbuild test robot wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > head:   dff79597431045a775f2e5d4d9de31bfa0d32a34
> > commit: 20c384f1ea1a0bc7320bc445c72dd02d2970d594 [12804/13809] vhost: refine vhost and vringh kconfig
> > config: arm-randconfig-a001-20200405 (attached as .config)
> > compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
> > reproduce:
> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         git checkout 20c384f1ea1a0bc7320bc445c72dd02d2970d594
> >         # save the attached .config to linux build tree
> >         GCC_VERSION=9.3.0 make.cross ARCH=arm 
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kbuild test robot <lkp@intel.com>
> > 
> > All error/warnings (new ones prefixed by >>):
> > 
> >    In file included from include/linux/kernel.h:11,
> >                     from include/linux/list.h:9,
> >                     from include/linux/preempt.h:11,
> >                     from include/linux/spinlock.h:51,
> >                     from include/linux/seqlock.h:36,
> >                     from include/linux/time.h:6,
> >                     from include/linux/stat.h:19,
> >                     from include/linux/fcntl.h:5,
> >                     from include/linux/eventfd.h:12,
> >                     from drivers/vhost/vhost.c:13:
> >    In function 'vhost_vring_set_addr',
> >        inlined from 'vhost_vring_set_num_addr' at drivers/vhost/vhost.c:1581:7,
> >        inlined from 'vhost_vring_ioctl' at drivers/vhost/vhost.c:1614:10:
> > >> include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
> >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> >          |                                      ^
> >    include/linux/compiler.h:331:4: note: in definition of macro '__compiletime_assert'
> >      331 |    prefix ## suffix();    \
> >          |    ^~~~~~
> >    include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
> >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> >          |  ^~~~~~~~~~~~~~~~~~~
> >    include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
> >       39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
> >          |                                     ^~~~~~~~~~~~~~~~~~
> >    include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
> >       50 |  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
> >          |  ^~~~~~~~~~~~~~~~
> > >> drivers/vhost/vhost.c:1533:2: note: in expansion of macro 'BUILD_BUG_ON'
> >     1533 |  BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE);
> >          |  ^~~~~~~~~~~~
> 
> This compiler seems to be broken. We have:
> #define VRING_AVAIL_ALIGN_SIZE 2
> and
> 
>         struct vring_avail __user *avail;
> 
> and
> struct vring_avail {
>         __virtio16 flags;
>         __virtio16 idx;
>         __virtio16 ring[];
> };      
> 
> A compiler that decides to require alignment of > 2 bytes on
> a struct of packed u16's is likely broken in a bunch of other
> ways that just happen not to trigger a BUILD_BUG.
> 
> 
> The commit referenced just enables build on more platforms ...

OK after some research, it seems that the issue triggers with
latest gcc too.
To trigger it, supply -mabi=apcs-gnu on command line.

Dropping  -mabi=apcs-gnu fixes the build.

I am still researching this flag.




> > vim +/__compiletime_assert_1533 +350 include/linux/compiler.h
> > 
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  336  
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  337  #define _compiletime_assert(condition, msg, prefix, suffix) \
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  338  	__compiletime_assert(condition, msg, prefix, suffix)
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  339  
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  340  /**
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  341   * compiletime_assert - break build and emit msg if condition is false
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  342   * @condition: a compile-time constant condition to check
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  343   * @msg:       a message to emit if condition is false
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  344   *
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  345   * In tradition of POSIX assert, this macro will break the build if the
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  346   * supplied condition is *false*, emitting the supplied error message if the
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  347   * compiler has support to do so.
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  348   */
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  349  #define compiletime_assert(condition, msg) \
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21 @350  	_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> > 9a8ab1c39970a4 Daniel Santos 2013-02-21  351  
> > 
> > :::::: The code at line 350 was first introduced by commit
> > :::::: 9a8ab1c39970a4938a72d94e6fd13be88a797590 bug.h, compiler.h: introduce compiletime_assert & BUILD_BUG_ON_MSG
> > 
> > :::::: TO: Daniel Santos <daniel.santos@pobox.com>
> > :::::: CC: Linus Torvalds <torvalds@linux-foundation.org>
> > 
> > ---
> > 0-DAY CI Kernel Test Service, Intel Corporation
> > https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
> 
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [linux-next:master 12804/13809] include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
  2020-04-05 16:43     ` Michael S. Tsirkin
@ 2020-04-06 10:00       ` Ard Biesheuvel
  -1 siblings, 0 replies; 16+ messages in thread
From: Ard Biesheuvel @ 2020-04-06 10:00 UTC (permalink / raw)
  To: Michael S. Tsirkin, richard.henderson, christophe.lyon, richard.earnshaw
  Cc: kbuild-all, kbuild test robot, Jason Wang, daniel.santos,
	Russell King, Linux ARM

(adding some ARM GCC folks)


On Sun, 5 Apr 2020 at 18:44, Michael S. Tsirkin <mst@redhat.com> wrote:
>
> Hello!
> I would appreciate ARM maintainers take on the following
> (sorry if I forgot someone, pls feel free to add people to CC):
>
>
> On Sun, Apr 05, 2020 at 05:01:01AM -0400, Michael S. Tsirkin wrote:
> > On Sun, Apr 05, 2020 at 07:57:24AM +0800, kbuild test robot wrote:
> > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > > head:   dff79597431045a775f2e5d4d9de31bfa0d32a34
> > > commit: 20c384f1ea1a0bc7320bc445c72dd02d2970d594 [12804/13809] vhost: refine vhost and vringh kconfig
> > > config: arm-randconfig-a001-20200405 (attached as .config)
> > > compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
> > > reproduce:
> > >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > >         chmod +x ~/bin/make.cross
> > >         git checkout 20c384f1ea1a0bc7320bc445c72dd02d2970d594
> > >         # save the attached .config to linux build tree
> > >         GCC_VERSION=9.3.0 make.cross ARCH=arm
> > >
> > > If you fix the issue, kindly add following tag as appropriate
> > > Reported-by: kbuild test robot <lkp@intel.com>
> > >
> > > All error/warnings (new ones prefixed by >>):
> > >
> > >    In file included from include/linux/kernel.h:11,
> > >                     from include/linux/list.h:9,
> > >                     from include/linux/preempt.h:11,
> > >                     from include/linux/spinlock.h:51,
> > >                     from include/linux/seqlock.h:36,
> > >                     from include/linux/time.h:6,
> > >                     from include/linux/stat.h:19,
> > >                     from include/linux/fcntl.h:5,
> > >                     from include/linux/eventfd.h:12,
> > >                     from drivers/vhost/vhost.c:13:
> > >    In function 'vhost_vring_set_addr',
> > >        inlined from 'vhost_vring_set_num_addr' at drivers/vhost/vhost.c:1581:7,
> > >        inlined from 'vhost_vring_ioctl' at drivers/vhost/vhost.c:1614:10:
> > > >> include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
> > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> > >          |                                      ^
> > >    include/linux/compiler.h:331:4: note: in definition of macro '__compiletime_assert'
> > >      331 |    prefix ## suffix();    \
> > >          |    ^~~~~~
> > >    include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
> > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> > >          |  ^~~~~~~~~~~~~~~~~~~
> > >    include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
> > >       39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
> > >          |                                     ^~~~~~~~~~~~~~~~~~
> > >    include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
> > >       50 |  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
> > >          |  ^~~~~~~~~~~~~~~~
> > > >> drivers/vhost/vhost.c:1533:2: note: in expansion of macro 'BUILD_BUG_ON'
> > >     1533 |  BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE);
> > >          |  ^~~~~~~~~~~~
> >
> > This compiler seems to be broken. We have:
> > #define VRING_AVAIL_ALIGN_SIZE 2
> > and
> >
> >         struct vring_avail __user *avail;
> >
> > and
> > struct vring_avail {
> >         __virtio16 flags;
> >         __virtio16 idx;
> >         __virtio16 ring[];
> > };
> >
> > A compiler that decides to require alignment of > 2 bytes on
> > a struct of packed u16's is likely broken in a bunch of other
> > ways that just happen not to trigger a BUILD_BUG.
> >
> >
> > The commit referenced just enables build on more platforms ...
>
> OK after some research, it seems that the issue triggers with
> latest gcc too.
> To trigger it, supply -mabi=apcs-gnu on command line.
>
> Dropping  -mabi=apcs-gnu fixes the build.
>
> I am still researching this flag.
>

Is there a difference between __alignof__ *vq->avail and
__alignof__(struct vring_avail) ?

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [linux-next:master 12804/13809] include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
@ 2020-04-06 10:00       ` Ard Biesheuvel
  0 siblings, 0 replies; 16+ messages in thread
From: Ard Biesheuvel @ 2020-04-06 10:00 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4385 bytes --]

(adding some ARM GCC folks)


On Sun, 5 Apr 2020 at 18:44, Michael S. Tsirkin <mst@redhat.com> wrote:
>
> Hello!
> I would appreciate ARM maintainers take on the following
> (sorry if I forgot someone, pls feel free to add people to CC):
>
>
> On Sun, Apr 05, 2020 at 05:01:01AM -0400, Michael S. Tsirkin wrote:
> > On Sun, Apr 05, 2020 at 07:57:24AM +0800, kbuild test robot wrote:
> > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > > head:   dff79597431045a775f2e5d4d9de31bfa0d32a34
> > > commit: 20c384f1ea1a0bc7320bc445c72dd02d2970d594 [12804/13809] vhost: refine vhost and vringh kconfig
> > > config: arm-randconfig-a001-20200405 (attached as .config)
> > > compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
> > > reproduce:
> > >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > >         chmod +x ~/bin/make.cross
> > >         git checkout 20c384f1ea1a0bc7320bc445c72dd02d2970d594
> > >         # save the attached .config to linux build tree
> > >         GCC_VERSION=9.3.0 make.cross ARCH=arm
> > >
> > > If you fix the issue, kindly add following tag as appropriate
> > > Reported-by: kbuild test robot <lkp@intel.com>
> > >
> > > All error/warnings (new ones prefixed by >>):
> > >
> > >    In file included from include/linux/kernel.h:11,
> > >                     from include/linux/list.h:9,
> > >                     from include/linux/preempt.h:11,
> > >                     from include/linux/spinlock.h:51,
> > >                     from include/linux/seqlock.h:36,
> > >                     from include/linux/time.h:6,
> > >                     from include/linux/stat.h:19,
> > >                     from include/linux/fcntl.h:5,
> > >                     from include/linux/eventfd.h:12,
> > >                     from drivers/vhost/vhost.c:13:
> > >    In function 'vhost_vring_set_addr',
> > >        inlined from 'vhost_vring_set_num_addr' at drivers/vhost/vhost.c:1581:7,
> > >        inlined from 'vhost_vring_ioctl' at drivers/vhost/vhost.c:1614:10:
> > > >> include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
> > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> > >          |                                      ^
> > >    include/linux/compiler.h:331:4: note: in definition of macro '__compiletime_assert'
> > >      331 |    prefix ## suffix();    \
> > >          |    ^~~~~~
> > >    include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
> > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> > >          |  ^~~~~~~~~~~~~~~~~~~
> > >    include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
> > >       39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
> > >          |                                     ^~~~~~~~~~~~~~~~~~
> > >    include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
> > >       50 |  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
> > >          |  ^~~~~~~~~~~~~~~~
> > > >> drivers/vhost/vhost.c:1533:2: note: in expansion of macro 'BUILD_BUG_ON'
> > >     1533 |  BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE);
> > >          |  ^~~~~~~~~~~~
> >
> > This compiler seems to be broken. We have:
> > #define VRING_AVAIL_ALIGN_SIZE 2
> > and
> >
> >         struct vring_avail __user *avail;
> >
> > and
> > struct vring_avail {
> >         __virtio16 flags;
> >         __virtio16 idx;
> >         __virtio16 ring[];
> > };
> >
> > A compiler that decides to require alignment of > 2 bytes on
> > a struct of packed u16's is likely broken in a bunch of other
> > ways that just happen not to trigger a BUILD_BUG.
> >
> >
> > The commit referenced just enables build on more platforms ...
>
> OK after some research, it seems that the issue triggers with
> latest gcc too.
> To trigger it, supply -mabi=apcs-gnu on command line.
>
> Dropping  -mabi=apcs-gnu fixes the build.
>
> I am still researching this flag.
>

Is there a difference between __alignof__ *vq->avail and
__alignof__(struct vring_avail) ?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [linux-next:master 12804/13809] include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
  2020-04-06 10:00       ` Ard Biesheuvel
@ 2020-04-06 10:38         ` Michael S. Tsirkin
  -1 siblings, 0 replies; 16+ messages in thread
From: Michael S. Tsirkin @ 2020-04-06 10:38 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: richard.earnshaw, kbuild-all, kbuild test robot, christophe.lyon,
	Jason Wang, richard.henderson, daniel.santos, Russell King,
	Linux ARM

On Mon, Apr 06, 2020 at 12:00:36PM +0200, Ard Biesheuvel wrote:
> (adding some ARM GCC folks)
> 
> 
> On Sun, 5 Apr 2020 at 18:44, Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > Hello!
> > I would appreciate ARM maintainers take on the following
> > (sorry if I forgot someone, pls feel free to add people to CC):
> >
> >
> > On Sun, Apr 05, 2020 at 05:01:01AM -0400, Michael S. Tsirkin wrote:
> > > On Sun, Apr 05, 2020 at 07:57:24AM +0800, kbuild test robot wrote:
> > > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > > > head:   dff79597431045a775f2e5d4d9de31bfa0d32a34
> > > > commit: 20c384f1ea1a0bc7320bc445c72dd02d2970d594 [12804/13809] vhost: refine vhost and vringh kconfig
> > > > config: arm-randconfig-a001-20200405 (attached as .config)
> > > > compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
> > > > reproduce:
> > > >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > > >         chmod +x ~/bin/make.cross
> > > >         git checkout 20c384f1ea1a0bc7320bc445c72dd02d2970d594
> > > >         # save the attached .config to linux build tree
> > > >         GCC_VERSION=9.3.0 make.cross ARCH=arm
> > > >
> > > > If you fix the issue, kindly add following tag as appropriate
> > > > Reported-by: kbuild test robot <lkp@intel.com>
> > > >
> > > > All error/warnings (new ones prefixed by >>):
> > > >
> > > >    In file included from include/linux/kernel.h:11,
> > > >                     from include/linux/list.h:9,
> > > >                     from include/linux/preempt.h:11,
> > > >                     from include/linux/spinlock.h:51,
> > > >                     from include/linux/seqlock.h:36,
> > > >                     from include/linux/time.h:6,
> > > >                     from include/linux/stat.h:19,
> > > >                     from include/linux/fcntl.h:5,
> > > >                     from include/linux/eventfd.h:12,
> > > >                     from drivers/vhost/vhost.c:13:
> > > >    In function 'vhost_vring_set_addr',
> > > >        inlined from 'vhost_vring_set_num_addr' at drivers/vhost/vhost.c:1581:7,
> > > >        inlined from 'vhost_vring_ioctl' at drivers/vhost/vhost.c:1614:10:
> > > > >> include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
> > > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> > > >          |                                      ^
> > > >    include/linux/compiler.h:331:4: note: in definition of macro '__compiletime_assert'
> > > >      331 |    prefix ## suffix();    \
> > > >          |    ^~~~~~
> > > >    include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
> > > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> > > >          |  ^~~~~~~~~~~~~~~~~~~
> > > >    include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
> > > >       39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
> > > >          |                                     ^~~~~~~~~~~~~~~~~~
> > > >    include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
> > > >       50 |  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
> > > >          |  ^~~~~~~~~~~~~~~~
> > > > >> drivers/vhost/vhost.c:1533:2: note: in expansion of macro 'BUILD_BUG_ON'
> > > >     1533 |  BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE);
> > > >          |  ^~~~~~~~~~~~
> > >
> > > This compiler seems to be broken. We have:
> > > #define VRING_AVAIL_ALIGN_SIZE 2
> > > and
> > >
> > >         struct vring_avail __user *avail;
> > >
> > > and
> > > struct vring_avail {
> > >         __virtio16 flags;
> > >         __virtio16 idx;
> > >         __virtio16 ring[];
> > > };
> > >
> > > A compiler that decides to require alignment of > 2 bytes on
> > > a struct of packed u16's is likely broken in a bunch of other
> > > ways that just happen not to trigger a BUILD_BUG.
> > >
> > >
> > > The commit referenced just enables build on more platforms ...
> >
> > OK after some research, it seems that the issue triggers with
> > latest gcc too.
> > To trigger it, supply -mabi=apcs-gnu on command line.
> >
> > Dropping  -mabi=apcs-gnu fixes the build.
> >
> > I am still researching this flag.
> >
> 
> Is there a difference between __alignof__ *vq->avail and
> __alignof__(struct vring_avail) ?

Yes, the same.
I found this:
https://stackoverflow.com/questions/43786747/struct-layout-in-apcs-gnu-abi

Not sure how to interpret it ...
-- 
MST


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [linux-next:master 12804/13809] include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
@ 2020-04-06 10:38         ` Michael S. Tsirkin
  0 siblings, 0 replies; 16+ messages in thread
From: Michael S. Tsirkin @ 2020-04-06 10:38 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4791 bytes --]

On Mon, Apr 06, 2020 at 12:00:36PM +0200, Ard Biesheuvel wrote:
> (adding some ARM GCC folks)
> 
> 
> On Sun, 5 Apr 2020 at 18:44, Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > Hello!
> > I would appreciate ARM maintainers take on the following
> > (sorry if I forgot someone, pls feel free to add people to CC):
> >
> >
> > On Sun, Apr 05, 2020 at 05:01:01AM -0400, Michael S. Tsirkin wrote:
> > > On Sun, Apr 05, 2020 at 07:57:24AM +0800, kbuild test robot wrote:
> > > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > > > head:   dff79597431045a775f2e5d4d9de31bfa0d32a34
> > > > commit: 20c384f1ea1a0bc7320bc445c72dd02d2970d594 [12804/13809] vhost: refine vhost and vringh kconfig
> > > > config: arm-randconfig-a001-20200405 (attached as .config)
> > > > compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
> > > > reproduce:
> > > >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > > >         chmod +x ~/bin/make.cross
> > > >         git checkout 20c384f1ea1a0bc7320bc445c72dd02d2970d594
> > > >         # save the attached .config to linux build tree
> > > >         GCC_VERSION=9.3.0 make.cross ARCH=arm
> > > >
> > > > If you fix the issue, kindly add following tag as appropriate
> > > > Reported-by: kbuild test robot <lkp@intel.com>
> > > >
> > > > All error/warnings (new ones prefixed by >>):
> > > >
> > > >    In file included from include/linux/kernel.h:11,
> > > >                     from include/linux/list.h:9,
> > > >                     from include/linux/preempt.h:11,
> > > >                     from include/linux/spinlock.h:51,
> > > >                     from include/linux/seqlock.h:36,
> > > >                     from include/linux/time.h:6,
> > > >                     from include/linux/stat.h:19,
> > > >                     from include/linux/fcntl.h:5,
> > > >                     from include/linux/eventfd.h:12,
> > > >                     from drivers/vhost/vhost.c:13:
> > > >    In function 'vhost_vring_set_addr',
> > > >        inlined from 'vhost_vring_set_num_addr' at drivers/vhost/vhost.c:1581:7,
> > > >        inlined from 'vhost_vring_ioctl' at drivers/vhost/vhost.c:1614:10:
> > > > >> include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
> > > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> > > >          |                                      ^
> > > >    include/linux/compiler.h:331:4: note: in definition of macro '__compiletime_assert'
> > > >      331 |    prefix ## suffix();    \
> > > >          |    ^~~~~~
> > > >    include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
> > > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> > > >          |  ^~~~~~~~~~~~~~~~~~~
> > > >    include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
> > > >       39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
> > > >          |                                     ^~~~~~~~~~~~~~~~~~
> > > >    include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
> > > >       50 |  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
> > > >          |  ^~~~~~~~~~~~~~~~
> > > > >> drivers/vhost/vhost.c:1533:2: note: in expansion of macro 'BUILD_BUG_ON'
> > > >     1533 |  BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE);
> > > >          |  ^~~~~~~~~~~~
> > >
> > > This compiler seems to be broken. We have:
> > > #define VRING_AVAIL_ALIGN_SIZE 2
> > > and
> > >
> > >         struct vring_avail __user *avail;
> > >
> > > and
> > > struct vring_avail {
> > >         __virtio16 flags;
> > >         __virtio16 idx;
> > >         __virtio16 ring[];
> > > };
> > >
> > > A compiler that decides to require alignment of > 2 bytes on
> > > a struct of packed u16's is likely broken in a bunch of other
> > > ways that just happen not to trigger a BUILD_BUG.
> > >
> > >
> > > The commit referenced just enables build on more platforms ...
> >
> > OK after some research, it seems that the issue triggers with
> > latest gcc too.
> > To trigger it, supply -mabi=apcs-gnu on command line.
> >
> > Dropping  -mabi=apcs-gnu fixes the build.
> >
> > I am still researching this flag.
> >
> 
> Is there a difference between __alignof__ *vq->avail and
> __alignof__(struct vring_avail) ?

Yes, the same.
I found this:
https://stackoverflow.com/questions/43786747/struct-layout-in-apcs-gnu-abi

Not sure how to interpret it ...
-- 
MST

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [linux-next:master 12804/13809] include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
  2020-04-06 10:38         ` Michael S. Tsirkin
@ 2020-04-06 10:49           ` Ard Biesheuvel
  -1 siblings, 0 replies; 16+ messages in thread
From: Ard Biesheuvel @ 2020-04-06 10:49 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: richard.earnshaw, kbuild-all, kbuild test robot, christophe.lyon,
	Jason Wang, richard.henderson, daniel.santos, Russell King,
	Linux ARM

On Mon, 6 Apr 2020 at 12:38, Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Mon, Apr 06, 2020 at 12:00:36PM +0200, Ard Biesheuvel wrote:
> > (adding some ARM GCC folks)
> >
> >
> > On Sun, 5 Apr 2020 at 18:44, Michael S. Tsirkin <mst@redhat.com> wrote:
> > >
> > > Hello!
> > > I would appreciate ARM maintainers take on the following
> > > (sorry if I forgot someone, pls feel free to add people to CC):
> > >
> > >
> > > On Sun, Apr 05, 2020 at 05:01:01AM -0400, Michael S. Tsirkin wrote:
> > > > On Sun, Apr 05, 2020 at 07:57:24AM +0800, kbuild test robot wrote:
> > > > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > > > > head:   dff79597431045a775f2e5d4d9de31bfa0d32a34
> > > > > commit: 20c384f1ea1a0bc7320bc445c72dd02d2970d594 [12804/13809] vhost: refine vhost and vringh kconfig
> > > > > config: arm-randconfig-a001-20200405 (attached as .config)
> > > > > compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
> > > > > reproduce:
> > > > >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > > > >         chmod +x ~/bin/make.cross
> > > > >         git checkout 20c384f1ea1a0bc7320bc445c72dd02d2970d594
> > > > >         # save the attached .config to linux build tree
> > > > >         GCC_VERSION=9.3.0 make.cross ARCH=arm
> > > > >
> > > > > If you fix the issue, kindly add following tag as appropriate
> > > > > Reported-by: kbuild test robot <lkp@intel.com>
> > > > >
> > > > > All error/warnings (new ones prefixed by >>):
> > > > >
> > > > >    In file included from include/linux/kernel.h:11,
> > > > >                     from include/linux/list.h:9,
> > > > >                     from include/linux/preempt.h:11,
> > > > >                     from include/linux/spinlock.h:51,
> > > > >                     from include/linux/seqlock.h:36,
> > > > >                     from include/linux/time.h:6,
> > > > >                     from include/linux/stat.h:19,
> > > > >                     from include/linux/fcntl.h:5,
> > > > >                     from include/linux/eventfd.h:12,
> > > > >                     from drivers/vhost/vhost.c:13:
> > > > >    In function 'vhost_vring_set_addr',
> > > > >        inlined from 'vhost_vring_set_num_addr' at drivers/vhost/vhost.c:1581:7,
> > > > >        inlined from 'vhost_vring_ioctl' at drivers/vhost/vhost.c:1614:10:
> > > > > >> include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
> > > > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> > > > >          |                                      ^
> > > > >    include/linux/compiler.h:331:4: note: in definition of macro '__compiletime_assert'
> > > > >      331 |    prefix ## suffix();    \
> > > > >          |    ^~~~~~
> > > > >    include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
> > > > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> > > > >          |  ^~~~~~~~~~~~~~~~~~~
> > > > >    include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
> > > > >       39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
> > > > >          |                                     ^~~~~~~~~~~~~~~~~~
> > > > >    include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
> > > > >       50 |  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
> > > > >          |  ^~~~~~~~~~~~~~~~
> > > > > >> drivers/vhost/vhost.c:1533:2: note: in expansion of macro 'BUILD_BUG_ON'
> > > > >     1533 |  BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE);
> > > > >          |  ^~~~~~~~~~~~
> > > >
> > > > This compiler seems to be broken. We have:
> > > > #define VRING_AVAIL_ALIGN_SIZE 2
> > > > and
> > > >
> > > >         struct vring_avail __user *avail;
> > > >
> > > > and
> > > > struct vring_avail {
> > > >         __virtio16 flags;
> > > >         __virtio16 idx;
> > > >         __virtio16 ring[];
> > > > };
> > > >
> > > > A compiler that decides to require alignment of > 2 bytes on
> > > > a struct of packed u16's is likely broken in a bunch of other
> > > > ways that just happen not to trigger a BUILD_BUG.
> > > >
> > > >
> > > > The commit referenced just enables build on more platforms ...
> > >
> > > OK after some research, it seems that the issue triggers with
> > > latest gcc too.
> > > To trigger it, supply -mabi=apcs-gnu on command line.
> > >
> > > Dropping  -mabi=apcs-gnu fixes the build.
> > >
> > > I am still researching this flag.
> > >
> >
> > Is there a difference between __alignof__ *vq->avail and
> > __alignof__(struct vring_avail) ?
>
> Yes, the same.
> I found this:
> https://stackoverflow.com/questions/43786747/struct-layout-in-apcs-gnu-abi
>
> Not sure how to interpret it ...

Ah right, I missed that apcs-gnu is the ancient OABI that is been
deprecated for a long time.

Given that virtio support on such ancient systems is not needed in the
first place, let's just add something along the lines of

depends on !ARM || AEABI

to the virtio Kconfig declaration, and add a comment that it has to do
with struct member alignment.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [linux-next:master 12804/13809] include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
@ 2020-04-06 10:49           ` Ard Biesheuvel
  0 siblings, 0 replies; 16+ messages in thread
From: Ard Biesheuvel @ 2020-04-06 10:49 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 5411 bytes --]

On Mon, 6 Apr 2020 at 12:38, Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Mon, Apr 06, 2020 at 12:00:36PM +0200, Ard Biesheuvel wrote:
> > (adding some ARM GCC folks)
> >
> >
> > On Sun, 5 Apr 2020 at 18:44, Michael S. Tsirkin <mst@redhat.com> wrote:
> > >
> > > Hello!
> > > I would appreciate ARM maintainers take on the following
> > > (sorry if I forgot someone, pls feel free to add people to CC):
> > >
> > >
> > > On Sun, Apr 05, 2020 at 05:01:01AM -0400, Michael S. Tsirkin wrote:
> > > > On Sun, Apr 05, 2020 at 07:57:24AM +0800, kbuild test robot wrote:
> > > > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > > > > head:   dff79597431045a775f2e5d4d9de31bfa0d32a34
> > > > > commit: 20c384f1ea1a0bc7320bc445c72dd02d2970d594 [12804/13809] vhost: refine vhost and vringh kconfig
> > > > > config: arm-randconfig-a001-20200405 (attached as .config)
> > > > > compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
> > > > > reproduce:
> > > > >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > > > >         chmod +x ~/bin/make.cross
> > > > >         git checkout 20c384f1ea1a0bc7320bc445c72dd02d2970d594
> > > > >         # save the attached .config to linux build tree
> > > > >         GCC_VERSION=9.3.0 make.cross ARCH=arm
> > > > >
> > > > > If you fix the issue, kindly add following tag as appropriate
> > > > > Reported-by: kbuild test robot <lkp@intel.com>
> > > > >
> > > > > All error/warnings (new ones prefixed by >>):
> > > > >
> > > > >    In file included from include/linux/kernel.h:11,
> > > > >                     from include/linux/list.h:9,
> > > > >                     from include/linux/preempt.h:11,
> > > > >                     from include/linux/spinlock.h:51,
> > > > >                     from include/linux/seqlock.h:36,
> > > > >                     from include/linux/time.h:6,
> > > > >                     from include/linux/stat.h:19,
> > > > >                     from include/linux/fcntl.h:5,
> > > > >                     from include/linux/eventfd.h:12,
> > > > >                     from drivers/vhost/vhost.c:13:
> > > > >    In function 'vhost_vring_set_addr',
> > > > >        inlined from 'vhost_vring_set_num_addr' at drivers/vhost/vhost.c:1581:7,
> > > > >        inlined from 'vhost_vring_ioctl' at drivers/vhost/vhost.c:1614:10:
> > > > > >> include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
> > > > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> > > > >          |                                      ^
> > > > >    include/linux/compiler.h:331:4: note: in definition of macro '__compiletime_assert'
> > > > >      331 |    prefix ## suffix();    \
> > > > >          |    ^~~~~~
> > > > >    include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
> > > > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> > > > >          |  ^~~~~~~~~~~~~~~~~~~
> > > > >    include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
> > > > >       39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
> > > > >          |                                     ^~~~~~~~~~~~~~~~~~
> > > > >    include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
> > > > >       50 |  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
> > > > >          |  ^~~~~~~~~~~~~~~~
> > > > > >> drivers/vhost/vhost.c:1533:2: note: in expansion of macro 'BUILD_BUG_ON'
> > > > >     1533 |  BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE);
> > > > >          |  ^~~~~~~~~~~~
> > > >
> > > > This compiler seems to be broken. We have:
> > > > #define VRING_AVAIL_ALIGN_SIZE 2
> > > > and
> > > >
> > > >         struct vring_avail __user *avail;
> > > >
> > > > and
> > > > struct vring_avail {
> > > >         __virtio16 flags;
> > > >         __virtio16 idx;
> > > >         __virtio16 ring[];
> > > > };
> > > >
> > > > A compiler that decides to require alignment of > 2 bytes on
> > > > a struct of packed u16's is likely broken in a bunch of other
> > > > ways that just happen not to trigger a BUILD_BUG.
> > > >
> > > >
> > > > The commit referenced just enables build on more platforms ...
> > >
> > > OK after some research, it seems that the issue triggers with
> > > latest gcc too.
> > > To trigger it, supply -mabi=apcs-gnu on command line.
> > >
> > > Dropping  -mabi=apcs-gnu fixes the build.
> > >
> > > I am still researching this flag.
> > >
> >
> > Is there a difference between __alignof__ *vq->avail and
> > __alignof__(struct vring_avail) ?
>
> Yes, the same.
> I found this:
> https://stackoverflow.com/questions/43786747/struct-layout-in-apcs-gnu-abi
>
> Not sure how to interpret it ...

Ah right, I missed that apcs-gnu is the ancient OABI that is been
deprecated for a long time.

Given that virtio support on such ancient systems is not needed in the
first place, let's just add something along the lines of

depends on !ARM || AEABI

to the virtio Kconfig declaration, and add a comment that it has to do
with struct member alignment.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [linux-next:master 12804/13809] include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
  2020-04-06 10:49           ` Ard Biesheuvel
@ 2020-04-06 10:56             ` Richard Earnshaw
  -1 siblings, 0 replies; 16+ messages in thread
From: Richard Earnshaw @ 2020-04-06 10:56 UTC (permalink / raw)
  To: Ard Biesheuvel, Michael S. Tsirkin
  Cc: kbuild-all, kbuild test robot, daniel.santos, Jason Wang,
	richard.henderson, christophe.lyon, Russell King, Linux ARM

On 06/04/2020 11:49, Ard Biesheuvel wrote:
> On Mon, 6 Apr 2020 at 12:38, Michael S. Tsirkin <mst@redhat.com> wrote:
>>
>> On Mon, Apr 06, 2020 at 12:00:36PM +0200, Ard Biesheuvel wrote:
>> > (adding some ARM GCC folks)
>> >
>> >
>> > On Sun, 5 Apr 2020 at 18:44, Michael S. Tsirkin <mst@redhat.com> wrote:
>> > >
>> > > Hello!
>> > > I would appreciate ARM maintainers take on the following
>> > > (sorry if I forgot someone, pls feel free to add people to CC):
>> > >
>> > >
>> > > On Sun, Apr 05, 2020 at 05:01:01AM -0400, Michael S. Tsirkin wrote:
>> > > > On Sun, Apr 05, 2020 at 07:57:24AM +0800, kbuild test robot wrote:
>> > > > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
>> > > > > head:   dff79597431045a775f2e5d4d9de31bfa0d32a34
>> > > > > commit: 20c384f1ea1a0bc7320bc445c72dd02d2970d594 [12804/13809] vhost: refine vhost and vringh kconfig
>> > > > > config: arm-randconfig-a001-20200405 (attached as .config)
>> > > > > compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
>> > > > > reproduce:
>> > > > >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross
> -O ~/bin/make.cross
>> > > > >         chmod +x ~/bin/make.cross
>> > > > >         git checkout 20c384f1ea1a0bc7320bc445c72dd02d2970d594
>> > > > >         # save the attached .config to linux build tree
>> > > > >         GCC_VERSION=9.3.0 make.cross ARCH=arm
>> > > > >
>> > > > > If you fix the issue, kindly add following tag as appropriate
>> > > > > Reported-by: kbuild test robot <lkp@intel.com>
>> > > > >
>> > > > > All error/warnings (new ones prefixed by >>):
>> > > > >
>> > > > >    In file included from include/linux/kernel.h:11,
>> > > > >                     from include/linux/list.h:9,
>> > > > >                     from include/linux/preempt.h:11,
>> > > > >                     from include/linux/spinlock.h:51,
>> > > > >                     from include/linux/seqlock.h:36,
>> > > > >                     from include/linux/time.h:6,
>> > > > >                     from include/linux/stat.h:19,
>> > > > >                     from include/linux/fcntl.h:5,
>> > > > >                     from include/linux/eventfd.h:12,
>> > > > >                     from drivers/vhost/vhost.c:13:
>> > > > >    In function 'vhost_vring_set_addr',
>> > > > >        inlined from 'vhost_vring_set_num_addr' at drivers/vhost/vhost.c:1581:7,
>> > > > >        inlined from 'vhost_vring_ioctl' at drivers/vhost/vhost.c:1614:10:
>> > > > > >> include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
>> > > > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
>> > > > >          |                                      ^
>> > > > >    include/linux/compiler.h:331:4: note: in definition of macro '__compiletime_assert'
>> > > > >      331 |    prefix ## suffix();    \
>> > > > >          |    ^~~~~~
>> > > > >    include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
>> > > > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
>> > > > >          |  ^~~~~~~~~~~~~~~~~~~
>> > > > >    include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
>> > > > >       39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
>> > > > >          |                                     ^~~~~~~~~~~~~~~~~~
>> > > > >    include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
>> > > > >       50 |  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
>> > > > >          |  ^~~~~~~~~~~~~~~~
>> > > > > >> drivers/vhost/vhost.c:1533:2: note: in expansion of macro 'BUILD_BUG_ON'
>> > > > >     1533 |  BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE);
>> > > > >          |  ^~~~~~~~~~~~
>> > > >
>> > > > This compiler seems to be broken. We have:
>> > > > #define VRING_AVAIL_ALIGN_SIZE 2
>> > > > and
>> > > >
>> > > >         struct vring_avail __user *avail;
>> > > >
>> > > > and
>> > > > struct vring_avail {
>> > > >         __virtio16 flags;
>> > > >         __virtio16 idx;
>> > > >         __virtio16 ring[];
>> > > > };
>> > > >
>> > > > A compiler that decides to require alignment of > 2 bytes on
>> > > > a struct of packed u16's is likely broken in a bunch of other
>> > > > ways that just happen not to trigger a BUILD_BUG.
>> > > >
>> > > >
>> > > > The commit referenced just enables build on more platforms ...
>> > >
>> > > OK after some research, it seems that the issue triggers with
>> > > latest gcc too.
>> > > To trigger it, supply -mabi=apcs-gnu on command line.
>> > >
>> > > Dropping  -mabi=apcs-gnu fixes the build.
>> > >
>> > > I am still researching this flag.
>> > >
>> >
>> > Is there a difference between __alignof__ *vq->avail and
>> > __alignof__(struct vring_avail) ?
>>
>> Yes, the same.
>> I found this:
>> https://stackoverflow.com/questions/43786747/struct-layout-in-apcs-gnu-abi
>>
>> Not sure how to interpret it ...
>
> Ah right, I missed that apcs-gnu is the ancient OABI that is been
> deprecated for a long time.
>
> Given that virtio support on such ancient systems is not needed in the
> first place, let's just add something along the lines of
>
> depends on !ARM || AEABI
>
> to the virtio Kconfig declaration, and add a comment that it has to do
> with struct member alignment.

apcs-gnu is deprecated.  The plan is to remove it entirely in the not
too distant future now that all platforms that previously used it have
migrated to the aapcs.

R.
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [linux-next:master 12804/13809] include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
@ 2020-04-06 10:56             ` Richard Earnshaw
  0 siblings, 0 replies; 16+ messages in thread
From: Richard Earnshaw @ 2020-04-06 10:56 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 6532 bytes --]

On 06/04/2020 11:49, Ard Biesheuvel wrote:
> On Mon, 6 Apr 2020 at 12:38, Michael S. Tsirkin <mst@redhat.com> wrote:
>>
>> On Mon, Apr 06, 2020 at 12:00:36PM +0200, Ard Biesheuvel wrote:
>> > (adding some ARM GCC folks)
>> >
>> >
>> > On Sun, 5 Apr 2020 at 18:44, Michael S. Tsirkin <mst@redhat.com> wrote:
>> > >
>> > > Hello!
>> > > I would appreciate ARM maintainers take on the following
>> > > (sorry if I forgot someone, pls feel free to add people to CC):
>> > >
>> > >
>> > > On Sun, Apr 05, 2020 at 05:01:01AM -0400, Michael S. Tsirkin wrote:
>> > > > On Sun, Apr 05, 2020 at 07:57:24AM +0800, kbuild test robot wrote:
>> > > > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
>> > > > > head:   dff79597431045a775f2e5d4d9de31bfa0d32a34
>> > > > > commit: 20c384f1ea1a0bc7320bc445c72dd02d2970d594 [12804/13809] vhost: refine vhost and vringh kconfig
>> > > > > config: arm-randconfig-a001-20200405 (attached as .config)
>> > > > > compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
>> > > > > reproduce:
>> > > > >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross
> -O ~/bin/make.cross
>> > > > >         chmod +x ~/bin/make.cross
>> > > > >         git checkout 20c384f1ea1a0bc7320bc445c72dd02d2970d594
>> > > > >         # save the attached .config to linux build tree
>> > > > >         GCC_VERSION=9.3.0 make.cross ARCH=arm
>> > > > >
>> > > > > If you fix the issue, kindly add following tag as appropriate
>> > > > > Reported-by: kbuild test robot <lkp@intel.com>
>> > > > >
>> > > > > All error/warnings (new ones prefixed by >>):
>> > > > >
>> > > > >    In file included from include/linux/kernel.h:11,
>> > > > >                     from include/linux/list.h:9,
>> > > > >                     from include/linux/preempt.h:11,
>> > > > >                     from include/linux/spinlock.h:51,
>> > > > >                     from include/linux/seqlock.h:36,
>> > > > >                     from include/linux/time.h:6,
>> > > > >                     from include/linux/stat.h:19,
>> > > > >                     from include/linux/fcntl.h:5,
>> > > > >                     from include/linux/eventfd.h:12,
>> > > > >                     from drivers/vhost/vhost.c:13:
>> > > > >    In function 'vhost_vring_set_addr',
>> > > > >        inlined from 'vhost_vring_set_num_addr' at drivers/vhost/vhost.c:1581:7,
>> > > > >        inlined from 'vhost_vring_ioctl' at drivers/vhost/vhost.c:1614:10:
>> > > > > >> include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
>> > > > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
>> > > > >          |                                      ^
>> > > > >    include/linux/compiler.h:331:4: note: in definition of macro '__compiletime_assert'
>> > > > >      331 |    prefix ## suffix();    \
>> > > > >          |    ^~~~~~
>> > > > >    include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
>> > > > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
>> > > > >          |  ^~~~~~~~~~~~~~~~~~~
>> > > > >    include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
>> > > > >       39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
>> > > > >          |                                     ^~~~~~~~~~~~~~~~~~
>> > > > >    include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
>> > > > >       50 |  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
>> > > > >          |  ^~~~~~~~~~~~~~~~
>> > > > > >> drivers/vhost/vhost.c:1533:2: note: in expansion of macro 'BUILD_BUG_ON'
>> > > > >     1533 |  BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE);
>> > > > >          |  ^~~~~~~~~~~~
>> > > >
>> > > > This compiler seems to be broken. We have:
>> > > > #define VRING_AVAIL_ALIGN_SIZE 2
>> > > > and
>> > > >
>> > > >         struct vring_avail __user *avail;
>> > > >
>> > > > and
>> > > > struct vring_avail {
>> > > >         __virtio16 flags;
>> > > >         __virtio16 idx;
>> > > >         __virtio16 ring[];
>> > > > };
>> > > >
>> > > > A compiler that decides to require alignment of > 2 bytes on
>> > > > a struct of packed u16's is likely broken in a bunch of other
>> > > > ways that just happen not to trigger a BUILD_BUG.
>> > > >
>> > > >
>> > > > The commit referenced just enables build on more platforms ...
>> > >
>> > > OK after some research, it seems that the issue triggers with
>> > > latest gcc too.
>> > > To trigger it, supply -mabi=apcs-gnu on command line.
>> > >
>> > > Dropping  -mabi=apcs-gnu fixes the build.
>> > >
>> > > I am still researching this flag.
>> > >
>> >
>> > Is there a difference between __alignof__ *vq->avail and
>> > __alignof__(struct vring_avail) ?
>>
>> Yes, the same.
>> I found this:
>> https://stackoverflow.com/questions/43786747/struct-layout-in-apcs-gnu-abi
>>
>> Not sure how to interpret it ...
>
> Ah right, I missed that apcs-gnu is the ancient OABI that is been
> deprecated for a long time.
>
> Given that virtio support on such ancient systems is not needed in the
> first place, let's just add something along the lines of
>
> depends on !ARM || AEABI
>
> to the virtio Kconfig declaration, and add a comment that it has to do
> with struct member alignment.

apcs-gnu is deprecated.  The plan is to remove it entirely in the not
too distant future now that all platforms that previously used it have
migrated to the aapcs.

R.
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [linux-next:master 12804/13809] include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
  2020-04-06 10:49           ` Ard Biesheuvel
@ 2020-04-06 11:36             ` Michael S. Tsirkin
  -1 siblings, 0 replies; 16+ messages in thread
From: Michael S. Tsirkin @ 2020-04-06 11:36 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: richard.earnshaw, kbuild-all, kbuild test robot, christophe.lyon,
	Jason Wang, richard.henderson, daniel.santos, Russell King,
	Linux ARM

On Mon, Apr 06, 2020 at 12:49:55PM +0200, Ard Biesheuvel wrote:
> On Mon, 6 Apr 2020 at 12:38, Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > On Mon, Apr 06, 2020 at 12:00:36PM +0200, Ard Biesheuvel wrote:
> > > (adding some ARM GCC folks)
> > >
> > >
> > > On Sun, 5 Apr 2020 at 18:44, Michael S. Tsirkin <mst@redhat.com> wrote:
> > > >
> > > > Hello!
> > > > I would appreciate ARM maintainers take on the following
> > > > (sorry if I forgot someone, pls feel free to add people to CC):
> > > >
> > > >
> > > > On Sun, Apr 05, 2020 at 05:01:01AM -0400, Michael S. Tsirkin wrote:
> > > > > On Sun, Apr 05, 2020 at 07:57:24AM +0800, kbuild test robot wrote:
> > > > > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > > > > > head:   dff79597431045a775f2e5d4d9de31bfa0d32a34
> > > > > > commit: 20c384f1ea1a0bc7320bc445c72dd02d2970d594 [12804/13809] vhost: refine vhost and vringh kconfig
> > > > > > config: arm-randconfig-a001-20200405 (attached as .config)
> > > > > > compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
> > > > > > reproduce:
> > > > > >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > > > > >         chmod +x ~/bin/make.cross
> > > > > >         git checkout 20c384f1ea1a0bc7320bc445c72dd02d2970d594
> > > > > >         # save the attached .config to linux build tree
> > > > > >         GCC_VERSION=9.3.0 make.cross ARCH=arm
> > > > > >
> > > > > > If you fix the issue, kindly add following tag as appropriate
> > > > > > Reported-by: kbuild test robot <lkp@intel.com>
> > > > > >
> > > > > > All error/warnings (new ones prefixed by >>):
> > > > > >
> > > > > >    In file included from include/linux/kernel.h:11,
> > > > > >                     from include/linux/list.h:9,
> > > > > >                     from include/linux/preempt.h:11,
> > > > > >                     from include/linux/spinlock.h:51,
> > > > > >                     from include/linux/seqlock.h:36,
> > > > > >                     from include/linux/time.h:6,
> > > > > >                     from include/linux/stat.h:19,
> > > > > >                     from include/linux/fcntl.h:5,
> > > > > >                     from include/linux/eventfd.h:12,
> > > > > >                     from drivers/vhost/vhost.c:13:
> > > > > >    In function 'vhost_vring_set_addr',
> > > > > >        inlined from 'vhost_vring_set_num_addr' at drivers/vhost/vhost.c:1581:7,
> > > > > >        inlined from 'vhost_vring_ioctl' at drivers/vhost/vhost.c:1614:10:
> > > > > > >> include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
> > > > > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> > > > > >          |                                      ^
> > > > > >    include/linux/compiler.h:331:4: note: in definition of macro '__compiletime_assert'
> > > > > >      331 |    prefix ## suffix();    \
> > > > > >          |    ^~~~~~
> > > > > >    include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
> > > > > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> > > > > >          |  ^~~~~~~~~~~~~~~~~~~
> > > > > >    include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
> > > > > >       39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
> > > > > >          |                                     ^~~~~~~~~~~~~~~~~~
> > > > > >    include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
> > > > > >       50 |  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
> > > > > >          |  ^~~~~~~~~~~~~~~~
> > > > > > >> drivers/vhost/vhost.c:1533:2: note: in expansion of macro 'BUILD_BUG_ON'
> > > > > >     1533 |  BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE);
> > > > > >          |  ^~~~~~~~~~~~
> > > > >
> > > > > This compiler seems to be broken. We have:
> > > > > #define VRING_AVAIL_ALIGN_SIZE 2
> > > > > and
> > > > >
> > > > >         struct vring_avail __user *avail;
> > > > >
> > > > > and
> > > > > struct vring_avail {
> > > > >         __virtio16 flags;
> > > > >         __virtio16 idx;
> > > > >         __virtio16 ring[];
> > > > > };
> > > > >
> > > > > A compiler that decides to require alignment of > 2 bytes on
> > > > > a struct of packed u16's is likely broken in a bunch of other
> > > > > ways that just happen not to trigger a BUILD_BUG.
> > > > >
> > > > >
> > > > > The commit referenced just enables build on more platforms ...
> > > >
> > > > OK after some research, it seems that the issue triggers with
> > > > latest gcc too.
> > > > To trigger it, supply -mabi=apcs-gnu on command line.
> > > >
> > > > Dropping  -mabi=apcs-gnu fixes the build.
> > > >
> > > > I am still researching this flag.
> > > >
> > >
> > > Is there a difference between __alignof__ *vq->avail and
> > > __alignof__(struct vring_avail) ?
> >
> > Yes, the same.
> > I found this:
> > https://stackoverflow.com/questions/43786747/struct-layout-in-apcs-gnu-abi
> >
> > Not sure how to interpret it ...
> 
> Ah right, I missed that apcs-gnu is the ancient OABI that is been
> deprecated for a long time.
> 
> Given that virtio support on such ancient systems is not needed in the
> first place, let's just add something along the lines of
> 
> depends on !ARM || AEABI
> 
> to the virtio Kconfig declaration, and add a comment that it has to do
> with struct member alignment.

The annoying thing is that the component which has this
alignment requirement is actually vhost which is selected,
so we can not add dependencies to it.

-- 
MST


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [linux-next:master 12804/13809] include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
@ 2020-04-06 11:36             ` Michael S. Tsirkin
  0 siblings, 0 replies; 16+ messages in thread
From: Michael S. Tsirkin @ 2020-04-06 11:36 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 5872 bytes --]

On Mon, Apr 06, 2020 at 12:49:55PM +0200, Ard Biesheuvel wrote:
> On Mon, 6 Apr 2020 at 12:38, Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > On Mon, Apr 06, 2020 at 12:00:36PM +0200, Ard Biesheuvel wrote:
> > > (adding some ARM GCC folks)
> > >
> > >
> > > On Sun, 5 Apr 2020 at 18:44, Michael S. Tsirkin <mst@redhat.com> wrote:
> > > >
> > > > Hello!
> > > > I would appreciate ARM maintainers take on the following
> > > > (sorry if I forgot someone, pls feel free to add people to CC):
> > > >
> > > >
> > > > On Sun, Apr 05, 2020 at 05:01:01AM -0400, Michael S. Tsirkin wrote:
> > > > > On Sun, Apr 05, 2020 at 07:57:24AM +0800, kbuild test robot wrote:
> > > > > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > > > > > head:   dff79597431045a775f2e5d4d9de31bfa0d32a34
> > > > > > commit: 20c384f1ea1a0bc7320bc445c72dd02d2970d594 [12804/13809] vhost: refine vhost and vringh kconfig
> > > > > > config: arm-randconfig-a001-20200405 (attached as .config)
> > > > > > compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
> > > > > > reproduce:
> > > > > >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > > > > >         chmod +x ~/bin/make.cross
> > > > > >         git checkout 20c384f1ea1a0bc7320bc445c72dd02d2970d594
> > > > > >         # save the attached .config to linux build tree
> > > > > >         GCC_VERSION=9.3.0 make.cross ARCH=arm
> > > > > >
> > > > > > If you fix the issue, kindly add following tag as appropriate
> > > > > > Reported-by: kbuild test robot <lkp@intel.com>
> > > > > >
> > > > > > All error/warnings (new ones prefixed by >>):
> > > > > >
> > > > > >    In file included from include/linux/kernel.h:11,
> > > > > >                     from include/linux/list.h:9,
> > > > > >                     from include/linux/preempt.h:11,
> > > > > >                     from include/linux/spinlock.h:51,
> > > > > >                     from include/linux/seqlock.h:36,
> > > > > >                     from include/linux/time.h:6,
> > > > > >                     from include/linux/stat.h:19,
> > > > > >                     from include/linux/fcntl.h:5,
> > > > > >                     from include/linux/eventfd.h:12,
> > > > > >                     from drivers/vhost/vhost.c:13:
> > > > > >    In function 'vhost_vring_set_addr',
> > > > > >        inlined from 'vhost_vring_set_num_addr' at drivers/vhost/vhost.c:1581:7,
> > > > > >        inlined from 'vhost_vring_ioctl' at drivers/vhost/vhost.c:1614:10:
> > > > > > >> include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
> > > > > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> > > > > >          |                                      ^
> > > > > >    include/linux/compiler.h:331:4: note: in definition of macro '__compiletime_assert'
> > > > > >      331 |    prefix ## suffix();    \
> > > > > >          |    ^~~~~~
> > > > > >    include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
> > > > > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> > > > > >          |  ^~~~~~~~~~~~~~~~~~~
> > > > > >    include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
> > > > > >       39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
> > > > > >          |                                     ^~~~~~~~~~~~~~~~~~
> > > > > >    include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
> > > > > >       50 |  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
> > > > > >          |  ^~~~~~~~~~~~~~~~
> > > > > > >> drivers/vhost/vhost.c:1533:2: note: in expansion of macro 'BUILD_BUG_ON'
> > > > > >     1533 |  BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE);
> > > > > >          |  ^~~~~~~~~~~~
> > > > >
> > > > > This compiler seems to be broken. We have:
> > > > > #define VRING_AVAIL_ALIGN_SIZE 2
> > > > > and
> > > > >
> > > > >         struct vring_avail __user *avail;
> > > > >
> > > > > and
> > > > > struct vring_avail {
> > > > >         __virtio16 flags;
> > > > >         __virtio16 idx;
> > > > >         __virtio16 ring[];
> > > > > };
> > > > >
> > > > > A compiler that decides to require alignment of > 2 bytes on
> > > > > a struct of packed u16's is likely broken in a bunch of other
> > > > > ways that just happen not to trigger a BUILD_BUG.
> > > > >
> > > > >
> > > > > The commit referenced just enables build on more platforms ...
> > > >
> > > > OK after some research, it seems that the issue triggers with
> > > > latest gcc too.
> > > > To trigger it, supply -mabi=apcs-gnu on command line.
> > > >
> > > > Dropping  -mabi=apcs-gnu fixes the build.
> > > >
> > > > I am still researching this flag.
> > > >
> > >
> > > Is there a difference between __alignof__ *vq->avail and
> > > __alignof__(struct vring_avail) ?
> >
> > Yes, the same.
> > I found this:
> > https://stackoverflow.com/questions/43786747/struct-layout-in-apcs-gnu-abi
> >
> > Not sure how to interpret it ...
> 
> Ah right, I missed that apcs-gnu is the ancient OABI that is been
> deprecated for a long time.
> 
> Given that virtio support on such ancient systems is not needed in the
> first place, let's just add something along the lines of
> 
> depends on !ARM || AEABI
> 
> to the virtio Kconfig declaration, and add a comment that it has to do
> with struct member alignment.

The annoying thing is that the component which has this
alignment requirement is actually vhost which is selected,
so we can not add dependencies to it.

-- 
MST

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [linux-next:master 12804/13809] include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
  2020-04-06 10:56             ` Richard Earnshaw
@ 2020-04-06 11:43               ` Michael S. Tsirkin
  -1 siblings, 0 replies; 16+ messages in thread
From: Michael S. Tsirkin @ 2020-04-06 11:43 UTC (permalink / raw)
  To: Richard Earnshaw
  Cc: kbuild-all, kbuild test robot, christophe.lyon, Jason Wang,
	richard.henderson, daniel.santos, Russell King, Ard Biesheuvel,
	Linux ARM

On Mon, Apr 06, 2020 at 11:56:24AM +0100, Richard Earnshaw wrote:
> On 06/04/2020 11:49, Ard Biesheuvel wrote:
> > On Mon, 6 Apr 2020 at 12:38, Michael S. Tsirkin <mst@redhat.com> wrote:
> >>
> >> On Mon, Apr 06, 2020 at 12:00:36PM +0200, Ard Biesheuvel wrote:
> >> > (adding some ARM GCC folks)
> >> >
> >> >
> >> > On Sun, 5 Apr 2020 at 18:44, Michael S. Tsirkin <mst@redhat.com> wrote:
> >> > >
> >> > > Hello!
> >> > > I would appreciate ARM maintainers take on the following
> >> > > (sorry if I forgot someone, pls feel free to add people to CC):
> >> > >
> >> > >
> >> > > On Sun, Apr 05, 2020 at 05:01:01AM -0400, Michael S. Tsirkin wrote:
> >> > > > On Sun, Apr 05, 2020 at 07:57:24AM +0800, kbuild test robot wrote:
> >> > > > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> >> > > > > head:   dff79597431045a775f2e5d4d9de31bfa0d32a34
> >> > > > > commit: 20c384f1ea1a0bc7320bc445c72dd02d2970d594 [12804/13809] vhost: refine vhost and vringh kconfig
> >> > > > > config: arm-randconfig-a001-20200405 (attached as .config)
> >> > > > > compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
> >> > > > > reproduce:
> >> > > > >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross
> > -O ~/bin/make.cross
> >> > > > >         chmod +x ~/bin/make.cross
> >> > > > >         git checkout 20c384f1ea1a0bc7320bc445c72dd02d2970d594
> >> > > > >         # save the attached .config to linux build tree
> >> > > > >         GCC_VERSION=9.3.0 make.cross ARCH=arm
> >> > > > >
> >> > > > > If you fix the issue, kindly add following tag as appropriate
> >> > > > > Reported-by: kbuild test robot <lkp@intel.com>
> >> > > > >
> >> > > > > All error/warnings (new ones prefixed by >>):
> >> > > > >
> >> > > > >    In file included from include/linux/kernel.h:11,
> >> > > > >                     from include/linux/list.h:9,
> >> > > > >                     from include/linux/preempt.h:11,
> >> > > > >                     from include/linux/spinlock.h:51,
> >> > > > >                     from include/linux/seqlock.h:36,
> >> > > > >                     from include/linux/time.h:6,
> >> > > > >                     from include/linux/stat.h:19,
> >> > > > >                     from include/linux/fcntl.h:5,
> >> > > > >                     from include/linux/eventfd.h:12,
> >> > > > >                     from drivers/vhost/vhost.c:13:
> >> > > > >    In function 'vhost_vring_set_addr',
> >> > > > >        inlined from 'vhost_vring_set_num_addr' at drivers/vhost/vhost.c:1581:7,
> >> > > > >        inlined from 'vhost_vring_ioctl' at drivers/vhost/vhost.c:1614:10:
> >> > > > > >> include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
> >> > > > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> >> > > > >          |                                      ^
> >> > > > >    include/linux/compiler.h:331:4: note: in definition of macro '__compiletime_assert'
> >> > > > >      331 |    prefix ## suffix();    \
> >> > > > >          |    ^~~~~~
> >> > > > >    include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
> >> > > > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> >> > > > >          |  ^~~~~~~~~~~~~~~~~~~
> >> > > > >    include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
> >> > > > >       39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
> >> > > > >          |                                     ^~~~~~~~~~~~~~~~~~
> >> > > > >    include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
> >> > > > >       50 |  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
> >> > > > >          |  ^~~~~~~~~~~~~~~~
> >> > > > > >> drivers/vhost/vhost.c:1533:2: note: in expansion of macro 'BUILD_BUG_ON'
> >> > > > >     1533 |  BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE);
> >> > > > >          |  ^~~~~~~~~~~~
> >> > > >
> >> > > > This compiler seems to be broken. We have:
> >> > > > #define VRING_AVAIL_ALIGN_SIZE 2
> >> > > > and
> >> > > >
> >> > > >         struct vring_avail __user *avail;
> >> > > >
> >> > > > and
> >> > > > struct vring_avail {
> >> > > >         __virtio16 flags;
> >> > > >         __virtio16 idx;
> >> > > >         __virtio16 ring[];
> >> > > > };
> >> > > >
> >> > > > A compiler that decides to require alignment of > 2 bytes on
> >> > > > a struct of packed u16's is likely broken in a bunch of other
> >> > > > ways that just happen not to trigger a BUILD_BUG.
> >> > > >
> >> > > >
> >> > > > The commit referenced just enables build on more platforms ...
> >> > >
> >> > > OK after some research, it seems that the issue triggers with
> >> > > latest gcc too.
> >> > > To trigger it, supply -mabi=apcs-gnu on command line.
> >> > >
> >> > > Dropping  -mabi=apcs-gnu fixes the build.
> >> > >
> >> > > I am still researching this flag.
> >> > >
> >> >
> >> > Is there a difference between __alignof__ *vq->avail and
> >> > __alignof__(struct vring_avail) ?
> >>
> >> Yes, the same.
> >> I found this:
> >> https://stackoverflow.com/questions/43786747/struct-layout-in-apcs-gnu-abi
> >>
> >> Not sure how to interpret it ...
> >
> > Ah right, I missed that apcs-gnu is the ancient OABI that is been
> > deprecated for a long time.
> >
> > Given that virtio support on such ancient systems is not needed in the
> > first place, let's just add something along the lines of
> >
> > depends on !ARM || AEABI
> >
> > to the virtio Kconfig declaration, and add a comment that it has to do
> > with struct member alignment.
> 
> apcs-gnu is deprecated.  The plan is to remove it entirely in the not
> too distant future now that all platforms that previously used it have
> migrated to the aapcs.

Problem is that the default ARM build still uses that. That includes
the kbuild infrastructure.



> R.
> IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [linux-next:master 12804/13809] include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
@ 2020-04-06 11:43               ` Michael S. Tsirkin
  0 siblings, 0 replies; 16+ messages in thread
From: Michael S. Tsirkin @ 2020-04-06 11:43 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 6945 bytes --]

On Mon, Apr 06, 2020 at 11:56:24AM +0100, Richard Earnshaw wrote:
> On 06/04/2020 11:49, Ard Biesheuvel wrote:
> > On Mon, 6 Apr 2020 at 12:38, Michael S. Tsirkin <mst@redhat.com> wrote:
> >>
> >> On Mon, Apr 06, 2020 at 12:00:36PM +0200, Ard Biesheuvel wrote:
> >> > (adding some ARM GCC folks)
> >> >
> >> >
> >> > On Sun, 5 Apr 2020 at 18:44, Michael S. Tsirkin <mst@redhat.com> wrote:
> >> > >
> >> > > Hello!
> >> > > I would appreciate ARM maintainers take on the following
> >> > > (sorry if I forgot someone, pls feel free to add people to CC):
> >> > >
> >> > >
> >> > > On Sun, Apr 05, 2020 at 05:01:01AM -0400, Michael S. Tsirkin wrote:
> >> > > > On Sun, Apr 05, 2020 at 07:57:24AM +0800, kbuild test robot wrote:
> >> > > > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> >> > > > > head:   dff79597431045a775f2e5d4d9de31bfa0d32a34
> >> > > > > commit: 20c384f1ea1a0bc7320bc445c72dd02d2970d594 [12804/13809] vhost: refine vhost and vringh kconfig
> >> > > > > config: arm-randconfig-a001-20200405 (attached as .config)
> >> > > > > compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
> >> > > > > reproduce:
> >> > > > >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross
> > -O ~/bin/make.cross
> >> > > > >         chmod +x ~/bin/make.cross
> >> > > > >         git checkout 20c384f1ea1a0bc7320bc445c72dd02d2970d594
> >> > > > >         # save the attached .config to linux build tree
> >> > > > >         GCC_VERSION=9.3.0 make.cross ARCH=arm
> >> > > > >
> >> > > > > If you fix the issue, kindly add following tag as appropriate
> >> > > > > Reported-by: kbuild test robot <lkp@intel.com>
> >> > > > >
> >> > > > > All error/warnings (new ones prefixed by >>):
> >> > > > >
> >> > > > >    In file included from include/linux/kernel.h:11,
> >> > > > >                     from include/linux/list.h:9,
> >> > > > >                     from include/linux/preempt.h:11,
> >> > > > >                     from include/linux/spinlock.h:51,
> >> > > > >                     from include/linux/seqlock.h:36,
> >> > > > >                     from include/linux/time.h:6,
> >> > > > >                     from include/linux/stat.h:19,
> >> > > > >                     from include/linux/fcntl.h:5,
> >> > > > >                     from include/linux/eventfd.h:12,
> >> > > > >                     from drivers/vhost/vhost.c:13:
> >> > > > >    In function 'vhost_vring_set_addr',
> >> > > > >        inlined from 'vhost_vring_set_num_addr' at drivers/vhost/vhost.c:1581:7,
> >> > > > >        inlined from 'vhost_vring_ioctl' at drivers/vhost/vhost.c:1614:10:
> >> > > > > >> include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE
> >> > > > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> >> > > > >          |                                      ^
> >> > > > >    include/linux/compiler.h:331:4: note: in definition of macro '__compiletime_assert'
> >> > > > >      331 |    prefix ## suffix();    \
> >> > > > >          |    ^~~~~~
> >> > > > >    include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
> >> > > > >      350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> >> > > > >          |  ^~~~~~~~~~~~~~~~~~~
> >> > > > >    include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
> >> > > > >       39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
> >> > > > >          |                                     ^~~~~~~~~~~~~~~~~~
> >> > > > >    include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
> >> > > > >       50 |  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
> >> > > > >          |  ^~~~~~~~~~~~~~~~
> >> > > > > >> drivers/vhost/vhost.c:1533:2: note: in expansion of macro 'BUILD_BUG_ON'
> >> > > > >     1533 |  BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE);
> >> > > > >          |  ^~~~~~~~~~~~
> >> > > >
> >> > > > This compiler seems to be broken. We have:
> >> > > > #define VRING_AVAIL_ALIGN_SIZE 2
> >> > > > and
> >> > > >
> >> > > >         struct vring_avail __user *avail;
> >> > > >
> >> > > > and
> >> > > > struct vring_avail {
> >> > > >         __virtio16 flags;
> >> > > >         __virtio16 idx;
> >> > > >         __virtio16 ring[];
> >> > > > };
> >> > > >
> >> > > > A compiler that decides to require alignment of > 2 bytes on
> >> > > > a struct of packed u16's is likely broken in a bunch of other
> >> > > > ways that just happen not to trigger a BUILD_BUG.
> >> > > >
> >> > > >
> >> > > > The commit referenced just enables build on more platforms ...
> >> > >
> >> > > OK after some research, it seems that the issue triggers with
> >> > > latest gcc too.
> >> > > To trigger it, supply -mabi=apcs-gnu on command line.
> >> > >
> >> > > Dropping  -mabi=apcs-gnu fixes the build.
> >> > >
> >> > > I am still researching this flag.
> >> > >
> >> >
> >> > Is there a difference between __alignof__ *vq->avail and
> >> > __alignof__(struct vring_avail) ?
> >>
> >> Yes, the same.
> >> I found this:
> >> https://stackoverflow.com/questions/43786747/struct-layout-in-apcs-gnu-abi
> >>
> >> Not sure how to interpret it ...
> >
> > Ah right, I missed that apcs-gnu is the ancient OABI that is been
> > deprecated for a long time.
> >
> > Given that virtio support on such ancient systems is not needed in the
> > first place, let's just add something along the lines of
> >
> > depends on !ARM || AEABI
> >
> > to the virtio Kconfig declaration, and add a comment that it has to do
> > with struct member alignment.
> 
> apcs-gnu is deprecated.  The plan is to remove it entirely in the not
> too distant future now that all platforms that previously used it have
> migrated to the aapcs.

Problem is that the default ARM build still uses that. That includes
the kbuild infrastructure.



> R.
> IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2020-04-06 11:43 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-04 23:57 [linux-next:master 12804/13809] include/linux/compiler.h:350:38: error: call to '__compiletime_assert_1533' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE kbuild test robot
2020-04-05  9:00 ` Michael S. Tsirkin
2020-04-05 16:43   ` Michael S. Tsirkin
2020-04-05 16:43     ` Michael S. Tsirkin
2020-04-06 10:00     ` Ard Biesheuvel
2020-04-06 10:00       ` Ard Biesheuvel
2020-04-06 10:38       ` Michael S. Tsirkin
2020-04-06 10:38         ` Michael S. Tsirkin
2020-04-06 10:49         ` Ard Biesheuvel
2020-04-06 10:49           ` Ard Biesheuvel
2020-04-06 10:56           ` Richard Earnshaw
2020-04-06 10:56             ` Richard Earnshaw
2020-04-06 11:43             ` Michael S. Tsirkin
2020-04-06 11:43               ` Michael S. Tsirkin
2020-04-06 11:36           ` Michael S. Tsirkin
2020-04-06 11:36             ` Michael S. Tsirkin

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.