intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* Re: [Intel-gfx] [vfio:next 33/38] drivers/gpu/drm/i915/i915_pci.c:975:2: warning: missing field 'override_only' initializer
       [not found] <202108272322.EipbBEAp-lkp@intel.com>
@ 2021-08-27 15:34 ` Jason Gunthorpe
  2021-10-01 11:04   ` Jani Nikula
  0 siblings, 1 reply; 6+ messages in thread
From: Jason Gunthorpe @ 2021-08-27 15:34 UTC (permalink / raw)
  To: kernel test robot
  Cc: Max Gurtovoy, llvm, kbuild-all, kvm, Alex Williamson,
	Yishai Hadas, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	intel-gfx

On Fri, Aug 27, 2021 at 03:12:36PM +0000, kernel test robot wrote:
> tree:   https://github.com/awilliam/linux-vfio.git next
> head:   ea870730d83fc13a5fa2bd0e175176d7ac8a400a
> commit: 343b7258687ecfbb363bfda8833a7cf641aac524 [33/38] PCI: Add 'override_only' field to struct pci_device_id
> config: i386-randconfig-a004-20210827 (attached as .config)
> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 1076082a0d97bd5c16a25ee7cf3dbb6ee4b5a9fe)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # https://github.com/awilliam/linux-vfio/commit/343b7258687ecfbb363bfda8833a7cf641aac524
>         git remote add vfio https://github.com/awilliam/linux-vfio.git
>         git fetch --no-tags vfio next
>         git checkout 343b7258687ecfbb363bfda8833a7cf641aac524
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>

Ugh, this is due to this code:

#define INTEL_VGA_DEVICE(id, info) {		\
	0x8086,	id,				\
	~0, ~0,					\
	0x030000, 0xff0000,			\
	(unsigned long) info }

#define INTEL_QUANTA_VGA_DEVICE(info) {		\
	0x8086,	0x16a,				\
	0x152d,	0x8990,				\
	0x030000, 0xff0000,			\
	(unsigned long) info }


Which really should be using the normal pattern for defining these
structs:

#define PCI_DEVICE_CLASS(dev_class,dev_class_mask) \
        .class = (dev_class), .class_mask = (dev_class_mask), \
        .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \
        .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID

The warning is also not a real issue, just clang being overzealous.

Jason

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

* Re: [Intel-gfx] [vfio:next 33/38] drivers/gpu/drm/i915/i915_pci.c:975:2: warning: missing field 'override_only' initializer
  2021-08-27 15:34 ` [Intel-gfx] [vfio:next 33/38] drivers/gpu/drm/i915/i915_pci.c:975:2: warning: missing field 'override_only' initializer Jason Gunthorpe
@ 2021-10-01 11:04   ` Jani Nikula
  2021-10-01 11:51     ` Jason Gunthorpe
                       ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jani Nikula @ 2021-10-01 11:04 UTC (permalink / raw)
  To: Jason Gunthorpe, kernel test robot
  Cc: Max Gurtovoy, llvm, kbuild-all, kvm, Alex Williamson,
	Yishai Hadas, Joonas Lahtinen, Rodrigo Vivi, intel-gfx

On Fri, 27 Aug 2021, Jason Gunthorpe <jgg@nvidia.com> wrote:
> On Fri, Aug 27, 2021 at 03:12:36PM +0000, kernel test robot wrote:
>> tree:   https://github.com/awilliam/linux-vfio.git next
>> head:   ea870730d83fc13a5fa2bd0e175176d7ac8a400a
>> commit: 343b7258687ecfbb363bfda8833a7cf641aac524 [33/38] PCI: Add 'override_only' field to struct pci_device_id
>> config: i386-randconfig-a004-20210827 (attached as .config)
>> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 1076082a0d97bd5c16a25ee7cf3dbb6ee4b5a9fe)
>> reproduce (this is a W=1 build):
>>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>>         chmod +x ~/bin/make.cross
>>         # https://github.com/awilliam/linux-vfio/commit/343b7258687ecfbb363bfda8833a7cf641aac524
>>         git remote add vfio https://github.com/awilliam/linux-vfio.git
>>         git fetch --no-tags vfio next
>>         git checkout 343b7258687ecfbb363bfda8833a7cf641aac524
>>         # save the attached .config to linux build tree
>>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 
>> 
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <lkp@intel.com>
>
> Ugh, this is due to this code:
>
> #define INTEL_VGA_DEVICE(id, info) {		\
> 	0x8086,	id,				\
> 	~0, ~0,					\
> 	0x030000, 0xff0000,			\
> 	(unsigned long) info }
>
> #define INTEL_QUANTA_VGA_DEVICE(info) {		\
> 	0x8086,	0x16a,				\
> 	0x152d,	0x8990,				\
> 	0x030000, 0xff0000,			\
> 	(unsigned long) info }
>
>
> Which really should be using the normal pattern for defining these
> structs:
>
> #define PCI_DEVICE_CLASS(dev_class,dev_class_mask) \
>         .class = (dev_class), .class_mask = (dev_class_mask), \
>         .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \
>         .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
>
> The warning is also not a real issue, just clang being overzealous.

Stumbled upon this old report, sorry for the delayed response.

The reason it's not using designated initializers is that the same file
gets synced to some userspace projects (at least libdrm and
igt-gpu-tools) which use the macros to initialize slightly different
structs. For example, igt uses struct pci_id_match from libpciaccess-dev
(/usr/include/pciaccess.h) and can't easily adapt to different member
names.

Anyway, we've got

subdir-ccflags-y += $(call cc-disable-warning, missing-field-initializers)
subdir-ccflags-y += $(call cc-disable-warning, initializer-overrides)

in drivers/gpu/drm/i915/Makefile, so I wonder why they're not respected.

BR,
Jani.

-- 
Jani Nikula, Intel Open Source Graphics Center

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

* Re: [Intel-gfx] [vfio:next 33/38] drivers/gpu/drm/i915/i915_pci.c:975:2: warning: missing field 'override_only' initializer
  2021-10-01 11:04   ` Jani Nikula
@ 2021-10-01 11:51     ` Jason Gunthorpe
  2021-10-05  9:00       ` Jani Nikula
  2021-10-01 17:18     ` Nick Desaulniers
  2021-10-01 17:45     ` Nathan Chancellor
  2 siblings, 1 reply; 6+ messages in thread
From: Jason Gunthorpe @ 2021-10-01 11:51 UTC (permalink / raw)
  To: Jani Nikula
  Cc: kernel test robot, Max Gurtovoy, llvm, kbuild-all, kvm,
	Alex Williamson, Yishai Hadas, Joonas Lahtinen, Rodrigo Vivi,
	intel-gfx

On Fri, Oct 01, 2021 at 02:04:04PM +0300, Jani Nikula wrote:
> On Fri, 27 Aug 2021, Jason Gunthorpe <jgg@nvidia.com> wrote:
> > On Fri, Aug 27, 2021 at 03:12:36PM +0000, kernel test robot wrote:
> >> tree:   https://github.com/awilliam/linux-vfio.git next
> >> head:   ea870730d83fc13a5fa2bd0e175176d7ac8a400a
> >> commit: 343b7258687ecfbb363bfda8833a7cf641aac524 [33/38] PCI: Add 'override_only' field to struct pci_device_id
> >> config: i386-randconfig-a004-20210827 (attached as .config)
> >> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 1076082a0d97bd5c16a25ee7cf3dbb6ee4b5a9fe)
> >> reproduce (this is a W=1 build):
> >>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >>         chmod +x ~/bin/make.cross
> >>         # https://github.com/awilliam/linux-vfio/commit/343b7258687ecfbb363bfda8833a7cf641aac524
> >>         git remote add vfio https://github.com/awilliam/linux-vfio.git
> >>         git fetch --no-tags vfio next
> >>         git checkout 343b7258687ecfbb363bfda8833a7cf641aac524
> >>         # save the attached .config to linux build tree
> >>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 
> >> 
> >> If you fix the issue, kindly add following tag as appropriate
> >> Reported-by: kernel test robot <lkp@intel.com>
> >
> > Ugh, this is due to this code:
> >
> > #define INTEL_VGA_DEVICE(id, info) {		\
> > 	0x8086,	id,				\
> > 	~0, ~0,					\
> > 	0x030000, 0xff0000,			\
> > 	(unsigned long) info }
> >
> > #define INTEL_QUANTA_VGA_DEVICE(info) {		\
> > 	0x8086,	0x16a,				\
> > 	0x152d,	0x8990,				\
> > 	0x030000, 0xff0000,			\
> > 	(unsigned long) info }
> >
> >
> > Which really should be using the normal pattern for defining these
> > structs:
> >
> > #define PCI_DEVICE_CLASS(dev_class,dev_class_mask) \
> >         .class = (dev_class), .class_mask = (dev_class_mask), \
> >         .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \
> >         .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
> >
> > The warning is also not a real issue, just clang being overzealous.
> 
> Stumbled upon this old report, sorry for the delayed response.
> 
> The reason it's not using designated initializers is that the same file
> gets synced to some userspace projects (at least libdrm and
> igt-gpu-tools) which use the macros to initialize slightly different
> structs. For example, igt uses struct pci_id_match from libpciaccess-dev
> (/usr/include/pciaccess.h) and can't easily adapt to different member
> names.

Do it like this:


#ifdef __KERNEL__
#define INTEL_VGA_DEVICE(..)
#endif


And userspace does

#define INTEL_VGA_DEVICE(..)
#include <foo.h>

> Anyway, we've got
> 
> subdir-ccflags-y += $(call cc-disable-warning, missing-field-initializers)
> subdir-ccflags-y += $(call cc-disable-warning, initializer-overrides)
> 
> in drivers/gpu/drm/i915/Makefile, so I wonder why they're not respected.

Disabling kernel warnings because some userspace wants to copy a
kernel header is horrific, don't do that.

Jason

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

* Re: [Intel-gfx] [vfio:next 33/38] drivers/gpu/drm/i915/i915_pci.c:975:2: warning: missing field 'override_only' initializer
  2021-10-01 11:04   ` Jani Nikula
  2021-10-01 11:51     ` Jason Gunthorpe
@ 2021-10-01 17:18     ` Nick Desaulniers
  2021-10-01 17:45     ` Nathan Chancellor
  2 siblings, 0 replies; 6+ messages in thread
From: Nick Desaulniers @ 2021-10-01 17:18 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Jason Gunthorpe, kernel test robot, Max Gurtovoy, llvm,
	kbuild-all, kvm, Alex Williamson, Yishai Hadas, Joonas Lahtinen,
	Rodrigo Vivi, intel-gfx

On Fri, Oct 1, 2021 at 4:04 AM Jani Nikula <jani.nikula@linux.intel.com> wrote:
>
> Anyway, we've got
>
> subdir-ccflags-y += $(call cc-disable-warning, missing-field-initializers)
> subdir-ccflags-y += $(call cc-disable-warning, initializer-overrides)
>
> in drivers/gpu/drm/i915/Makefile, so I wonder why they're not respected.

You do have to be super careful with `:=` assignment in Make;
generally folks mean to use `+=` and end up overwriting the existing
KBUILD_CFLAGS.  I'm not sure if that's the issue here, but it's worth
an audit of your Makefiles.
-- 
Thanks,
~Nick Desaulniers

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

* Re: [Intel-gfx] [vfio:next 33/38] drivers/gpu/drm/i915/i915_pci.c:975:2: warning: missing field 'override_only' initializer
  2021-10-01 11:04   ` Jani Nikula
  2021-10-01 11:51     ` Jason Gunthorpe
  2021-10-01 17:18     ` Nick Desaulniers
@ 2021-10-01 17:45     ` Nathan Chancellor
  2 siblings, 0 replies; 6+ messages in thread
From: Nathan Chancellor @ 2021-10-01 17:45 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Jason Gunthorpe, kernel test robot, Max Gurtovoy, llvm,
	kbuild-all, kvm, Alex Williamson, Yishai Hadas, Joonas Lahtinen,
	Rodrigo Vivi, intel-gfx

On Fri, Oct 01, 2021 at 02:04:04PM +0300, Jani Nikula wrote:
> On Fri, 27 Aug 2021, Jason Gunthorpe <jgg@nvidia.com> wrote:
> > On Fri, Aug 27, 2021 at 03:12:36PM +0000, kernel test robot wrote:
> >> tree:   https://github.com/awilliam/linux-vfio.git next
> >> head:   ea870730d83fc13a5fa2bd0e175176d7ac8a400a
> >> commit: 343b7258687ecfbb363bfda8833a7cf641aac524 [33/38] PCI: Add 'override_only' field to struct pci_device_id
> >> config: i386-randconfig-a004-20210827 (attached as .config)
> >> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 1076082a0d97bd5c16a25ee7cf3dbb6ee4b5a9fe)
> >> reproduce (this is a W=1 build):
> >>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >>         chmod +x ~/bin/make.cross
> >>         # https://github.com/awilliam/linux-vfio/commit/343b7258687ecfbb363bfda8833a7cf641aac524
> >>         git remote add vfio https://github.com/awilliam/linux-vfio.git
> >>         git fetch --no-tags vfio next
> >>         git checkout 343b7258687ecfbb363bfda8833a7cf641aac524
> >>         # save the attached .config to linux build tree
> >>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 
> >> 
> >> If you fix the issue, kindly add following tag as appropriate
> >> Reported-by: kernel test robot <lkp@intel.com>
> >
> > Ugh, this is due to this code:
> >
> > #define INTEL_VGA_DEVICE(id, info) {		\
> > 	0x8086,	id,				\
> > 	~0, ~0,					\
> > 	0x030000, 0xff0000,			\
> > 	(unsigned long) info }
> >
> > #define INTEL_QUANTA_VGA_DEVICE(info) {		\
> > 	0x8086,	0x16a,				\
> > 	0x152d,	0x8990,				\
> > 	0x030000, 0xff0000,			\
> > 	(unsigned long) info }
> >
> >
> > Which really should be using the normal pattern for defining these
> > structs:
> >
> > #define PCI_DEVICE_CLASS(dev_class,dev_class_mask) \
> >         .class = (dev_class), .class_mask = (dev_class_mask), \
> >         .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \
> >         .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
> >
> > The warning is also not a real issue, just clang being overzealous.
> 
> Stumbled upon this old report, sorry for the delayed response.
> 
> The reason it's not using designated initializers is that the same file
> gets synced to some userspace projects (at least libdrm and
> igt-gpu-tools) which use the macros to initialize slightly different
> structs. For example, igt uses struct pci_id_match from libpciaccess-dev
> (/usr/include/pciaccess.h) and can't easily adapt to different member
> names.
> 
> Anyway, we've got
> 
> subdir-ccflags-y += $(call cc-disable-warning, missing-field-initializers)
> subdir-ccflags-y += $(call cc-disable-warning, initializer-overrides)
> 
> in drivers/gpu/drm/i915/Makefile, so I wonder why they're not respected.

This report was from an i386 randconfig, which we recently had a lot of
issues with:

https://git.kernel.org/linus/7fa6a2746616c8de4c40b748c2bb0656e00624ff

Applying my patch to remove most of the cc-disable-warnings in your
Makefile would help avoid these reports in the future :)

https://lore.kernel.org/r/20210914194944.4004260-1-nathan@kernel.org/

Cheers,
Nathan

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

* Re: [Intel-gfx] [vfio:next 33/38] drivers/gpu/drm/i915/i915_pci.c:975:2: warning: missing field 'override_only' initializer
  2021-10-01 11:51     ` Jason Gunthorpe
@ 2021-10-05  9:00       ` Jani Nikula
  0 siblings, 0 replies; 6+ messages in thread
From: Jani Nikula @ 2021-10-05  9:00 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: kernel test robot, Max Gurtovoy, llvm, kbuild-all, kvm,
	Alex Williamson, Yishai Hadas, Joonas Lahtinen, Rodrigo Vivi,
	intel-gfx

On Fri, 01 Oct 2021, Jason Gunthorpe <jgg@nvidia.com> wrote:
> On Fri, Oct 01, 2021 at 02:04:04PM +0300, Jani Nikula wrote:
>> On Fri, 27 Aug 2021, Jason Gunthorpe <jgg@nvidia.com> wrote:
>> > On Fri, Aug 27, 2021 at 03:12:36PM +0000, kernel test robot wrote:
>> >> tree:   https://github.com/awilliam/linux-vfio.git next
>> >> head:   ea870730d83fc13a5fa2bd0e175176d7ac8a400a
>> >> commit: 343b7258687ecfbb363bfda8833a7cf641aac524 [33/38] PCI: Add 'override_only' field to struct pci_device_id
>> >> config: i386-randconfig-a004-20210827 (attached as .config)
>> >> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 1076082a0d97bd5c16a25ee7cf3dbb6ee4b5a9fe)
>> >> reproduce (this is a W=1 build):
>> >>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>> >>         chmod +x ~/bin/make.cross
>> >>         # https://github.com/awilliam/linux-vfio/commit/343b7258687ecfbb363bfda8833a7cf641aac524
>> >>         git remote add vfio https://github.com/awilliam/linux-vfio.git
>> >>         git fetch --no-tags vfio next
>> >>         git checkout 343b7258687ecfbb363bfda8833a7cf641aac524
>> >>         # save the attached .config to linux build tree
>> >>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 
>> >> 
>> >> If you fix the issue, kindly add following tag as appropriate
>> >> Reported-by: kernel test robot <lkp@intel.com>
>> >
>> > Ugh, this is due to this code:
>> >
>> > #define INTEL_VGA_DEVICE(id, info) {		\
>> > 	0x8086,	id,				\
>> > 	~0, ~0,					\
>> > 	0x030000, 0xff0000,			\
>> > 	(unsigned long) info }
>> >
>> > #define INTEL_QUANTA_VGA_DEVICE(info) {		\
>> > 	0x8086,	0x16a,				\
>> > 	0x152d,	0x8990,				\
>> > 	0x030000, 0xff0000,			\
>> > 	(unsigned long) info }
>> >
>> >
>> > Which really should be using the normal pattern for defining these
>> > structs:
>> >
>> > #define PCI_DEVICE_CLASS(dev_class,dev_class_mask) \
>> >         .class = (dev_class), .class_mask = (dev_class_mask), \
>> >         .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \
>> >         .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
>> >
>> > The warning is also not a real issue, just clang being overzealous.
>> 
>> Stumbled upon this old report, sorry for the delayed response.
>> 
>> The reason it's not using designated initializers is that the same file
>> gets synced to some userspace projects (at least libdrm and
>> igt-gpu-tools) which use the macros to initialize slightly different
>> structs. For example, igt uses struct pci_id_match from libpciaccess-dev
>> (/usr/include/pciaccess.h) and can't easily adapt to different member
>> names.
>
> Do it like this:
>
>
> #ifdef __KERNEL__
> #define INTEL_VGA_DEVICE(..)
> #endif
>
>
> And userspace does
>
> #define INTEL_VGA_DEVICE(..)
> #include <foo.h>

Sure.

>> Anyway, we've got
>> 
>> subdir-ccflags-y += $(call cc-disable-warning, missing-field-initializers)
>> subdir-ccflags-y += $(call cc-disable-warning, initializer-overrides)
>> 
>> in drivers/gpu/drm/i915/Makefile, so I wonder why they're not respected.
>
> Disabling kernel warnings because some userspace wants to copy a
> kernel header is horrific, don't do that.

We've disabled some warnings because those lines are preceded by

subdir-ccflags-y := -Wall -Wextra

enabling more warnings than the kernel build generally does.


BR,
Jani.



-- 
Jani Nikula, Intel Open Source Graphics Center

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

end of thread, other threads:[~2021-10-05  9:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <202108272322.EipbBEAp-lkp@intel.com>
2021-08-27 15:34 ` [Intel-gfx] [vfio:next 33/38] drivers/gpu/drm/i915/i915_pci.c:975:2: warning: missing field 'override_only' initializer Jason Gunthorpe
2021-10-01 11:04   ` Jani Nikula
2021-10-01 11:51     ` Jason Gunthorpe
2021-10-05  9:00       ` Jani Nikula
2021-10-01 17:18     ` Nick Desaulniers
2021-10-01 17:45     ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).