From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ingo Molnar Subject: Re: [PATCH] kvm tools: Fix type mismatches on GCC 4.4 on 32-bit systems Date: Fri, 13 May 2011 12:05:59 +0200 Message-ID: <20110513100559.GB21022@elte.hu> References: <20110513081909.GA14603@elte.hu> <1305277917.25256.2.camel@lappy> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Pekka Enberg , KVM devel mailing list To: Sasha Levin Return-path: Received: from mx3.mail.elte.hu ([157.181.1.138]:59732 "EHLO mx3.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753594Ab1EMKGJ (ORCPT ); Fri, 13 May 2011 06:06:09 -0400 Content-Disposition: inline In-Reply-To: <1305277917.25256.2.camel@lappy> Sender: kvm-owner@vger.kernel.org List-ID: * Sasha Levin wrote: > On Fri, 2011-05-13 at 10:19 +0200, Ingo Molnar wrote: > > FYI, the tools/kvm build still fails on 32-bit: > >=20 > > cc1: warnings being treated as errors > > qcow.c: In function =E2=80=98qcow1_write_sector=E2=80=99: > > qcow.c:307: error: comparison between signed and unsigned integer = expressions > > make: *** [qcow.o] Error 1 > > make: *** Waiting for unfinished jobs.... > >=20 > > using: > >=20 > > gcc version 4.4.4 20100630 (Red Hat 4.4.4-10) (GCC) > >=20 > > The patch below addresses them but i haven't tested it beyond check= ing that it=20 > > builds. > >=20 > > The double cast of userspace_addr is doubly sad - it highlights our= 32-bitness=20 > > problems which are visible in the guest_pfn_to_host() function as w= ell. >=20 > KVM API uses 64-bit addresses no matter the host bitness, so we can't > really get around doing these sort of casts. that bit is OK - the KVM ABI has to be for the largest bit width. Note that this kind of ABI compatibility allows (in theory) to run a 32= -bit kvm=20 binary on a 64-bit kernel, and still everything would work despite hype= rvisor=20 user-space being 32-bit. So the cast to (unsigned long) is fine and clean. Thanks, Ingo