CC: kbuild-...@lists.01.org
BCC: l...@intel.com
In-Reply-To: <20220403153911.12332-13-gs...@redhat.com>
References: <20220403153911.12332-13-gs...@redhat.com>
TO: Gavin Shan <gs...@redhat.com>
TO: kvm...@lists.cs.columbia.edu
CC: linux-ker...@vger.kernel.org
CC: eau...@redhat.com
CC: oup...@google.com
CC: jonathan.came...@huawei.com
CC: vkuzn...@redhat.com
CC: w...@kernel.org
CC: shannon.zha...@gmail.com
CC: james.mo...@arm.com
CC: mark.rutl...@arm.com
CC: m...@kernel.org
CC: pbonz...@redhat.com
CC: shan.ga...@gmail.com

Hi Gavin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.18-rc1 next-20220404]
[cannot apply to kvmarm/next kvm/master linux/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    
https://github.com/intel-lab-lkp/linux/commits/Gavin-Shan/Support-SDEI-Virtualization/20220403-234350
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
be2d3ecedd9911fbfd7e55cc9ceac5f8b79ae4cf
:::::: branch date: 21 hours ago
:::::: commit date: 21 hours ago
config: arm64-randconfig-c004-20220404 
(https://download.01.org/0day-ci/archive/20220404/202204042058.sdc4q1mb-...@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <l...@intel.com>
Reported-by: Julia Lawall <julia.law...@lip6.fr>


cocci warnings: (new ones prefixed by >>)
>> arch/arm64/kvm/sdei.c:530:3-9: preceding lock on line 500

vim +530 arch/arm64/kvm/sdei.c

4a1a288d49e756 Gavin Shan 2022-04-03  479  
2c24bc7163ddb2 Gavin Shan 2022-04-03  480  int kvm_sdei_inject_event(struct 
kvm_vcpu *vcpu,
2c24bc7163ddb2 Gavin Shan 2022-04-03  481                         unsigned int 
num,
2c24bc7163ddb2 Gavin Shan 2022-04-03  482                         bool 
immediate)
2c24bc7163ddb2 Gavin Shan 2022-04-03  483  {
2c24bc7163ddb2 Gavin Shan 2022-04-03  484       struct kvm_sdei_vcpu *vsdei = 
vcpu->arch.sdei;
2c24bc7163ddb2 Gavin Shan 2022-04-03  485       struct kvm_sdei_exposed_event 
*exposed_event;
2c24bc7163ddb2 Gavin Shan 2022-04-03  486       struct kvm_sdei_event *event;
2c24bc7163ddb2 Gavin Shan 2022-04-03  487       unsigned long event_count = 0;
2c24bc7163ddb2 Gavin Shan 2022-04-03  488       int ret = 0;
2c24bc7163ddb2 Gavin Shan 2022-04-03  489  
2c24bc7163ddb2 Gavin Shan 2022-04-03  490       if (!vsdei) {
2c24bc7163ddb2 Gavin Shan 2022-04-03  491               ret = -EPERM;
2c24bc7163ddb2 Gavin Shan 2022-04-03  492               goto out;
2c24bc7163ddb2 Gavin Shan 2022-04-03  493       }
2c24bc7163ddb2 Gavin Shan 2022-04-03  494  
2c24bc7163ddb2 Gavin Shan 2022-04-03  495       if 
(!kvm_sdei_is_supported(num)) {
2c24bc7163ddb2 Gavin Shan 2022-04-03  496               ret = -EINVAL;
2c24bc7163ddb2 Gavin Shan 2022-04-03  497               goto out;
2c24bc7163ddb2 Gavin Shan 2022-04-03  498       }
2c24bc7163ddb2 Gavin Shan 2022-04-03  499  
2c24bc7163ddb2 Gavin Shan 2022-04-03 @500       spin_lock(&vsdei->lock);
2c24bc7163ddb2 Gavin Shan 2022-04-03  501  
2c24bc7163ddb2 Gavin Shan 2022-04-03  502       /* Check if the vcpu has been 
masked */
2c24bc7163ddb2 Gavin Shan 2022-04-03  503       if (vsdei->masked) {
2c24bc7163ddb2 Gavin Shan 2022-04-03  504               ret = -EPERM;
2c24bc7163ddb2 Gavin Shan 2022-04-03  505               goto unlock;
2c24bc7163ddb2 Gavin Shan 2022-04-03  506       }
2c24bc7163ddb2 Gavin Shan 2022-04-03  507  
2c24bc7163ddb2 Gavin Shan 2022-04-03  508       /* Check if the event exists */
2c24bc7163ddb2 Gavin Shan 2022-04-03  509       event = find_event(vcpu, num);
2c24bc7163ddb2 Gavin Shan 2022-04-03  510       if (!event) {
2c24bc7163ddb2 Gavin Shan 2022-04-03  511               ret = -ENOENT;
2c24bc7163ddb2 Gavin Shan 2022-04-03  512               goto unlock;
2c24bc7163ddb2 Gavin Shan 2022-04-03  513       }
2c24bc7163ddb2 Gavin Shan 2022-04-03  514  
2c24bc7163ddb2 Gavin Shan 2022-04-03  515       /*
2c24bc7163ddb2 Gavin Shan 2022-04-03  516        * In some cases, the injected 
event is expected to be delivered
2c24bc7163ddb2 Gavin Shan 2022-04-03  517        * immediately. However, there 
are two cases the injected event
2c24bc7163ddb2 Gavin Shan 2022-04-03  518        * can't be delivered 
immediately: (a) the injected event is a
2c24bc7163ddb2 Gavin Shan 2022-04-03  519        * critical one, but we already 
have pending critical events for
2c24bc7163ddb2 Gavin Shan 2022-04-03  520        * delivery. (b) the injected 
event is a normal one, but we have
2c24bc7163ddb2 Gavin Shan 2022-04-03  521        * pending events for delivery, 
regardless of their priorities.
2c24bc7163ddb2 Gavin Shan 2022-04-03  522        */
2c24bc7163ddb2 Gavin Shan 2022-04-03  523       if (immediate) {
2c24bc7163ddb2 Gavin Shan 2022-04-03  524               exposed_event = 
event->exposed_event;
2c24bc7163ddb2 Gavin Shan 2022-04-03  525               event_count = 
vsdei->critical_event_count;
2c24bc7163ddb2 Gavin Shan 2022-04-03  526               if 
(kvm_sdei_is_normal(exposed_event->priority))
2c24bc7163ddb2 Gavin Shan 2022-04-03  527                       event_count += 
vsdei->normal_event_count;
2c24bc7163ddb2 Gavin Shan 2022-04-03  528  
2c24bc7163ddb2 Gavin Shan 2022-04-03  529               if (event_count > 0)
2c24bc7163ddb2 Gavin Shan 2022-04-03 @530                       return -ENOSPC;
2c24bc7163ddb2 Gavin Shan 2022-04-03  531       }
2c24bc7163ddb2 Gavin Shan 2022-04-03  532  
2c24bc7163ddb2 Gavin Shan 2022-04-03  533       ret = inject_event(vcpu, event);
2c24bc7163ddb2 Gavin Shan 2022-04-03  534  
2c24bc7163ddb2 Gavin Shan 2022-04-03  535  unlock:
2c24bc7163ddb2 Gavin Shan 2022-04-03  536       spin_unlock(&vsdei->lock);
2c24bc7163ddb2 Gavin Shan 2022-04-03  537  out:
2c24bc7163ddb2 Gavin Shan 2022-04-03  538       return ret;
2c24bc7163ddb2 Gavin Shan 2022-04-03  539  }
2c24bc7163ddb2 Gavin Shan 2022-04-03  540  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org

Reply via email to