From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH 4/4] Hack around IOMMU changes Date: Wed, 26 May 2010 21:22:39 +0200 Message-ID: <4BFD74FF.3040507@web.de> References: <4BFC974D.8010206@redhat.com> <4BFC9765.6070200@redhat.com> <4BFCD05D.4000603@web.de> <4BFD6862.6010107@redhat.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig4392C99D0FD0FC00B6D50AE5" Cc: kvm , Avi Kivity , Gleb Natapov To: Zachary Amsden Return-path: Received: from fmmailgate01.web.de ([217.72.192.221]:57592 "EHLO fmmailgate01.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755054Ab0EZTWp (ORCPT ); Wed, 26 May 2010 15:22:45 -0400 In-Reply-To: <4BFD6862.6010107@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig4392C99D0FD0FC00B6D50AE5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Zachary Amsden wrote: > On 05/25/2010 09:40 PM, Jan Kiszka wrote: >> Zachary Amsden wrote: >> =20 >>> On 05/25/2010 05:36 PM, Zachary Amsden wrote: >>> =20 >>>> Not for the faint of heart, this patch subverts the code by >>>> reassigning a local variable from a macro. >>>> =20 >>> This time, with patch. >>> >>> >>> From 97b9230f699aba1c5f47972032b2d4d935a83054 Mon Sep 17 00:00:00 20= 01 >>> From: Zachary Amsden >>> Date: Tue, 25 May 2010 17:17:32 -1000 >>> Subject: [PATCH 4/5] IOMMU API changed >>> >>> Ugly, dirty, disease ridden fix for IOMMU changes; the module >>> is now trying to use larger IOMMU intervals; deny it this, and >>> stick to page size. This requires forcibly setting page_size >>> variable through knowledge of the code. Yuck. If you have a >>> better solution, implement it. >>> >>> Signed-off-by: Zachary Amsden >>> --- >>> external-module-compat-comm.h | 12 ++++++++++++ >>> 1 files changed, 12 insertions(+), 0 deletions(-) >>> >>> diff --git a/external-module-compat-comm.h >>> b/external-module-compat-comm.h >>> index c5284e5..708019e 100644 >>> --- a/external-module-compat-comm.h >>> +++ b/external-module-compat-comm.h >>> @@ -1128,3 +1128,15 @@ perf_unregister_guest_info_callbacks(struct >>> perf_guest_info_callbacks *cbs) >>> #if LINUX_VERSION_CODE< KERNEL_VERSION(2,6,32) >>> #define lockdep_is_held(m) (1) >>> #endif >>> + >>> +#if LINUX_VERSION_CODE< KERNEL_VERSION(2,6,34) >>> +/* This is a dirty, nasty trick */ >>> +#define iommu_map(domain, iova, paddr, gfp_order, prot) \ >>> +({ \ >>> + int _r =3D iommu_map_range(domain, iova, paddr, PAGE_SIZE, prot)= ; \ >>> =20 >> This should be (PAGE_SIZE<< gfp_order) according to my current >> understanding. >> =20 >=20 > It should, but can't be. >> =20 >>> + page_size =3D PAGE_SIZE; \ >>> =20 >> And what is this for? >> =20 >=20 > iommu_unmap is now passed an unreasonable value for order: PAGE_SIZE.=20 Indeed. This is an upstream bug and has to be fixed instead of worked around. I'll send a patch. Jan PS: If there were already a KVM release with this included, the more appropriate way for kvm-kmod to deal with it would be patching the particular code line during sync. --------------enig4392C99D0FD0FC00B6D50AE5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAkv9dQMACgkQitSsb3rl5xRfoQCfWhgjnoGTRDh8UM45zK/MD7pk MSIAoIB8HD5f1mnOMZI5/GIJOwMF5MJL =CCS0 -----END PGP SIGNATURE----- --------------enig4392C99D0FD0FC00B6D50AE5--