drivers/gpio/gpio-virtio.c:23:8: warning: Excessive padding in 'struct virtio_gpio_line' (122 padding bytes, where 58 is optimal).

From: kernel test robot
Date: Tue Sep 14 2021 - 02:22:25 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 78e709522d2c012cb0daad2e668506637bffb7c2
commit: 3a29355a22c0275fe864100794fee58a73175d93 gpio: Add virtio-gpio driver
date: 3 weeks ago
:::::: branch date: 19 hours ago
:::::: commit date: 3 weeks ago
config: x86_64-randconfig-c007-20210911 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 261cbe98c38f8c1ee1a482fe76511110e790f58a)
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://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3a29355a22c0275fe864100794fee58a73175d93
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 3a29355a22c0275fe864100794fee58a73175d93
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


clang-analyzer warnings: (new ones prefixed by >>)

>> drivers/gpio/gpio-virtio.c:23:8: warning: Excessive padding in 'struct virtio_gpio_line' (122 padding bytes, where 58 is optimal).
Optimal fields order:
res,
rxlen,
completion,
lock,
req,
consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]


vim +23 drivers/gpio/gpio-virtio.c

3a29355a22c027 Viresh Kumar 2021-08-19 22
3a29355a22c027 Viresh Kumar 2021-08-19 @23 struct virtio_gpio_line {
3a29355a22c027 Viresh Kumar 2021-08-19 24 struct mutex lock; /* Protects line operation */
3a29355a22c027 Viresh Kumar 2021-08-19 25 struct completion completion;
3a29355a22c027 Viresh Kumar 2021-08-19 26 struct virtio_gpio_request req ____cacheline_aligned;
3a29355a22c027 Viresh Kumar 2021-08-19 27 struct virtio_gpio_response res ____cacheline_aligned;
3a29355a22c027 Viresh Kumar 2021-08-19 28 unsigned int rxlen;
3a29355a22c027 Viresh Kumar 2021-08-19 29 };
3a29355a22c027 Viresh Kumar 2021-08-19 30

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

Attachment: .config.gz
Description: application/gzip