Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp5982198imd; Wed, 31 Oct 2018 05:13:01 -0700 (PDT) X-Google-Smtp-Source: AJdET5eSSANzYrd9bYiDe8rtdptBeyxvGesIYIkWV/jBWVmUNKdf+jEw94AMTmjx1yn2x1pvel+B X-Received: by 2002:a62:b09:: with SMTP id t9-v6mr3194910pfi.36.1540987981574; Wed, 31 Oct 2018 05:13:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540987981; cv=none; d=google.com; s=arc-20160816; b=dt7l+Y6t2Gc9lNV9ybfSANn1RGV6Hkon8BAmL6tBHjiR9WbkiTU73pFFCGz0wqPbz0 mKpMbqKvHLDv0r2VFOaHmxgg4pd/UHK8OvT1XjMt/rrsbMygWxy1aYvQneivAQBPcsl0 BIwGlNwCPyo605GR8/992nuCciaEjNruwzWXlRte/q+sVut9UvXSJA/GclMJWQzvaJNI DO7OEvaQnS6RbqAX/cDWhov43BVFS6vjePIL7IpGyuaeDERyjY5L3/h4wzorHNAqB9yJ KeB1KEvYfGUuD81hgs9DxjGJbLJJJLUwLlfbYY3YjpYNUhkQumKBy2nXpKnvNZ02c9YB lc/Q== 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=IvwItPpUen0bET/8f782knDZzCIjK0N68l7FnuXgIkk=; b=sXYGbc2Y8fYy23iLdI430gA3PCtX1KuZ3Bt+0l9QLYRuCi9SulUw6M4wn+F/af/C/W TLxHWnD2WiiTymFae3rN+yi+RFaTT+L3bOgTztLGKg5DZSWFk8ktOU8nzKzqz/xO0Hd9 ee9LipIJwAPkMON/3pcnEdoxdI1XFZDHgpk9TvtKpoyK+lZVs+xYQpREzBJ5q3l1AZ+E 740AESelGmDqCiKWYAAkgOanxSvZskTkJGSuv4MVsnhTEh+IKvvy/uLP03cHHHKUkz1Y EGgLZfvpRWFubnGg3T10AWwheVHTdLYer3kpJzefOijN8wcAy7iNWZvncSUxEOYw+1/3 G6Ug== 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 h13-v6si31537624plk.130.2018.10.31.05.12.45; Wed, 31 Oct 2018 05:13:01 -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 S1728781AbeJaVH4 (ORCPT + 99 others); Wed, 31 Oct 2018 17:07:56 -0400 Received: from foss.arm.com ([217.140.101.70]:40054 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725897AbeJaVHz (ORCPT ); Wed, 31 Oct 2018 17:07:55 -0400 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 4A4E180D; Wed, 31 Oct 2018 05:10:10 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E64963F71D; Wed, 31 Oct 2018 05:10:07 -0700 (PDT) Date: Wed, 31 Oct 2018 12:10:03 +0000 From: Mark Rutland To: Torsten Duwe Cc: Will Deacon , Catalin Marinas , Julien Thierry , Steven Rostedt , Josh Poimboeuf , Ingo Molnar , Ard Biesheuvel , Arnd Bergmann , AKASHI Takahiro , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, kristina.martsenko@arm.com Subject: Re: [PATCH v4 1/3] arm64: implement ftrace with regs Message-ID: <20181031121002.hmag2mwvlpzwobvf@lakrids.cambridge.arm.com> References: <20181026142008.D922868C94@newverein.lst.de> <20181026142148.6353A68C94@newverein.lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181026142148.6353A68C94@newverein.lst.de> 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 Hi Torsten, On Fri, Oct 26, 2018 at 04:21:48PM +0200, Torsten Duwe wrote: > Use -fpatchable-function-entry (gcc8) to add 2 NOPs at the beginning > of each function. Replace the first NOP thus generated with a quick LR > saver (move it to scratch reg x9), so the 2nd replacement insn, the call > to ftrace, does not clobber the value. Ftrace will then generate the > standard stack frames. I'd like to understand why you need patchable-function-entry to implement DYNAMIC_FTRACE_WITH_REGS on arm64. No other architectures with DYNAMIC_FTRACE_WITH_REGS require this, including arm. I guess skipping the original function prologue would simplify the implementation of the replacement function (and would mean that the regs held the function arguments per the procedure call standard), but AFAICT other architectures aren't relying on that, so it doesn't seem to be a strict requirement. What am I missing? How does livepatching handle the pre-mcount function preambles on architectures with existing support? FWIW, I think that patchable-function-entry would solve an upcoming problem on arm64. To support in-kernel pointer authentication with the function graph tracer, we need to snapshot the SP at function entry (before any preamble), and we can't do that reliably with mcount. Thanks, Mark.