[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YSkfeXcd6nUT3AOJ@google.com>
Date: Fri, 27 Aug 2021 17:23:05 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Zhu Lingshan <lingshan.zhu@...el.com>
Cc: peterz@...radead.org, pbonzini@...hat.com, bp@...en8.de,
vkuznets@...hat.com, wanpengli@...cent.com, jmattson@...gle.com,
joro@...tes.org, kan.liang@...ux.intel.com, ak@...ux.intel.com,
wei.w.wang@...el.com, eranian@...gle.com, liuxiangdong5@...wei.com,
linux-kernel@...r.kernel.org, x86@...nel.org, kvm@...r.kernel.org,
like.xu.linux@...il.com, boris.ostrvsky@...cle.com,
Like Xu <like.xu@...ux.intel.com>,
Will Deacon <will@...nel.org>, Marc Zyngier <maz@...nel.org>,
Guo Ren <guoren@...nel.org>, Nick Hu <nickhu@...estech.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.cs.columbia.edu,
linux-csky@...r.kernel.org, linux-riscv@...ts.infradead.org,
xen-devel@...ts.xenproject.org
Subject: 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;
> }
Powered by blists - more mailing lists