All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Alexander Graf <graf@amazon.com>
Cc: oe-kbuild-all@lists.linux.dev, kvm-ppc@vger.kernel.org
Subject: [agraf-2.6:kvm-kho-gmem-test 9/27] kernel/kexec_kho_out.c:208:26: warning: excess elements in struct initializer
Date: Sun, 5 May 2024 02:33:37 +0800	[thread overview]
Message-ID: <202405050241.50OPTPXf-lkp@intel.com> (raw)

tree:   https://github.com/agraf/linux-2.6.git kvm-kho-gmem-test
head:   9a58862a298a63bad21d05191e28b857063bb9dc
commit: 55d4e99ed5b8909f348e838e03dda3cda4f2fa2e [9/27] x86: Add KHO support
config: i386-randconfig-053-20240505 (https://download.01.org/0day-ci/archive/20240505/202405050241.50OPTPXf-lkp@intel.com/config)
compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240505/202405050241.50OPTPXf-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405050241.50OPTPXf-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from kernel/kexec_kho_out.c:10:
   include/linux/kexec.h:369:34: error: field 'dt' has incomplete type
     369 |                 struct kexec_buf dt;
         |                                  ^~
   include/linux/kexec.h:370:34: error: field 'mem_cache' has incomplete type
     370 |                 struct kexec_buf mem_cache;
         |                                  ^~~~~~~~~
   kernel/kexec_kho_out.c: In function 'kho_mem_cache_add':
   kernel/kexec_kho_out.c:59:13: warning: variable 'prev_start' set but not used [-Wunused-but-set-variable]
      59 |         u64 prev_start = 0;
         |             ^~~~~~~~~~
   kernel/kexec_kho_out.c: In function 'kho_fill_kimage':
   kernel/kexec_kho_out.c:208:18: error: 'struct kexec_buf' has no member named 'image'
     208 |                 .image = image,
         |                  ^~~~~
>> kernel/kexec_kho_out.c:208:26: warning: excess elements in struct initializer
     208 |                 .image = image,
         |                          ^~~~~
   kernel/kexec_kho_out.c:208:26: note: (near initialization for '(anonymous)')
   kernel/kexec_kho_out.c:209:18: error: 'struct kexec_buf' has no member named 'buffer'
     209 |                 .buffer = NULL,
         |                  ^~~~~~
   In file included from include/uapi/linux/posix_types.h:5,
                    from include/uapi/linux/types.h:14,
                    from include/linux/types.h:6,
                    from include/linux/kasan-checks.h:5,
                    from include/asm-generic/rwonce.h:26,
                    from ./arch/x86/include/generated/asm/rwonce.h:1,
                    from include/linux/compiler.h:290,
                    from include/linux/build_bug.h:5,
                    from include/linux/init.h:5,
                    from include/linux/cma.h:5,
                    from kernel/kexec_kho_out.c:9:
   include/linux/stddef.h:8:14: warning: excess elements in struct initializer
       8 | #define NULL ((void *)0)
         |              ^
   kernel/kexec_kho_out.c:209:27: note: in expansion of macro 'NULL'
     209 |                 .buffer = NULL,
         |                           ^~~~
   include/linux/stddef.h:8:14: note: (near initialization for '(anonymous)')
       8 | #define NULL ((void *)0)
         |              ^
   kernel/kexec_kho_out.c:209:27: note: in expansion of macro 'NULL'
     209 |                 .buffer = NULL,
         |                           ^~~~
   kernel/kexec_kho_out.c:210:18: error: 'struct kexec_buf' has no member named 'bufsz'
     210 |                 .bufsz = 0,
         |                  ^~~~~
   kernel/kexec_kho_out.c:210:26: warning: excess elements in struct initializer
     210 |                 .bufsz = 0,
         |                          ^
   kernel/kexec_kho_out.c:210:26: note: (near initialization for '(anonymous)')
   kernel/kexec_kho_out.c:211:18: error: 'struct kexec_buf' has no member named 'mem'
     211 |                 .mem = KEXEC_BUF_MEM_UNKNOWN,
         |                  ^~~
   kernel/kexec_kho_out.c:211:24: error: 'KEXEC_BUF_MEM_UNKNOWN' undeclared (first use in this function)
     211 |                 .mem = KEXEC_BUF_MEM_UNKNOWN,
         |                        ^~~~~~~~~~~~~~~~~~~~~
   kernel/kexec_kho_out.c:211:24: note: each undeclared identifier is reported only once for each function it appears in
   kernel/kexec_kho_out.c:211:24: warning: excess elements in struct initializer
   kernel/kexec_kho_out.c:211:24: note: (near initialization for '(anonymous)')
   kernel/kexec_kho_out.c:212:18: error: 'struct kexec_buf' has no member named 'memsz'
     212 |                 .memsz = 0,
         |                  ^~~~~
   kernel/kexec_kho_out.c:212:26: warning: excess elements in struct initializer
     212 |                 .memsz = 0,
         |                          ^
   kernel/kexec_kho_out.c:212:26: note: (near initialization for '(anonymous)')
   kernel/kexec_kho_out.c:213:18: error: 'struct kexec_buf' has no member named 'buf_align'
     213 |                 .buf_align = SZ_64K, /* Makes it easier to map */
         |                  ^~~~~~~~~
   In file included from include/linux/mm.h:27,
                    from include/linux/pid_namespace.h:7,
                    from include/linux/ptrace.h:10,
                    from include/linux/elfcore.h:11,
                    from include/linux/vmcore_info.h:6,
                    from include/linux/kexec.h:18:
   include/linux/sizes.h:27:41: warning: excess elements in struct initializer
      27 | #define SZ_64K                          0x00010000
         |                                         ^~~~~~~~~~
   kernel/kexec_kho_out.c:213:30: note: in expansion of macro 'SZ_64K'
     213 |                 .buf_align = SZ_64K, /* Makes it easier to map */
         |                              ^~~~~~
   include/linux/sizes.h:27:41: note: (near initialization for '(anonymous)')
      27 | #define SZ_64K                          0x00010000
         |                                         ^~~~~~~~~~
   kernel/kexec_kho_out.c:213:30: note: in expansion of macro 'SZ_64K'
     213 |                 .buf_align = SZ_64K, /* Makes it easier to map */
         |                              ^~~~~~
   kernel/kexec_kho_out.c:214:18: error: 'struct kexec_buf' has no member named 'buf_max'
     214 |                 .buf_max = ULONG_MAX,
         |                  ^~~~~~~
   In file included from include/linux/limits.h:7,
                    from include/linux/overflow.h:6,
                    from include/linux/string.h:12,
                    from arch/x86/include/asm/page_32.h:18,
                    from arch/x86/include/asm/page.h:14,
                    from arch/x86/include/asm/user_32.h:5,
                    from arch/x86/include/asm/user.h:6,
                    from include/linux/user.h:1,
                    from include/linux/elfcore.h:5:
   include/vdso/limits.h:13:25: warning: excess elements in struct initializer
      13 | #define ULONG_MAX       (~0UL)
         |                         ^
   kernel/kexec_kho_out.c:214:28: note: in expansion of macro 'ULONG_MAX'
     214 |                 .buf_max = ULONG_MAX,
         |                            ^~~~~~~~~
   include/vdso/limits.h:13:25: note: (near initialization for '(anonymous)')
      13 | #define ULONG_MAX       (~0UL)
         |                         ^
   kernel/kexec_kho_out.c:214:28: note: in expansion of macro 'ULONG_MAX'
     214 |                 .buf_max = ULONG_MAX,
         |                            ^~~~~~~~~
   kernel/kexec_kho_out.c:215:18: error: 'struct kexec_buf' has no member named 'top_down'
     215 |                 .top_down = true,
         |                  ^~~~~~~~


vim +208 kernel/kexec_kho_out.c

4d945e93456555 Alexander Graf 2023-12-12  195  
4d945e93456555 Alexander Graf 2023-12-12  196  int kho_fill_kimage(struct kimage *image)
4d945e93456555 Alexander Graf 2023-12-12  197  {
4d945e93456555 Alexander Graf 2023-12-12  198  	int err = 0;
4d945e93456555 Alexander Graf 2023-12-12  199  	void *dt;
4d945e93456555 Alexander Graf 2023-12-12  200  
4d945e93456555 Alexander Graf 2023-12-12  201  	mutex_lock(&kho.lock);
4d945e93456555 Alexander Graf 2023-12-12  202  
4d945e93456555 Alexander Graf 2023-12-12  203  	if (!kho.active)
4d945e93456555 Alexander Graf 2023-12-12  204  		goto out;
4d945e93456555 Alexander Graf 2023-12-12  205  
4d945e93456555 Alexander Graf 2023-12-12  206  	/* Initialize kexec_buf for mem_cache */
4d945e93456555 Alexander Graf 2023-12-12  207  	image->kho.mem_cache = (struct kexec_buf) {
4d945e93456555 Alexander Graf 2023-12-12 @208  		.image = image,
4d945e93456555 Alexander Graf 2023-12-12  209  		.buffer = NULL,
4d945e93456555 Alexander Graf 2023-12-12  210  		.bufsz = 0,
4d945e93456555 Alexander Graf 2023-12-12  211  		.mem = KEXEC_BUF_MEM_UNKNOWN,
4d945e93456555 Alexander Graf 2023-12-12  212  		.memsz = 0,
4d945e93456555 Alexander Graf 2023-12-12  213  		.buf_align = SZ_64K, /* Makes it easier to map */
4d945e93456555 Alexander Graf 2023-12-12  214  		.buf_max = ULONG_MAX,
4d945e93456555 Alexander Graf 2023-12-12  215  		.top_down = true,
4d945e93456555 Alexander Graf 2023-12-12  216  	};
4d945e93456555 Alexander Graf 2023-12-12  217  
4d945e93456555 Alexander Graf 2023-12-12  218  	/*
4d945e93456555 Alexander Graf 2023-12-12  219  	 * We need to make all allocations visible here via the mem_cache so that
4d945e93456555 Alexander Graf 2023-12-12  220  	 * kho_is_destination_range() can identify overlapping regions and ensure
4d945e93456555 Alexander Graf 2023-12-12  221  	 * that no kimage (including the DT one) lands on handed over memory.
4d945e93456555 Alexander Graf 2023-12-12  222  	 *
4d945e93456555 Alexander Graf 2023-12-12  223  	 * Since we conveniently already built an array of all allocations, let's
4d945e93456555 Alexander Graf 2023-12-12  224  	 * pass that on to the target kernel so that reuse it to initialize its
4d945e93456555 Alexander Graf 2023-12-12  225  	 * memory blocks.
4d945e93456555 Alexander Graf 2023-12-12  226  	 */
4d945e93456555 Alexander Graf 2023-12-12  227  	err = kho_alloc_mem_cache(image, kho.dt);
4d945e93456555 Alexander Graf 2023-12-12  228  	if (err)
4d945e93456555 Alexander Graf 2023-12-12  229  		goto out;
4d945e93456555 Alexander Graf 2023-12-12  230  
4d945e93456555 Alexander Graf 2023-12-12  231  	err = kexec_add_buffer(&image->kho.mem_cache);
4d945e93456555 Alexander Graf 2023-12-12  232  	if (err)
4d945e93456555 Alexander Graf 2023-12-12  233  		goto out;
4d945e93456555 Alexander Graf 2023-12-12  234  
4d945e93456555 Alexander Graf 2023-12-12  235  	/*
4d945e93456555 Alexander Graf 2023-12-12  236  	 * Create a kexec copy of the DT here. We need this because lifetime may
4d945e93456555 Alexander Graf 2023-12-12  237  	 * be different between kho.dt and the kimage
4d945e93456555 Alexander Graf 2023-12-12  238  	 */
4d945e93456555 Alexander Graf 2023-12-12  239  	dt = kvmemdup(kho.dt, kho.dt_len, GFP_KERNEL);
4d945e93456555 Alexander Graf 2023-12-12  240  	if (!dt) {
4d945e93456555 Alexander Graf 2023-12-12  241  		err = -ENOMEM;
4d945e93456555 Alexander Graf 2023-12-12  242  		goto out;
4d945e93456555 Alexander Graf 2023-12-12  243  	}
4d945e93456555 Alexander Graf 2023-12-12  244  
4d945e93456555 Alexander Graf 2023-12-12  245  	/* Allocate target memory for kho dt */
4d945e93456555 Alexander Graf 2023-12-12  246  	image->kho.dt = (struct kexec_buf) {
4d945e93456555 Alexander Graf 2023-12-12  247  		.image = image,
4d945e93456555 Alexander Graf 2023-12-12  248  		.buffer = dt,
4d945e93456555 Alexander Graf 2023-12-12  249  		.bufsz = kho.dt_len,
4d945e93456555 Alexander Graf 2023-12-12  250  		.mem = KEXEC_BUF_MEM_UNKNOWN,
4d945e93456555 Alexander Graf 2023-12-12  251  		.memsz = kho.dt_len,
4d945e93456555 Alexander Graf 2023-12-12  252  		.buf_align = SZ_64K, /* Makes it easier to map */
4d945e93456555 Alexander Graf 2023-12-12  253  		.buf_max = ULONG_MAX,
4d945e93456555 Alexander Graf 2023-12-12  254  		.top_down = true,
4d945e93456555 Alexander Graf 2023-12-12  255  	};
4d945e93456555 Alexander Graf 2023-12-12  256  	err = kexec_add_buffer(&image->kho.dt);
4d945e93456555 Alexander Graf 2023-12-12  257  
4d945e93456555 Alexander Graf 2023-12-12  258  out:
4d945e93456555 Alexander Graf 2023-12-12  259  	mutex_unlock(&kho.lock);
4d945e93456555 Alexander Graf 2023-12-12  260  	return err;
4d945e93456555 Alexander Graf 2023-12-12  261  }
4d945e93456555 Alexander Graf 2023-12-12  262  

:::::: The code at line 208 was first introduced by commit
:::::: 4d945e934565554b4f997c57162e833303f56cb0 kexec: Add KHO support to kexec file loads

:::::: TO: Alexander Graf <graf@amazon.com>
:::::: CC: Alexander Graf <graf@amazon.com>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2024-05-04 18:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202405050241.50OPTPXf-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=graf@amazon.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.