Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp854267yba; Thu, 9 May 2019 07:01:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqzkwztRtNrNdd6L/e2Akwyxt9hqNJpuxnEMwxRtVClc72Hjvw9BqlntrjStFmDIdvXFaVwT X-Received: by 2002:a17:902:4101:: with SMTP id e1mr5426558pld.25.1557410485729; Thu, 09 May 2019 07:01:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557410485; cv=none; d=google.com; s=arc-20160816; b=mqXtLw4K9mIL2ppWo2c4yvGtt9OsEbFiPiaWSScRNrWjOSLdrYXJe5yK5IeKIz6t2L kHK10QUDlu+oJjCtSe70rz3n91L/Kn0KaugUfVP1B7HIaJ/uGSCgJuUcSKLLrniDMi1F GXp4pViZ/vl5ABWye0Z++4uRb3qUHk+rK9GUCssJLXRgZ2ng8+0SblEnGAjE04iaFo/9 +Xv/BtI7sc7X7A+6WSwB+5oeVIBHBpCv0V6wEdw/RQOMn3z3DmO4vJMPNjMIcVU3Qec+ T0o0QEWKMrrHDINLOK/gkl1BuEbFu9YqYN7tCn1qLcH1QXzamCvdFt63R4FSrNw4V7NM Q79A== 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=YG2L47eivm7Mji6qYRnSX9JNvX51ZzskX66y7siHYXU=; b=egIJudKrcCha+bwj64c6g96RG8jNv+lrwH9k2u3WxhM1dWTnX3DYlc+wxQMOqJmkVv L2VdWzOE1qqFdrdLfSaBMvqneBVr6EOig5I8E6lsfdR49vI105cRptGi0WF2KW4iCQok bwlX7X2mKXiMR2VvIOA04pGIaeSqRPJ7p5OI2c34z+aKtuG5OA9uQhL/C8iYh0HNLIpD mng3AP9UBz7wjq/8RRrpEzsP82aK9/H9gJn/5JbcQGu7L507DVbaQz3DpwVI+8jwovx2 neur2L2SSr3aCLJgzUcz8VWs3Poc/x4QYBlyXJftCbN504YXE5Sf5BYoDQxmZxJkcHTM qTxA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r6si3016783pgp.466.2019.05.09.07.01.06; Thu, 09 May 2019 07:01:25 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726608AbfEIOAO (ORCPT + 99 others); Thu, 9 May 2019 10:00:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47604 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726192AbfEIOAN (ORCPT ); Thu, 9 May 2019 10:00:13 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 435DB307C643; Thu, 9 May 2019 14:00:13 +0000 (UTC) Received: from treble (ovpn-123-166.rdu2.redhat.com [10.10.123.166]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 76DEB10027C3; Thu, 9 May 2019 14:00:03 +0000 (UTC) Date: Thu, 9 May 2019 09:00:01 -0500 From: Josh Poimboeuf To: Peter Zijlstra Cc: Masami Hiramatsu , 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: <20190509140001.fvwzlnhai6ddqjmt@treble> 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=utf-8 Content-Disposition: inline In-Reply-To: <20190509081431.GO2589@hirez.programming.kicks-ass.net> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 09 May 2019 14:00:13 +0000 (UTC) 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: > 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 > 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); > } > > Hmm? I didn't look into the function_graph thing, but I imagine it can > be added without too much pain. I like this patch a lot, assuming it can be made to work for the different users. -- Josh