Skip to contentSkip to conversation

arch/x86/kvm/svm/sev.c:1380:2-8: preceding lock on line 1375 (fwd)

PATCH In review Julia Lawall 4 participants 4 messages Apr 4, 2021 – Apr 6, 2021 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 120/120 arch/x86/kvm/svm/sev.c:1380:2-8: preceding lock on line 1375 (fwd)

Is an unlock needed on line 1380?

julia

---------- Forwarded message ----------
Date: Sat, 3 Apr 2021 09:55:24 +0800
From: kernel test robot <[email protected]>
To: kbuild(a)lists.01.org
Cc: lkp(a)intel.com, Julia Lawall <[email protected]>
Subject: [kvm:queue 120/120] arch/x86/kvm/svm/sev.c:1380:2-8: preceding lock on

    line 1375

CC: kbuild-all(a)lists.01.org
CC: kvm(a)vger.kernel.org
CC: Robert Hu <[email protected]>
CC: Farrah Chen <[email protected]>
CC: Danmei Wei <[email protected]>
TO: Nathan Tempelman <[email protected]>
CC: Paolo Bonzini <[email protected]>

tree:   https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue
head:   f96be2deac9bca3ef5a2b0b66b71fcef8bad586d
commit: f96be2deac9bca3ef5a2b0b66b71fcef8bad586d [120/120] KVM: x86: Support KVM VMs sharing SEV context

:::::: branch date: 10 hours ago
:::::: commit date: 10 hours ago
config: i386-allmodconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate

cocci warnings: (new ones prefixed by >>)

Quoted 1 line
Quoted 1 line

arch/x86/kvm/svm/sev.c:1380:2-8: preceding lock on line 1375

vim +1380 arch/x86/kvm/svm/sev.c

f96be2deac9bca Nathan Tempelman 2021-03-16  1365
eaf78265a4ab33 Joerg Roedel     2020-03-24  1366  void sev_vm_destroy(struct kvm *kvm)
eaf78265a4ab33 Joerg Roedel     2020-03-24  1367  {
eaf78265a4ab33 Joerg Roedel     2020-03-24  1368  	struct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;
eaf78265a4ab33 Joerg Roedel     2020-03-24  1369  	struct list_head *head = &sev->regions_list;
eaf78265a4ab33 Joerg Roedel     2020-03-24  1370  	struct list_head *pos, *q;
eaf78265a4ab33 Joerg Roedel     2020-03-24  1371
eaf78265a4ab33 Joerg Roedel     2020-03-24  1372  	if (!sev_guest(kvm))
eaf78265a4ab33 Joerg Roedel     2020-03-24  1373  		return;
eaf78265a4ab33 Joerg Roedel     2020-03-24  1374
eaf78265a4ab33 Joerg Roedel     2020-03-24 @1375  	mutex_lock(&kvm->lock);
eaf78265a4ab33 Joerg Roedel     2020-03-24  1376
f96be2deac9bca Nathan Tempelman 2021-03-16  1377  	/* If this is a mirror_kvm release the enc_context_owner and skip sev cleanup */
f96be2deac9bca Nathan Tempelman 2021-03-16  1378  	if (is_mirroring_enc_context(kvm)) {
f96be2deac9bca Nathan Tempelman 2021-03-16  1379  		kvm_put_kvm(sev->enc_context_owner);
f96be2deac9bca Nathan Tempelman 2021-03-16 @1380  		return;
f96be2deac9bca Nathan Tempelman 2021-03-16  1381  	}
f96be2deac9bca Nathan Tempelman 2021-03-16  1382
eaf78265a4ab33 Joerg Roedel     2020-03-24  1383  	/*
eaf78265a4ab33 Joerg Roedel     2020-03-24  1384  	 * Ensure that all guest tagged cache entries are flushed before
eaf78265a4ab33 Joerg Roedel     2020-03-24  1385  	 * releasing the pages back to the system for use. CLFLUSH will
eaf78265a4ab33 Joerg Roedel     2020-03-24  1386  	 * not do this, so issue a WBINVD.
eaf78265a4ab33 Joerg Roedel     2020-03-24  1387  	 */
eaf78265a4ab33 Joerg Roedel     2020-03-24  1388  	wbinvd_on_all_cpus();
eaf78265a4ab33 Joerg Roedel     2020-03-24  1389
eaf78265a4ab33 Joerg Roedel     2020-03-24  1390  	/*
eaf78265a4ab33 Joerg Roedel     2020-03-24  1391  	 * if userspace was terminated before unregistering the memory regions
eaf78265a4ab33 Joerg Roedel     2020-03-24  1392  	 * then lets unpin all the registered memory.
eaf78265a4ab33 Joerg Roedel     2020-03-24  1393  	 */
eaf78265a4ab33 Joerg Roedel     2020-03-24  1394  	if (!list_empty(head)) {
eaf78265a4ab33 Joerg Roedel     2020-03-24  1395  		list_for_each_safe(pos, q, head) {
eaf78265a4ab33 Joerg Roedel     2020-03-24  1396  			__unregister_enc_region_locked(kvm,
eaf78265a4ab33 Joerg Roedel     2020-03-24  1397  				list_entry(pos, struct enc_region, list));
7be74942f184fd David Rientjes   2020-08-25  1398  			cond_resched();
eaf78265a4ab33 Joerg Roedel     2020-03-24  1399  		}
eaf78265a4ab33 Joerg Roedel     2020-03-24  1400  	}
eaf78265a4ab33 Joerg Roedel     2020-03-24  1401
eaf78265a4ab33 Joerg Roedel     2020-03-24  1402  	mutex_unlock(&kvm->lock);
eaf78265a4ab33 Joerg Roedel     2020-03-24  1403
eaf78265a4ab33 Joerg Roedel     2020-03-24  1404  	sev_unbind_asid(kvm, sev->handle);
eaf78265a4ab33 Joerg Roedel     2020-03-24  1405  	sev_asid_free(sev->asid);
eaf78265a4ab33 Joerg Roedel     2020-03-24  1406  }
eaf78265a4ab33 Joerg Roedel     2020-03-24  1407

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

#1 lore raw
Quoted 1 line · Julia Lawall

Is an unlock needed on line 1380?

Yep, I reported it as well, but only after it was queued. I'm guessing Paolo will tweak the patch or drop it for now.

Thanks!

Quoted 6 lines
f96be2deac9bca Nathan Tempelman 2021-03-16  1377  	/* If this is a mirror_kvm release the enc_context_owner and skip sev cleanup */
f96be2deac9bca Nathan Tempelman 2021-03-16  1378  	if (is_mirroring_enc_context(kvm)) {
f96be2deac9bca Nathan Tempelman 2021-03-16  1379  		kvm_put_kvm(sev->enc_context_owner);
f96be2deac9bca Nathan Tempelman 2021-03-16 @1380  		return;
f96be2deac9bca Nathan Tempelman 2021-03-16  1381  	}

f96be2deac9bca Nathan Tempelman 2021-03-16 1382

maintainer
#2 lore raw
Quoted 6 lines · Sean Christopherson
Quoted 1 line · Julia Lawall

Is an unlock needed on line 1380?

Yep, I reported it as well, but only after it was queued. I'm guessing Paolo will tweak the patch or drop it for now.

Yeah, it's a public holiday here but either Nathan or I will post v3.

Paolo

#3 lore raw

Yeah I've got the fix for this pending, Sean did call it out last week after it was queued. I've been trying to get a self test built to verify this patch before pushing the v3 since I thought I had some time before the next release closes, but I can go ahead and get out the v3 asap and keep you all updated if the self tests turn anything up.

Quoted 13 lines · Paolo Bonzini
Quoted 6 lines · Sean Christopherson
Quoted 1 line · Julia Lawall

Is an unlock needed on line 1380?

Yep, I reported it as well, but only after it was queued. I'm guessing Paolo will tweak the patch or drop it for now.

Yeah, it's a public holiday here but either Nathan or I will post v3.

Paolo