On Wed, 2010-03-03 at 11:13 +0100, Peter Zijlstra wrote: > On Wed, 2010-03-03 at 17:27 +0800, Zhang, Yanmin wrote: > > +static inline u64 perf_instruction_pointer(struct pt_regs *regs) > > +{ > > + u64 ip; > > + ip = percpu_read(perf_virt_ip.ip); > > + if (!ip) > > + ip = instruction_pointer(regs); > > + else > > + perf_reset_virt_ip(); > > + return ip; > > +} > > + > > +static inline unsigned int perf_misc_flags(struct pt_regs *regs) > > +{ > > + if (percpu_read(perf_virt_ip.ip)) { > > + return percpu_read(perf_virt_ip.user_mode) ? > > + PERF_RECORD_MISC_GUEST_USER : > > + PERF_RECORD_MISC_GUEST_KERNEL; > > + } else > > + return user_mode(regs) ? PERF_RECORD_MISC_USER : > > + PERF_RECORD_MISC_KERNEL; > > +} > > This codes in the assumption that perf_misc_flags() must only be called > before perf_instruction_pointer(), which is currently true, but you > might want to put a comment near to remind us of this. I will change the logic with a clear reset operation in caller. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html