WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [PATCH] x86: Use __always_inline to ensure scale_delta l

To: "Zhang, Xiantao" <xiantao.zhang@xxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH] x86: Use __always_inline to ensure scale_delta linked to vsyscall section.
From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Date: Fri, 13 Nov 2009 23:10:08 -0800
Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 13 Nov 2009 23:10:43 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <706158FABBBA044BAD4FE898A02E4BC201CD31FD1D@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <706158FABBBA044BAD4FE898A02E4BC201CD31FD1D@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Lightning/1.0pre Thunderbird/3.0b4
On 11/13/09 20:53, Zhang, Xiantao wrote:
> Hi, Jeremy
>  The attached patch should fix the bug: 
> http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1529 which blocked us 
> for weeks.  Since scale_delta is used in the vsyscall vtime, so it should be 
> inlined and linked to vsycall section, otherwise, dom0 should refuse the 
> call. But due to GCC's optimization, scale_delta is compiled to a global 
> function instead of inline function even if it is declared with inline 
> attribute, so the issue occurs.  To ensure this function is inlined to 
> vsyscall section, a stricter attribute __always_inline should be used in its 
> declaration. Thanks!
>   

Thanks for tracking that down.

    J

> Xiantao
>
>
> From 3290d6e40f6c69ce3edd728f57780f088b7155e3 Mon Sep 17 00:00:00 2001
> From: Xiantao Zhang <xiantao.zhang@xxxxxxxxx>
> Date: Fri, 13 Nov 2009 20:33:10 -0500
> Subject: [PATCH] x86: Use __always_inline to ensure scale_delta linked to 
> vsyscall section.
>  
> scale_delta is called in vsyscall vtime, so it should be linked to vsyscall
> section and use fixmap to access it, otherwise unexpected page fault may raise
> in vsyscall context, and leads to system dom0 panic.
>  
> Signed-off-by: Xiantao Zhang <xiantao.zhang@xxxxxxxxx>
> ---
>  arch/x86/kernel/pvclock.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>  
> diff --git a/arch/x86/kernel/pvclock.c b/arch/x86/kernel/pvclock.c
> index f47f91e..1b5d3e8 100644
> --- a/arch/x86/kernel/pvclock.c
> +++ b/arch/x86/kernel/pvclock.c
> @@ -28,7 +28,8 @@
>   * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction,
>   * yielding a 64-bit result.
>   */
> -static inline u64 scale_delta(u64 delta, u32 mul_frac, int shift)
> +static __always_inline
> +u64 scale_delta(u64 delta, u32 mul_frac, int shift)
>  {
>   u64 product;
>  #ifdef __i386__
>   


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>