From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [patch 12/18] x86: vdso: pvclock gettime support Date: Wed, 31 Oct 2012 01:16:59 -0200 Message-ID: <20121031031659.GB9913@amt.cnet> References: <20121024131340.742340256@redhat.com> <20121024131621.840274360@redhat.com> <508E99D7.2050402@parallels.com> <20121029184249.GC30422@amt.cnet> <508F8693.9050503@parallels.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, johnstul@us.ibm.com, jeremy@goop.org, zamsden@gmail.com, gleb@redhat.com, avi@redhat.com, pbonzini@redhat.com To: Glauber Costa Return-path: Received: from mx1.redhat.com ([209.132.183.28]:38866 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753911Ab2JaD1H (ORCPT ); Tue, 30 Oct 2012 23:27:07 -0400 Content-Disposition: inline In-Reply-To: <508F8693.9050503@parallels.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Oct 30, 2012 at 11:49:39AM +0400, Glauber Costa wrote: > On 10/29/2012 10:42 PM, Marcelo Tosatti wrote: > > On Mon, Oct 29, 2012 at 06:59:35PM +0400, Glauber Costa wrote: > >> On 10/24/2012 05:13 PM, Marcelo Tosatti wrote: > >>> Improve performance of time system calls when using Linux pvclock, > >>> by reading time info from fixmap visible copy of pvclock data. > >>> > >>> Originally from Jeremy Fitzhardinge. > >>> > >>> Signed-off-by: Marcelo Tosatti > >>> > >>> Index: vsyscall/arch/x86/vdso/vclock_gettime.c > >>> =================================================================== > >>> --- vsyscall.orig/arch/x86/vdso/vclock_gettime.c > >>> +++ vsyscall/arch/x86/vdso/vclock_gettime.c > >>> @@ -22,6 +22,7 @@ > >>> #include > >>> #include > >>> #include > >>> +#include > >>> > >>> #define gtod (&VVAR(vsyscall_gtod_data)) > >>> > >>> @@ -62,6 +63,69 @@ static notrace cycle_t vread_hpet(void) > >>> return readl((const void __iomem *)fix_to_virt(VSYSCALL_HPET) + 0xf0); > >>> } > >>> > >>> +#ifdef CONFIG_PARAVIRT_CLOCK_VSYSCALL > >>> + > >>> +static notrace const struct pvclock_vsyscall_time_info *get_pvti(int cpu) > >>> +{ > >>> + const aligned_pvti_t *pvti_base; > >>> + int idx = cpu / (PAGE_SIZE/PVTI_SIZE); > >>> + int offset = cpu % (PAGE_SIZE/PVTI_SIZE); > >>> + > >>> + BUG_ON(PVCLOCK_FIXMAP_BEGIN + idx > PVCLOCK_FIXMAP_END); > >>> + > >>> + pvti_base = (aligned_pvti_t *)__fix_to_virt(PVCLOCK_FIXMAP_BEGIN+idx); > >>> + > >>> + return &pvti_base[offset].info; > >>> +} > >>> + > >> > >> Unless I am missing something, if gcc decides to not inline get_pvti, > >> this will break, right? I believe you need to mark that function with > >> __always_inline. > > > > Can't see why. Please enlighten me. > > > > I can be wrong, I don't deal with this vdso code for quite a while - so > forgive me if my memory tricked me. > > But wasn't it the case that vdso functions could not call functions in > the kernel address space outside the mapped page? Or does this > restriction only apply to accessing data? Only code in the vdso page is executed, but this particular function is in the vdso so its fine.