linux-next: build failure after merge of the cgroup tree

From: Stephen Rothwell
Date: Thu Apr 22 2021 - 02:31:28 EST


Hi all,

After merging the cgroup tree, today's linux-next build (x86_64
allmodconfig) failed like this:

arch/x86/kvm/svm/sev.c: In function 'sev_asid_new':
arch/x86/kvm/svm/sev.c:118:12: error: invalid type argument of '->' (have 'int')
118 | type = sev->es_active ? MISC_CG_RES_SEV_ES : MISC_CG_RES_SEV;
| ^~
In file included from arch/x86/include/asm/bug.h:93,
from include/linux/bug.h:5,
from include/linux/mmdebug.h:5,
from include/linux/percpu.h:5,
from include/linux/context_tracking_state.h:5,
from include/linux/hardirq.h:5,
from include/linux/kvm_host.h:7,
from arch/x86/kvm/svm/sev.c:11:
arch/x86/kvm/svm/sev.c:119:13: error: invalid type argument of '->' (have 'int')
119 | WARN_ON(sev->misc_cg);
| ^~
arch/x86/kvm/svm/sev.c:119:2: note: in expansion of macro 'WARN_ON'
119 | WARN_ON(sev->misc_cg);
| ^~~~~~~
arch/x86/kvm/svm/sev.c:120:5: error: invalid type argument of '->' (have 'int')
120 | sev->misc_cg = get_current_misc_cg();
| ^~
arch/x86/kvm/svm/sev.c:121:36: error: invalid type argument of '->' (have 'int')
121 | ret = misc_cg_try_charge(type, sev->misc_cg, 1);
| ^~
arch/x86/kvm/svm/sev.c:123:18: error: invalid type argument of '->' (have 'int')
123 | put_misc_cg(sev->misc_cg);
| ^~
arch/x86/kvm/svm/sev.c:124:6: error: invalid type argument of '->' (have 'int')
124 | sev->misc_cg = NULL;
| ^~
arch/x86/kvm/svm/sev.c:154:28: error: invalid type argument of '->' (have 'int')
154 | misc_cg_uncharge(type, sev->misc_cg, 1);
| ^~
arch/x86/kvm/svm/sev.c:155:17: error: invalid type argument of '->' (have 'int')
155 | put_misc_cg(sev->misc_cg);
| ^~
arch/x86/kvm/svm/sev.c:156:5: error: invalid type argument of '->' (have 'int')
156 | sev->misc_cg = NULL;
| ^~

Caused by commit

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

interacting with commit

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

from the kvm tree.

I have applied the following for today, better suggestions welcome.

From: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
Date: Thu, 22 Apr 2021 16:13:34 +1000
Subject: [PATCH] fixup for "KVM: SVM: Do not set sev->es_active until KVM_SEV_ES_INIT completes"

Signed-off-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
---
arch/x86/kvm/svm/sev.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
index 5ae091509bb0..3458710a9729 100644
--- a/arch/x86/kvm/svm/sev.c
+++ b/arch/x86/kvm/svm/sev.c
@@ -109,13 +109,13 @@ static bool __sev_recycle_asids(int min_asid, int max_asid)
return true;
}

-static int sev_asid_new(bool es_active)
+static int sev_asid_new(bool es_active, struct kvm_sev_info *sev)
{
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;
+ type = 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);
@@ -221,7 +221,7 @@ static int sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp)
if (unlikely(sev->active))
return ret;

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

--
Cheers,
Stephen Rothwell

Attachment: pgp1TYYojcJZe.pgp
Description: OpenPGP digital signature