Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp460302imj; Thu, 7 Feb 2019 07:00:07 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ/QlgJ7KwR5dbnW3SNDNswHbRGJatq4ic7EfLvf4yl+lJIQC8Ygyx2aLBdIRzZT2SfJKWM X-Received: by 2002:a63:5b48:: with SMTP id l8mr10445064pgm.80.1549551606972; Thu, 07 Feb 2019 07:00:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549551606; cv=none; d=google.com; s=arc-20160816; b=Tt2/RD60SjvMsdVTthL/xXzdytW6W7T9qSVnanabgxUYUK2pe/k5W0q0iSjO6OVBwP j5udM5fHCgVcSew2um37Akk2BObvMOWIylxcfbCK6ZkIwL9z8B9M8ACI+0EG8x0oQniX z7h2x81Ht9BXn88a5aXGb4fEjqL4UZJVkqJq1adHd2+Vf/Of4vn3uo1bqaDiG/MTAt5C v2CLG0SR2Efl3PCU9F99l68L5Zd+Y+HRxyl+x3zyPS4AI5+2ZffM2PXhECOlVtIBBYDg FxZM9YjATpLgkk7f27E4DSLr8YXjfzhy6qE4AH+1CAbNnTfL7yPOcZKyBShqK+WIg4jk VdzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=psMuQbi66PW+BO7PryfhNoXwSXMCzeWG5zCNheWBRsg=; b=p/wjmCb6e8fZ1EjGBvL9B+U9DKuFiN910NVlfq8Z5gAF73RHpjYFksUdrRVggY7ZxW kY+PnciZzqB1zAO58KCKlNiqwM4TsnAyZ0fagoREUd81ja1V8Ktya5mpVvbySTIvp7Hq GBS/Z23N2UmCHSKeaDAW4euvnoAAVUV04c7SBsVzIPgqNcYlJB1HfpsYJZEaxupPjKib ufeYoGMnI+kGeC53JZrDb2RnBUqjCy7lbNWHu7AHvTAAKAapLzl9p2gujq4iBHjgQvAy WVucJw36bBsqHAAEHWGBQjYgYytMkDv5XJ06dWr1GGOdJHMoj6uUXGdWJ1qpAgFhui8g hq+A== 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 x32si9247114pld.316.2019.02.07.06.59.50; Thu, 07 Feb 2019 07:00:06 -0800 (PST) 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 S1726651AbfBGO7D (ORCPT + 99 others); Thu, 7 Feb 2019 09:59:03 -0500 Received: from foss.arm.com ([217.140.101.70]:38298 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726037AbfBGO7D (ORCPT ); Thu, 7 Feb 2019 09:59:03 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7D6C0EBD; Thu, 7 Feb 2019 06:59:02 -0800 (PST) Received: from [10.1.197.45] (e112298-lin.cambridge.arm.com [10.1.197.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CA5433F719; Thu, 7 Feb 2019 06:58:59 -0800 (PST) Subject: Re: [PATCH v7 2/3] arm64: implement ftrace with regs To: Steven Rostedt Cc: Torsten Duwe , Mark Rutland , Will Deacon , Catalin Marinas , Josh Poimboeuf , Ingo Molnar , Ard Biesheuvel , Arnd Bergmann , AKASHI Takahiro , Amit Daniel Kachhap , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, live-patching@vger.kernel.org References: <20190118163736.6A99268CEB@newverein.lst.de> <20190118163908.E338E68D93@newverein.lst.de> <20190206150524.GA28892@lst.de> <198550d8-78d4-6e30-0179-b5e07dd140f8@arm.com> <20190207095157.3dea1086@gandalf.local.home> From: Julien Thierry Message-ID: <5efd27b1-81b5-267a-9fe8-67bb084d56eb@arm.com> Date: Thu, 7 Feb 2019 14:58:55 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190207095157.3dea1086@gandalf.local.home> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/02/2019 14:51, Steven Rostedt wrote: > On Thu, 7 Feb 2019 10:33:50 +0000 > Julien Thierry wrote: > >> I don't see really much documentation on that function. As far as I can >> tell it is only called once for each site (and if it didn't, we'd always >> be placing the same instruction, but I agree it wouldn't be nice). It >> could depend on how far you can expand the notion of "adjusting" :) . >> >> Steven, do you have an opinion on whether it would be acceptable to >> modify function entry code in ftrace_call_adjust() ? > > Just to make sure I'm on the same page as you are. You want to modify > the function entry code at the time of the ftrace_call_adjust()? > Yes, that was the intention, the reason being that we want to have an instruction that is just patched once on each entry for initialization. > I would update the rec->ip to the offset you want at > ftrace_call_adjust() but not do any modifications. It really isn't safe > to do it there. But right after that is called, you will have the arch > specific call of ftrace_make_nop() called with MCOUNT_ADDR as the > second parameter to let you know that this is the first time the call > is made at this address. This is where you can do that initial > modifications. Yes, this is was the current version of this patch is doing, I was just wondering whether we could clean things up a little (i.e. have ftrace_make_nop() not generate a non-nop instruction :) ). But we're not going to hack through the API if this is definitely not what it's intended for. We'll keep it as is and just update the rec->ip with ftrace_call_adjust(). If we really want to clean things up, we could look into patching this at instruction at build time. But if it's not trivial I guess we can keep that for a later time. Thanks, -- Julien Thierry