On Fri, Aug 06, 2021, Zhu Lingshan wrote:
quoted hunk ↗ jump to hunk
@@ -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;
}
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel