Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755636AbcDNSca (ORCPT ); Thu, 14 Apr 2016 14:32:30 -0400 Received: from mail-ob0-f173.google.com ([209.85.214.173]:34933 "EHLO mail-ob0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755572AbcDNSc2 (ORCPT ); Thu, 14 Apr 2016 14:32:28 -0400 MIME-Version: 1.0 In-Reply-To: <1460657414-12530-2-git-send-email-dsafonov@virtuozzo.com> References: <1460657414-12530-1-git-send-email-dsafonov@virtuozzo.com> <1460657414-12530-2-git-send-email-dsafonov@virtuozzo.com> From: Andy Lutomirski Date: Thu, 14 Apr 2016 11:32:07 -0700 Message-ID: Subject: Re: [PATCH 1/4] x86/events: down with test_thread_flag(TIF_IA32) To: Dmitry Safonov , Peter Zijlstra Cc: "linux-kernel@vger.kernel.org" , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , X86 ML , Robert Richter , oprofile-list@lists.sf.net, Dmitry Safonov <0x7f454c46@gmail.com> Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1447 Lines: 45 On Thu, Apr 14, 2016 at 11:10 AM, Dmitry Safonov wrote: > We can use user_64bit_mode(regs) here instead of thread flag > because we have full register frame. > > Signed-off-by: Dmitry Safonov > --- > arch/x86/events/core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c > index 041e442a3e28..91d101a9a6e9 100644 > --- a/arch/x86/events/core.c > +++ b/arch/x86/events/core.c > @@ -2269,7 +2269,7 @@ perf_callchain_user32(struct pt_regs *regs, struct perf_callchain_entry *entry) > struct stack_frame_ia32 frame; > const void __user *fp; > > - if (!test_thread_flag(TIF_IA32)) > + if (user_64bit_mode(regs)) > return 0; Peter, I got lost in the code that calls this. Are regs coming from the overflow interrupt's regs, current_pt_regs(), or perf_get_regs_user? If it's the perf_get_regs_user, then this should be okay, but passing in the ABI field directly would be even nicer. If they're coming from the overflow interrupt's regs or current_pt_regs(), could we change that? It might also be nice to make sure that we call perf_get_regs_user exactly once per overflow interrupt -- i.e. we could push it into the main code rather than the regs sampling code. > > cs_base = get_segment_base(regs->cs); > -- > 2.8.0 > -- Andy Lutomirski AMA Capital Management, LLC