From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Tokarev Subject: SIGSEGV with -smp 17+, and error handling around... Date: Wed, 17 Mar 2010 23:12:04 +0300 Message-ID: <4BA13794.9080401@msgid.tls.msk.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit To: KVM list Return-path: Received: from isrv.corpit.ru ([81.13.33.159]:50476 "EHLO isrv.corpit.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756073Ab0CQUMI (ORCPT ); Wed, 17 Mar 2010 16:12:08 -0400 Sender: kvm-owner@vger.kernel.org List-ID: When run with -smp 17 or greather, kvm fails like this: $ kvm -smp 17 kvm_create_vcpu: Invalid argument kvm_setup_mce FAILED: Invalid argument KVM_SET_LAPIC failed Segmentation fault $ _ In qemu-kvm.c, the kvm_create_vcpu() routine (which is used in a vcpu thread to set up vcpu) is declared as void, i.e, no error return. And the code that calls it blindly assumes that it will never fail... But the first error message above is from kernel, which - apparently - refuses to create 17th vCPU. Hence we've a vcpu thread which is empty/dummy and not even fully initialized... so it fails later in the game. This all looks quite... raw, not polished ;) Can we somehow handle the (several possible) errors in that (and other) places, and how we ever can act on them? Abort? Warn the user and reduce the number of vcpus accordingly (seems wrong, esp. if it were some first vcpus or in the middle which failed)... Thanks! /mjt