Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1097331yba; Thu, 9 May 2019 10:40:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqD8Dn6fArzWJAGKkw1759RTI5POEpkovTRF2CJ5KPRoWuX2e/vDjcVBS0dXYhanUp2ult X-Received: by 2002:a63:130d:: with SMTP id i13mr7288033pgl.396.1557423636197; Thu, 09 May 2019 10:40:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557423636; cv=none; d=google.com; s=arc-20160816; b=ckJvqv9mUwapoBJ0Ry3+96aiqJ4T4w9hqkoRSJoRD+yN5Kfv/rPkBj6USk16qFtPr8 DsSnuVECefZickRO2iVTtKFUWpcsOPV3YLTSkKfDbmrIs6HmZDsit7G7I2fbjNdShJ1E UmdwBjExE/k00+J5YplxOA6ghZFugMKKm98DxVs9Q0zUOVrw9TF5bXsuhrwNOYqbipwy B/47gDldMhDSy4NqCF2hcjkUvKHEpHRRcGfNEuptNmCLuCsRQkgDvJhUVfogRnNdEHs6 cJIVIyY58byBcneCW6ZH5P/PqskP/mz0QQyNQ3NL/SGirtzZNt0FQygmfBz/wCzHcz2Y Ki2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=amYvI4Kz8KeH7XHe/P4q+kTfaOgZpqQPnYgFtP36o6U=; b=TG2sHS5+/c2MU97ZbNNH1Cn5nQi/FjYn7/q9NJhz2eRgIDtjFm5B1K6qu2seQCgc7c mNWLQxO/GIev1PHuGZhrrJe3lkJf66dw+gQ48zQxQkYH9KaRF/bHAx3YijHLTKSASx6n N19NZx1IR7U0aZ4m8+eg73Ch8tUksd8/Iu2YyVFtIQ1iRCyAcRtQzf+SlDt5NqlaFjAl zwWTVeFruQTJv9CGpAUIR0+xWVlgjBbKWg4WPr/Jzi8WNm8sCErS5jDT9hn90xemxJpM dUBJ/i51yY68WhN6p7enpbOzSPZ8U1vOhEjopuvYzd5qdkn85wCVFMU8iOoyeRGnT81a xg0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u190si3851313pgc.282.2019.05.09.10.40.19; Thu, 09 May 2019 10:40:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726767AbfEIRhw (ORCPT + 99 others); Thu, 9 May 2019 13:37:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:34388 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726576AbfEIRhw (ORCPT ); Thu, 9 May 2019 13:37:52 -0400 Received: from home.goodmis.org (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 66CDD20675; Thu, 9 May 2019 17:37:49 +0000 (UTC) Date: Thu, 9 May 2019 13:37:42 -0400 From: Steven Rostedt To: Peter Zijlstra Cc: Masami Hiramatsu , Josh Poimboeuf , linux-kernel@vger.kernel.org, Linus Torvalds , Ingo Molnar , Andrew Morton , Andy Lutomirski , Nicolai Stange , Thomas Gleixner , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, Jiri Kosina , Miroslav Benes , Petr Mladek , Joe Lawrence , Shuah Khan , Konrad Rzeszutek Wilk , Tim Chen , Sebastian Andrzej Siewior , Mimi Zohar , Juergen Gross , Nick Desaulniers , Nayna Jain , Masahiro Yamada , Joerg Roedel , linux-kselftest@vger.kernel.org Subject: Re: [PATCH 2/4] x86/kprobes: Fix frame pointer annotations Message-ID: <20190509173741.pfvecznqdndihxzg@home.goodmis.org> References: <20190508074901.982470324@infradead.org> <20190508080612.721269814@infradead.org> <20190508115416.nblx7c2kocidpytm@treble> <20190508120416.GL2589@hirez.programming.kicks-ass.net> <20190508124248.u5ukpbhnh4wpiccq@treble> <20190508153907.GM2589@hirez.programming.kicks-ass.net> <20190508184848.qerg3flv3ej3xsev@treble> <20190509102030.dfa62e058f09d0d8cbdd6053@kernel.org> <20190509081431.GO2589@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190509081431.GO2589@hirez.programming.kicks-ass.net> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 09, 2019 at 10:14:31AM +0200, Peter Zijlstra wrote: > > Right; I already fixed that in my patch changing i386's pt_regs. > > But what I'd love to do is something like the belwo patch, and make all > the trampolines (very much including ftrace) use that. Such that we then > only have 1 copy of this magic (well, 2 because x86_64 also needs an > implementation of this of course). > > Changing ftrace over to this would be a little more work but it can > easily chain things a little to get its original context back: > > ENTRY(ftrace_regs_caller) > GLOBAL(ftrace_regs_func) > push ftrace_stub > push ftrace_regs_handler Note, ftrace_stub is dynamically modified to remove any indirect calls. > jmp call_to_exception_trampoline > END(ftrace_regs_caller) > > typedef void (*ftrace_func_t)(unsigned long, unsigned long, struct ftrace_op *, struct pt_regs *); > > struct ftrace_regs_stack { > ftrace_func_t func; > unsigned long parent_ip; > }; > > void ftrace_regs_handler(struct pr_regs *regs) > { > struct ftrace_regs_stack *st = (void *)regs->sp; > ftrace_func_t func = st->func; > > regs->sp += sizeof(long); /* pop func */ > > func(regs->ip, st->parent_ip, function_trace_op, regs); I try very hard to limit all indirect function calls from the function tracing path, as they do add noticeable overhead. -- Steve > } > > Hmm? I didn't look into the function_graph thing, but I imagine it can > be added without too much pain. >