arch/mips/kvm/vz.c:391:10: warning: variable 'freeze_time' set but not used
From: kernel test robot
Date: Thu Jun 03 2021 - 00:29:17 EST
Hi Thomas,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 324c92e5e0ee0e993bdb106fac407846ed677f6b
commit: 45c7e8af4a5e3f0bea4ac209eea34118dd57ac64 MIPS: Remove KVM_TE support
date: 3 months ago
config: mips-randconfig-r005-20210603 (attached as .config)
compiler: mips-linux-gcc (GCC) 9.3.0
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=45c7e8af4a5e3f0bea4ac209eea34118dd57ac64
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 45c7e8af4a5e3f0bea4ac209eea34118dd57ac64
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
arch/mips/kvm/vz.c: In function '_kvm_vz_restore_htimer':
>> arch/mips/kvm/vz.c:391:10: warning: variable 'freeze_time' set but not used [-Wunused-but-set-variable]
391 | ktime_t freeze_time;
| ^~~~~~~~~~~
--
arch/mips/kvm/vz.c:471: warning: Function parameter or member 'out_compare' not described in '_kvm_vz_save_htimer'
arch/mips/kvm/vz.c:471: warning: Function parameter or member 'out_cause' not described in '_kvm_vz_save_htimer'
arch/mips/kvm/vz.c:471: warning: Excess function parameter 'compare' description in '_kvm_vz_save_htimer'
arch/mips/kvm/vz.c:471: warning: Excess function parameter 'cause' description in '_kvm_vz_save_htimer'
>> arch/mips/kvm/vz.c:1552: warning: expecting prototype for kvm_trap_vz_handle_cop_unusuable(). Prototype was for kvm_trap_vz_handle_cop_unusable() instead
vim +/freeze_time +391 arch/mips/kvm/vz.c
c992a4f6a9b0a3 James Hogan 2017-03-14 377
c992a4f6a9b0a3 James Hogan 2017-03-14 378 /**
f4474d50c7d483 James Hogan 2017-03-14 379 * _kvm_vz_restore_htimer() - Restore hard timer state.
f4474d50c7d483 James Hogan 2017-03-14 380 * @vcpu: Virtual CPU.
f4474d50c7d483 James Hogan 2017-03-14 381 * @compare: CP0_Compare register value, restored by caller.
f4474d50c7d483 James Hogan 2017-03-14 382 * @cause: CP0_Cause register to restore.
f4474d50c7d483 James Hogan 2017-03-14 383 *
f4474d50c7d483 James Hogan 2017-03-14 384 * Restore hard timer Guest.Count & Guest.Cause taking care to preserve the
f4474d50c7d483 James Hogan 2017-03-14 385 * value of Guest.CP0_Cause.TI while restoring Guest.CP0_Cause.
f4474d50c7d483 James Hogan 2017-03-14 386 */
f4474d50c7d483 James Hogan 2017-03-14 387 static void _kvm_vz_restore_htimer(struct kvm_vcpu *vcpu,
f4474d50c7d483 James Hogan 2017-03-14 388 u32 compare, u32 cause)
f4474d50c7d483 James Hogan 2017-03-14 389 {
f4474d50c7d483 James Hogan 2017-03-14 390 u32 start_count, after_count;
f4474d50c7d483 James Hogan 2017-03-14 @391 ktime_t freeze_time;
f4474d50c7d483 James Hogan 2017-03-14 392 unsigned long flags;
f4474d50c7d483 James Hogan 2017-03-14 393
f4474d50c7d483 James Hogan 2017-03-14 394 /*
f4474d50c7d483 James Hogan 2017-03-14 395 * Freeze the soft-timer and sync the guest CP0_Count with it. We do
f4474d50c7d483 James Hogan 2017-03-14 396 * this with interrupts disabled to avoid latency.
f4474d50c7d483 James Hogan 2017-03-14 397 */
f4474d50c7d483 James Hogan 2017-03-14 398 local_irq_save(flags);
f4474d50c7d483 James Hogan 2017-03-14 399 freeze_time = kvm_mips_freeze_hrtimer(vcpu, &start_count);
f4474d50c7d483 James Hogan 2017-03-14 400 write_c0_gtoffset(start_count - read_c0_count());
f4474d50c7d483 James Hogan 2017-03-14 401 local_irq_restore(flags);
f4474d50c7d483 James Hogan 2017-03-14 402
f4474d50c7d483 James Hogan 2017-03-14 403 /* restore guest CP0_Cause, as TI may already be set */
f4474d50c7d483 James Hogan 2017-03-14 404 back_to_back_c0_hazard();
f4474d50c7d483 James Hogan 2017-03-14 405 write_gc0_cause(cause);
f4474d50c7d483 James Hogan 2017-03-14 406
f4474d50c7d483 James Hogan 2017-03-14 407 /*
f4474d50c7d483 James Hogan 2017-03-14 408 * The above sequence isn't atomic and would result in lost timer
f4474d50c7d483 James Hogan 2017-03-14 409 * interrupts if we're not careful. Detect if a timer interrupt is due
f4474d50c7d483 James Hogan 2017-03-14 410 * and assert it.
f4474d50c7d483 James Hogan 2017-03-14 411 */
f4474d50c7d483 James Hogan 2017-03-14 412 back_to_back_c0_hazard();
f4474d50c7d483 James Hogan 2017-03-14 413 after_count = read_gc0_count();
f4474d50c7d483 James Hogan 2017-03-14 414 if (after_count - start_count > compare - start_count - 1)
f4474d50c7d483 James Hogan 2017-03-14 415 kvm_vz_queue_irq(vcpu, MIPS_EXC_INT_TIMER);
f4474d50c7d483 James Hogan 2017-03-14 416 }
f4474d50c7d483 James Hogan 2017-03-14 417
:::::: The code at line 391 was first introduced by commit
:::::: f4474d50c7d483dd4432d5b0891b0bb9ad0eefc9 KVM: MIPS/VZ: Support hardware guest timer
:::::: TO: James Hogan <james.hogan@xxxxxxxxxx>
:::::: CC: James Hogan <james.hogan@xxxxxxxxxx>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip