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

Re: [PATCH V10 01/18] perf/core: Use static_call to optimize perf_guest_info_callbacks



On Fri, Aug 06, 2021, Zhu Lingshan wrote:
> @@ -2944,18 +2966,21 @@ static unsigned long code_segment_base(struct pt_regs 
> *regs)
>  
>  unsigned long perf_instruction_pointer(struct pt_regs *regs)
>  {
> -     if (perf_guest_cbs && perf_guest_cbs->is_in_guest())
> -             return perf_guest_cbs->get_guest_ip();
> +     unsigned long ip = static_call(x86_guest_get_ip)();
> +
> +     if (likely(!ip))

Pivoting on ip==0 isn't correct, it's perfectly legal for a guest to execute
from %rip=0.  Unless there's some static_call() magic that supports this with a
default function:
        
        if (unlikely(!static_call(x86_guest_get_ip)(&ip)))
                regs->ip + code_segment_base(regs)

        return ip;

The easiest thing is keep the existing:

        if (unlikely(static_call(x86_guest_state)()))
                return static_call(x86_guest_get_ip)();

        return regs->ip + code_segment_base(regs);

It's an extra call for PMIs in guest, but I don't think any of the KVM folks 
care
_that_ much about the performance in this case.

> +             ip = regs->ip + code_segment_base(regs);
>  
> -     return regs->ip + code_segment_base(regs);
> +     return ip;
>  }



 


Rackspace

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