[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH for-4.11] x86/traps: Improve code generation for set_ist()



>>> On 27.04.18 at 15:07, <andrew.cooper3@xxxxxxxxxx> wrote:
> The IST field in an IDT entry is a 3 bit field, with 5 adjacent reserved bits
> which we always write as zero.  By expressing this as a byte field in a union,
> we turn an invocation of enable_each_ist() from
> 
>   4b 8b 14 d3                     mov    (%r11,%r10,8),%rdx
>   48 b8 ff ff ff ff f8 ff ff ff   movabs $0xfffffff8ffffffff,%rax
>   48 be 00 00 00 00 01 00 00 00   movabs $0x100000000,%rsi
>   48 8b 8a 80 00 00 00            mov    0x80(%rdx),%rcx
>   48 21 c1                        and    %rax,%rcx
>   48 09 f1                        or     %rsi,%rcx
>   48 be 00 00 00 00 02 00 00 00   movabs $0x200000000,%rsi
>   48 89 8a 80 00 00 00            mov    %rcx,0x80(%rdx)
>   48 8b 4a 20                     mov    0x20(%rdx),%rcx
>   48 21 c1                        and    %rax,%rcx
>   48 23 82 20 01 00 00            and    0x120(%rdx),%rax
>   48 09 f1                        or     %rsi,%rcx
>   48 89 4a 20                     mov    %rcx,0x20(%rdx)
>   48 b9 00 00 00 00 03 00 00 00   movabs $0x300000000,%rcx
>   48 09 c8                        or     %rcx,%rax
>   48 89 82 20 01 00 00            mov    %rax,0x120(%rdx)
> 
> into
> 
>   4b 8b 04 d3                     mov    (%r11,%r10,8),%rax
>   c6 80 84 00 00 00 01            movb   $0x1,0x84(%rax)
>   c6 40 24 02                     movb   $0x2,0x24(%rax)
>   c6 80 24 01 00 00 03            movb   $0x3,0x124(%rax)
> 
> which is far more simple.  As the IDT is typically live, this is more
> obviously safe.
> 
> The net delta for this change is:
> 
>   add/remove: 0/0 grow/shrink: 0/7 up/down: 0/-334 (-334)
> 
> While making changes here, tidy up the set_ist() declaration.  Drop the
> always_inline (I don't recall why I wrote it like that originally) and the ist
> parameter need not be unsigned long (although it will be const-propagated in
> practice).
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.