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-ia64-devel

RE: [Xen-ia64-devel]PATCH] Remove duplicate check is_running_on_xen

To: "Alex Williamson" <alex.williamson@xxxxxx>
Subject: RE: [Xen-ia64-devel]PATCH] Remove duplicate check is_running_on_xen
From: "Xu, Anthony" <anthony.xu@xxxxxxxxx>
Date: Wed, 17 Jan 2007 10:17:59 +0800
Cc: xen-ia64-devel <xen-ia64-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Tue, 16 Jan 2007 18:17:33 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <1168966936.5469.20.camel@bling>
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Acc5kUV3qTsvvvIYQfmHD8D98rcEgQASz6Dg
Thread-topic: [Xen-ia64-devel]PATCH] Remove duplicate check is_running_on_xen
Alex Williamson write on 2007年1月17日 1:02:
> On Mon, 2007-01-15 at 13:33 +0800, Xu, Anthony wrote:
>> 
>> Remove duplicate check is_running_on_xen
> 
> Hi Anthony,
> 
>    I'm not sure I understand why the xen functions, for example
> xen_get_psr(), need to support both bare metal and paravirtualized
> since the caller always checks for is_running_on_xen.  The current
> code seems overly paranoid.  Would is make more sense to rename these
> to __xen_get_psr() and eliminate the running_on_xen check in the
> assembly? Then we could still use the native bare metal calls when
> running a Xen kernel on bare metal.  Am I missing some reason why
> xen_get_psr() would ever get called on bare metal?  Thanks,

There are two duplicate checks as below, so there are two way to eliminate one 
check.

1. eliminate check in xen_get_tpr, then xen_get_tpr will never be called on 
bare metal,
     but it's a little perfomance impact, due to there is another switch inside 
__ia64_getreg.

2. eliminate check in xen_ia64_getreg, then xen_get_tpr will be called both on 
para platform
   or bare metal, it can produce better performance than option 1. so I prefer 
this.

Anthony


#define xen_ia64_getreg(regnum)                                         \

        case _IA64_REG_CR_IVR:                                          \
                ia64_intri_res = (is_running_on_xen()) ?                        
\
                        xen_get_ivr() :                                 \
                        __ia64_getreg(regnum);                          \
                break;                                                  \

GLOBAL_ENTRY(xen_get_tpr)
        movl r8=running_on_xen;;
        ld4 r8=[r8];;
        cmp.eq p7,p0=r8,r0;;
(p7)    mov r8=cr.tpr;;
(p7)    br.ret.sptk.many rp
        ;;
        XEN_CLEAR_PSR_IC
        ;;
        XEN_HYPER_GET_TPR
        ;;
        XEN_RESTORE_PSR_IC
        ;;
        br.ret.sptk.many rp
        ;;
END(xen_get_tpr)





> 
>       Alex
> 
>> diff -r 29780963b34f linux-2.6-xen-sparse/arch/ia64/xen/hypercall.S
>> --- a/linux-2.6-xen-sparse/arch/ia64/xen/hypercall.S    Mon Jan 15
>> 04:27:37 2007 +0800 +++
>> b/linux-2.6-xen-sparse/arch/ia64/xen/hypercall.S    Mon Jan 15
>>  05:02:05 2007 +0800 @@ -11,12 +11,9 @@ GLOBAL_ENTRY(xen_get_psr)
>>         GLOBAL_ENTRY(xen_get_psr) movl r8=running_on_xen;;
>>         ld4 r8=[r8];;
>> -       cmp.eq p7,p0=r8,r0;;
>> -(p7)   mov r8=psr;;
>> -(p7)   br.ret.sptk.many rp
>> -       ;;
>> -       XEN_HYPER_GET_PSR
>> -       ;;
>> +       cmp.eq p7,p6=r8,r0;;
>> +(p7)   mov r8=psr
>> +(p6)   XEN_HYPER_GET_PSR
>>         br.ret.sptk.many rp
>>         ;;
>>  END(xen_get_psr)
> ...
>>  linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h
>> --- a/linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h        Mon
>> Jan 15 04:27:37 2007 +0800
>> +++ b/linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h        Mon
>> Jan 15 05:08:12 2007 +0800
>> @@ -203,24 +203,16 @@ extern void xen_ptcga(unsigned long addr
>>                                                                     
>> \         switch(regnum) {                                          
>>         \ case
>> _IA64_REG_PSR:                                             \
>> -               ia64_intri_res =
>> (is_running_on_xen()) ?                        \
>> -                       xen_get_psr() :                             
>> \ 
>> -                       __ia64_getreg(regnum);                      
>> \ +               ia64_intri_res =
>> xen_get_psr();                                 \
>>                 break;                                              
>> \ 

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