On 06/17/2015 01:53 PM, Marc Zyngier wrote: > On 17/06/15 12:21, Andre Przywara wrote: >> Currently the ARM GIC checks the number of VCPUs against a fixed >> limit, which is GICv2 specific. Don't pretend we know better than the >> kernel and let's get rid of that explicit check. >> Instead be more relaxed about KVM_CREATE_VCPU failing with EINVAL, >> which is the way the kernel communicates having reached a VCPU limit. >> If we see this and have at least brought up one VCPU already >> successfully, then don't panic, but limit the number of VCPUs instead. >> >> Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx> ... >> diff --git a/arm/kvm-cpu.c b/arm/kvm-cpu.c >> index 7780251..c1cf51d 100644 >> --- a/arm/kvm-cpu.c >> +++ b/arm/kvm-cpu.c >> @@ -47,12 +47,19 @@ struct kvm_cpu *kvm_cpu__arch_init(struct kvm *kvm, unsigned long cpu_id) >> }; >> >> vcpu = calloc(1, sizeof(struct kvm_cpu)); >> - if (!vcpu) >> + if (!vcpu) { >> + errno = ENOMEM; >> return NULL; >> + } > > Isn't errno already set when calloc fails? Ah yes, that seems to be true at least for glibc or UNIX 98, according to the manpage. I was misguided by the fact that calloc is not a syscall. So I can drop this hunk. Thanks, Andre. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html