From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 1/1 v2] KVM: MMU: Optimize guest page table walk Date: Tue, 26 Apr 2011 11:21:10 +0300 Message-ID: <4DB68076.8090902@redhat.com> References: <20110422003222.9d08aee3.takuya.yoshikawa@gmail.com> <20110422003444.5b3a876a.takuya.yoshikawa@gmail.com> <4DB52B1B.5080407@web.de> <4DB6775F.9050207@redhat.com> <4DB67823.4010304@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Takuya Yoshikawa , mtosatti@redhat.com, kvm@vger.kernel.org, yoshikawa.takuya@oss.ntt.co.jp, xiaoguangrong@cn.fujitsu.com, Joerg.Roedel@amd.com To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([209.132.183.28]:1027 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750941Ab1DZIVZ (ORCPT ); Tue, 26 Apr 2011 04:21:25 -0400 In-Reply-To: <4DB67823.4010304@web.de> Sender: kvm-owner@vger.kernel.org List-ID: On 04/26/2011 10:45 AM, Jan Kiszka wrote: > On 2011-04-26 09:42, Avi Kivity wrote: > > On 04/25/2011 11:04 AM, Jan Kiszka wrote: > >> > + > >> > + ptep_user = (pt_element_t __user *)((void *)host_addr + > >> offset); > >> > + if (get_user(pte, ptep_user)) { > >> ^^^^^^^^^^^^ > >> This doesn't work for x86-32: pte is 64 bit, but get_user is only > >> defined up to 32 bit on that platform. > >> > > > > I actually considered this, and saw: > > > > #ifdef CONFIG_X86_32 > > #define __get_user_8(__ret_gu, __val_gu, ptr) \ > > __get_user_x(X, __ret_gu, __val_gu, ptr) > > #else > > #define __get_user_8(__ret_gu, __val_gu, ptr) \ > > __get_user_x(8, __ret_gu, __val_gu, ptr) > > #endif > > > > #define get_user(x, ptr) \ > > ({ \ > > int __ret_gu; \ > > unsigned long __val_gu; \ > > __chk_user_ptr(ptr); \ > > might_fault(); \ > > switch (sizeof(*(ptr))) { \ > > > > ... > > > > case 8: \ > > __get_user_8(__ret_gu, __val_gu, ptr); \ > > break; \ > > > > ... > > > > } \ > > (x) = (__typeof__(*(ptr)))__val_gu; \ > > __ret_gu; \ > > }) > > > > so it should work. How does it fail? > > On x86-32, the above macro resolves to __get_user_X, an undefined symbol. > Tricky stuff. -- error compiling committee.c: too many arguments to function