linux-next: manual merge of the cgroup tree with the kvm tree

From: Stephen Rothwell
Date: Thu Apr 22 2021 - 01:54:15 EST


Hi all,

Today's linux-next merge of the cgroup tree got conflicts in:

arch/x86/kvm/svm/sev.c

between commit:

9fa1521daafb ("KVM: SVM: Do not set sev->es_active until KVM_SEV_ES_INIT completes")

from the kvm tree and commit:

7aef27f0b2a8 ("svm/sev: Register SEV and SEV-ES ASIDs to the misc controller")

from the cgroup tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

--
Cheers,
Stephen Rothwell

diff --cc arch/x86/kvm/svm/sev.c
index 63923fa0b172,214eefb20414..000000000000
--- a/arch/x86/kvm/svm/sev.c
+++ b/arch/x86/kvm/svm/sev.c
@@@ -93,10 -103,21 +109,21 @@@ static bool __sev_recycle_asids(int min
return true;
}

-static int sev_asid_new(struct kvm_sev_info *sev)
+static int sev_asid_new(bool es_active)
{
- int pos, min_asid, max_asid;
+ int pos, min_asid, max_asid, ret;
bool retry = true;
+ enum misc_res_type type;
+
+ type = sev->es_active ? MISC_CG_RES_SEV_ES : MISC_CG_RES_SEV;
+ WARN_ON(sev->misc_cg);
+ sev->misc_cg = get_current_misc_cg();
+ ret = misc_cg_try_charge(type, sev->misc_cg, 1);
+ if (ret) {
+ put_misc_cg(sev->misc_cg);
+ sev->misc_cg = NULL;
+ return ret;
+ }

mutex_lock(&sev_bitmap_lock);

@@@ -182,17 -224,16 +221,17 @@@ static int sev_guest_init(struct kvm *k
if (unlikely(sev->active))
return ret;

- asid = sev_asid_new(sev);
+ asid = sev_asid_new(es_active);
if (asid < 0)
return ret;
+ sev->asid = asid;

ret = sev_platform_init(&argp->error);
if (ret)
goto e_free;

sev->active = true;
+ sev->es_active = es_active;
- sev->asid = asid;
INIT_LIST_HEAD(&sev->regions_list);

return 0;

Attachment: pgpkhNhriojwJ.pgp
Description: OpenPGP digital signature