From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH v2 uq/master] kvmvapic: Disable if there is insufficient memory Date: Tue, 14 Aug 2012 16:01:23 -0300 Message-ID: <20120814190123.GB5281@amt.cnet> References: <502A32BB.2000607@siemens.com> <87txw5itv9.fsf@blackfin.pond.sub.org> <502A39D0.7080702@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Avi Kivity , Markus Armbruster , qemu-devel , kvm To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([209.132.183.28]:32964 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757253Ab2HNTBd (ORCPT ); Tue, 14 Aug 2012 15:01:33 -0400 Content-Disposition: inline In-Reply-To: <502A39D0.7080702@siemens.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Aug 14, 2012 at 01:43:12PM +0200, Jan Kiszka wrote: > We need at least 1M of RAM to map the option ROM. Otherwise, we will > corrupt host memory or even crash: > > $ qemu-system-x86_64 -nodefaults --enable-kvm -vnc :0 -m 640k > Segmentation fault (core dumped) > > Reported-and-tested-by: Markus Armbruster > Signed-off-by: Jan Kiszka > --- > hw/apic_common.c | 4 +++- > 1 files changed, 3 insertions(+), 1 deletions(-) > > diff --git a/hw/apic_common.c b/hw/apic_common.c > index 58e63b0..371f95d 100644 > --- a/hw/apic_common.c > +++ b/hw/apic_common.c > @@ -299,7 +299,9 @@ static int apic_init_common(SysBusDevice *dev) > > sysbus_init_mmio(dev, &s->io_memory); > > - if (!vapic && s->vapic_control & VAPIC_ENABLE_MASK) { > + /* Note: We need at least 1M to map the VAPIC option ROM */ > + if (!vapic && s->vapic_control & VAPIC_ENABLE_MASK && > + ram_size >= 1024 * 1024) { > vapic = sysbus_create_simple("kvmvapic", -1, NULL); > } > s->vapic = vapic; > -- > 1.7.3.4 Applied, thanks.