mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: "Chang S. Bae" <chang.seok.bae@intel.com>
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org
Subject: [intel-amx:init_fpstate 2/3] arch/x86/kernel/fpu/xstate.c:362:24: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long'
Date: Tue, 9 Aug 2022 15:04:31 +0800	[thread overview]
Message-ID: <202208091405.uYHLXk68-lkp@intel.com> (raw)

tree:   https://github.com/intel/amx-linux.git init_fpstate
head:   b1323896658f2b069193a782265a47e3c99611e4
commit: 86878d20f388dc243b534c20a5de1bedfb534df1 [2/3] x86/fpu: Avoid the init XSTATE buffer overflow
config: x86_64-randconfig-r023-20220808 (https://download.01.org/0day-ci/archive/20220809/202208091405.uYHLXk68-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 5f1c7e2cc5a3c07cbc2412e851a7283c1841f520)
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/intel/amx-linux/commit/86878d20f388dc243b534c20a5de1bedfb534df1
        git remote add intel-amx https://github.com/intel/amx-linux.git
        git fetch --no-tags intel-amx init_fpstate
        git checkout 86878d20f388dc243b534c20a5de1bedfb534df1
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash arch/x86/kernel/fpu/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> arch/x86/kernel/fpu/xstate.c:362:24: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat]
                          "%u bytes\n", sizeof(union fpregs_state), init_fpstate.size);
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:507:33: note: expanded from macro 'pr_err'
           printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
                                  ~~~     ^~~~~~~~~~~
   include/linux/printk.h:464:60: note: expanded from macro 'printk'
   #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
                                                       ~~~    ^~~~~~~~~~~
   include/linux/printk.h:436:19: note: expanded from macro 'printk_index_wrap'
                   _p_func(_fmt, ##__VA_ARGS__);                           \
                           ~~~~    ^~~~~~~~~~~
   1 warning generated.


vim +362 arch/x86/kernel/fpu/xstate.c

   328	
   329	/*
   330	 * All supported features have either init state all zeros or are
   331	 * handled in setup_init_fpu() individually. This is an explicit
   332	 * feature list and does not use XFEATURE_MASK*SUPPORTED to catch
   333	 * newly added supported features at build time and make people
   334	 * actually look at the init state for the new feature.
   335	 */
   336	#define XFEATURES_INIT_FPSTATE_HANDLED		\
   337		(XFEATURE_MASK_FP |			\
   338		 XFEATURE_MASK_SSE |			\
   339		 XFEATURE_MASK_YMM |			\
   340		 XFEATURE_MASK_OPMASK |			\
   341		 XFEATURE_MASK_ZMM_Hi256 |		\
   342		 XFEATURE_MASK_Hi16_ZMM	 |		\
   343		 XFEATURE_MASK_PKRU |			\
   344		 XFEATURE_MASK_BNDREGS |		\
   345		 XFEATURE_MASK_BNDCSR |			\
   346		 XFEATURE_MASK_PASID |			\
   347		 XFEATURE_MASK_XTILE)
   348	
   349	/*
   350	 * setup the xstate image representing the init state
   351	 */
   352	static int __init setup_init_fpu_buf(void)
   353	{
   354		BUILD_BUG_ON((XFEATURE_MASK_USER_SUPPORTED |
   355			      XFEATURE_MASK_SUPERVISOR_SUPPORTED) !=
   356			     XFEATURES_INIT_FPSTATE_HANDLED);
   357	
   358		print_xstate_features();
   359	
   360		if (init_fpstate.size > sizeof(union fpregs_state)) {
   361			pr_err("x86/fpu: init_fpstate (%u bytes) is not enough for the configured size:"
 > 362			       "%u bytes\n", sizeof(union fpregs_state), init_fpstate.size);
   363			return -EINVAL;
   364		}
   365	
   366		xstate_init_xcomp_bv(&init_fpstate.regs.xsave, init_fpstate.xfeatures);
   367	
   368		/*
   369		 * Init all the features state with header.xfeatures being 0x0
   370		 */
   371		os_xrstor_booting(&init_fpstate.regs.xsave);
   372	
   373		/*
   374		 * All components are now in init state. Read the state back so
   375		 * that init_fpstate contains all non-zero init state. This only
   376		 * works with XSAVE, but not with XSAVEOPT and XSAVEC/S because
   377		 * those use the init optimization which skips writing data for
   378		 * components in init state.
   379		 *
   380		 * XSAVE could be used, but that would require to reshuffle the
   381		 * data when XSAVEC/S is available because XSAVEC/S uses xstate
   382		 * compaction. But doing so is a pointless exercise because most
   383		 * components have an all zeros init state except for the legacy
   384		 * ones (FP and SSE). Those can be saved with FXSAVE into the
   385		 * legacy area. Adding new features requires to ensure that init
   386		 * state is all zeroes or if not to add the necessary handling
   387		 * here.
   388		 */
   389		fxsave(&init_fpstate.regs.fxsave);
   390		return 0;
   391	}
   392	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

                 reply	other threads:[~2022-08-09  7:04 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=202208091405.uYHLXk68-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=chang.seok.bae@intel.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®