From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: KVM: pvmmu breakage with gcc 4.3.0 Date: Wed, 25 Jun 2008 23:10:47 -0300 Message-ID: <20080626021047.GA10263@dmt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Alexandre Oliva , kvm-devel To: Avi Kivity , Anthony Liguori Return-path: Received: from mx1.redhat.com ([66.187.233.31]:45542 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752275AbYFZCLY (ORCPT ); Wed, 25 Jun 2008 22:11:24 -0400 Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: Some pvmmu functions store their commands on stack, and newer GCC versions conclude that these commands are unused. So stick an inline asm statement to convince the compiler otherwise. Signed-off-by: Marcelo Tosatti diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index 8b7a3cf..c892752 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c @@ -55,6 +55,12 @@ static void kvm_mmu_op(void *buffer, unsigned len) int r; unsigned long a1, a2; + /* + * GCC 4.3.0 concludes that on-stack kvm_mmu_op* is unused and + * optimizes its initialization away. + */ + asm ("" : : "p" (buffer)); + do { a1 = __pa(buffer); a2 = 0; /* on i386 __pa() always returns <4G */