All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: David Woodhouse <dwmw@amazon.co.uk>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [dwmw2:pfncache-2 27/27] arch/x86/kvm/../../../virt/kvm/kvm_main.c:757:45: warning: unused variable 'hva_range'
Date: Wed, 7 Aug 2024 20:25:17 +0800	[thread overview]
Message-ID: <202408072043.UtIA4nWr-lkp@intel.com> (raw)

tree:   git://git.infradead.org/users/dwmw2/linux pfncache-2
head:   137c4fcbf73fb8797363cbb89e63f31504443ddc
commit: 137c4fcbf73fb8797363cbb89e63f31504443ddc [27/27] KVM: pfncache: Protect against GPC becoming active while invalidation is active
config: i386-allmodconfig (https://download.01.org/0day-ci/archive/20240807/202408072043.UtIA4nWr-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240807/202408072043.UtIA4nWr-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/202408072043.UtIA4nWr-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   arch/x86/kvm/../../../virt/kvm/kvm_main.c: In function 'kvm_mmu_notifier_invalidate_range_start':
>> arch/x86/kvm/../../../virt/kvm/kvm_main.c:778:58: error: expected ')' before '{' token
     778 |         if (likely(kvm->mn_active_invalidate_count == 1) {
         |            ~                                             ^
>> arch/x86/kvm/../../../virt/kvm/kvm_main.c:807:1: error: expected expression before '}' token
     807 | }
         | ^
>> arch/x86/kvm/../../../virt/kvm/kvm_main.c:757:45: warning: unused variable 'hva_range' [-Wunused-variable]
     757 |         const struct kvm_mmu_notifier_range hva_range = {
         |                                             ^~~~~~~~~
>> arch/x86/kvm/../../../virt/kvm/kvm_main.c:807:1: warning: no return statement in function returning non-void [-Wreturn-type]
     807 | }
         | ^


vim +/hva_range +757 arch/x86/kvm/../../../virt/kvm/kvm_main.c

8569992d64b8f7 Chao Peng           2023-10-27  752  
f922bd9bf33bd5 Sean Christopherson 2021-04-01  753  static int kvm_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn,
f922bd9bf33bd5 Sean Christopherson 2021-04-01  754  					const struct mmu_notifier_range *range)
f922bd9bf33bd5 Sean Christopherson 2021-04-01  755  {
f922bd9bf33bd5 Sean Christopherson 2021-04-01  756  	struct kvm *kvm = mmu_notifier_to_kvm(mn);
e97b39c5c4362d Sean Christopherson 2023-10-27 @757  	const struct kvm_mmu_notifier_range hva_range = {
f922bd9bf33bd5 Sean Christopherson 2021-04-01  758  		.start		= range->start,
f922bd9bf33bd5 Sean Christopherson 2021-04-01  759  		.end		= range->end,
8569992d64b8f7 Chao Peng           2023-10-27  760  		.handler	= kvm_mmu_unmap_gfn_range,
20ec3ebd707c77 Chao Peng           2022-08-16  761  		.on_lock	= kvm_mmu_invalidate_begin,
f922bd9bf33bd5 Sean Christopherson 2021-04-01  762  		.flush_on_ret	= true,
f922bd9bf33bd5 Sean Christopherson 2021-04-01  763  		.may_block	= mmu_notifier_range_blockable(range),
f922bd9bf33bd5 Sean Christopherson 2021-04-01  764  	};
565f3be2174611 Takuya Yoshikawa    2012-02-10  765  
f922bd9bf33bd5 Sean Christopherson 2021-04-01  766  	trace_kvm_unmap_hva_range(range->start, range->end);
f922bd9bf33bd5 Sean Christopherson 2021-04-01  767  
52ac8b358b0cb7 Paolo Bonzini       2021-05-27  768  	/*
52ac8b358b0cb7 Paolo Bonzini       2021-05-27  769  	 * Prevent memslot modification between range_start() and range_end()
52ac8b358b0cb7 Paolo Bonzini       2021-05-27  770  	 * so that conditionally locking provides the same result in both
20ec3ebd707c77 Chao Peng           2022-08-16  771  	 * functions.  Without that guarantee, the mmu_invalidate_in_progress
52ac8b358b0cb7 Paolo Bonzini       2021-05-27  772  	 * adjustments will be imbalanced.
52ac8b358b0cb7 Paolo Bonzini       2021-05-27  773  	 *
52ac8b358b0cb7 Paolo Bonzini       2021-05-27  774  	 * Pairs with the decrement in range_end().
52ac8b358b0cb7 Paolo Bonzini       2021-05-27  775  	 */
52ac8b358b0cb7 Paolo Bonzini       2021-05-27  776  	spin_lock(&kvm->mn_invalidate_lock);
52ac8b358b0cb7 Paolo Bonzini       2021-05-27  777  	kvm->mn_active_invalidate_count++;
137c4fcbf73fb8 David Woodhouse     2024-08-06 @778  	if (likely(kvm->mn_active_invalidate_count == 1) {
137c4fcbf73fb8 David Woodhouse     2024-08-06  779  		kvm->mmu_gpc_invalidate_range_start = range->start;
137c4fcbf73fb8 David Woodhouse     2024-08-06  780  		kvm->mmu_gpc_invalidate_range_end = range->end;
137c4fcbf73fb8 David Woodhouse     2024-08-06  781  	} else {
137c4fcbf73fb8 David Woodhouse     2024-08-06  782  		/*
137c4fcbf73fb8 David Woodhouse     2024-08-06  783  		 * Fully tracking multiple concurrent ranges has diminishing
137c4fcbf73fb8 David Woodhouse     2024-08-06  784  		 * returns. Keep things simple and just find the minimal range
137c4fcbf73fb8 David Woodhouse     2024-08-06  785  		 * which includes the current and new ranges. As there won't be
137c4fcbf73fb8 David Woodhouse     2024-08-06  786  		 * enough information to subtract a range after its invalidate
137c4fcbf73fb8 David Woodhouse     2024-08-06  787  		 * completes, any ranges invalidated concurrently will
137c4fcbf73fb8 David Woodhouse     2024-08-06  788  		 * accumulate and persist until all outstanding invalidates
137c4fcbf73fb8 David Woodhouse     2024-08-06  789  		 * complete.
137c4fcbf73fb8 David Woodhouse     2024-08-06  790  		 */
137c4fcbf73fb8 David Woodhouse     2024-08-06  791  		kvm->mmu_gpc_invalidate_range_start =
137c4fcbf73fb8 David Woodhouse     2024-08-06  792  			min(kvm->mmu_gpc_invalidate_range_start, range->start);
137c4fcbf73fb8 David Woodhouse     2024-08-06  793  		kvm->mmu_gpc_invalidate_range_end =
137c4fcbf73fb8 David Woodhouse     2024-08-06  794  			max(kvm->mmu_gpc_invalidate_range_end, range->end);
137c4fcbf73fb8 David Woodhouse     2024-08-06  795  	}
52ac8b358b0cb7 Paolo Bonzini       2021-05-27  796  	spin_unlock(&kvm->mn_invalidate_lock);
52ac8b358b0cb7 Paolo Bonzini       2021-05-27  797  
cec29eef0a8153 Sean Christopherson 2023-10-27  798  	/*
cec29eef0a8153 Sean Christopherson 2023-10-27  799  	 * If one or more memslots were found and thus zapped, notify arch code
cec29eef0a8153 Sean Christopherson 2023-10-27  800  	 * that guest memory has been reclaimed.  This needs to be done *after*
cec29eef0a8153 Sean Christopherson 2023-10-27  801  	 * dropping mmu_lock, as x86's reclaim path is slooooow.
cec29eef0a8153 Sean Christopherson 2023-10-27  802  	 */
cec29eef0a8153 Sean Christopherson 2023-10-27  803  	if (__kvm_handle_hva_range(kvm, &hva_range).found_memslot)
cec29eef0a8153 Sean Christopherson 2023-10-27  804  		kvm_arch_guest_memory_reclaimed(kvm);
93065ac753e444 Michal Hocko        2018-08-21  805  
e649b3f0188f8f Eiichi Tsukata      2020-06-06  806  	return 0;
e930bffe95e1e8 Andrea Arcangeli    2008-07-25 @807  }
e930bffe95e1e8 Andrea Arcangeli    2008-07-25  808  

:::::: The code at line 757 was first introduced by commit
:::::: e97b39c5c4362dc1cbc37a563ddac313b96c84f3 KVM: Tweak kvm_hva_range and hva_handler_t to allow reusing for gfn ranges

:::::: TO: Sean Christopherson <seanjc@google.com>
:::::: CC: Paolo Bonzini <pbonzini@redhat.com>

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

                 reply	other threads:[~2024-08-07 12:25 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=202408072043.UtIA4nWr-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=dwmw@amazon.co.uk \
    --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.