From patchwork Mon Oct 1 14:09:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Torsten Duwe X-Patchwork-Id: 10622159 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A7A051515 for ; Mon, 1 Oct 2018 14:09:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9993B29340 for ; Mon, 1 Oct 2018 14:09:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D334293A0; Mon, 1 Oct 2018 14:09:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1F48029340 for ; Mon, 1 Oct 2018 14:09:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:From:Date: Message-Id:Subject:To:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=/3kU7nTeBLWOKFVW5gscgJAkQTiaHx5ZaW1p0zEYpTM=; b=Wou txhDDCJr42deavgHt4IJyK76uRvzFtya2hHILKeK/H+p95sblM8H8YUlBvSUGQQkMDgkH6ljIn0bp Alrf1ehtwBzzvLGHk+kGgu3xfgW2Y4UKSgYkPs5Mdz70OLjIZgeP5q0CoBu7m1eMxtGERaEBUPBRg ZRtPeWPclGFip8UsydpNAjtD83qvIMd6giXH97E3gNwWQWSsfvTXdRNac62KjamJw/wJ0PD2XGVCD KJUt0ltwe8J+XmewA3pyOjpeHn52IKi5KR1AxegdqkoVI6JS8WfJh1z0ePWqRQ9wjgNbPzdgZOiNB HelylwIatKmeTAWiPg0QrVTSGkPFlBQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g6yt7-0001B5-0G; Mon, 01 Oct 2018 14:09:29 +0000 Received: from verein.lst.de ([213.95.11.211] helo=newverein.lst.de) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g6yt3-00018T-BF for linux-arm-kernel@lists.infradead.org; Mon, 01 Oct 2018 14:09:27 +0000 Received: by newverein.lst.de (Postfix, from userid 2005) id 086E768BC7; Mon, 1 Oct 2018 16:09:10 +0200 (CEST) To: Will Deacon , Catalin Marinas , Julien Thierry , Steven Rostedt , Josh Poimboeuf , Ingo Molnar , Ard Biesheuvel , Arnd Bergmann , AKASHI Takahiro Subject: [PATCH v3 0/4] arm64 live patching Message-Id: <20181001140910.086E768BC7@newverein.lst.de> Date: Mon, 1 Oct 2018 16:09:10 +0200 (CEST) From: duwe@lst.de (Torsten Duwe) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181001_070925_530860_414EFAE5 X-CRM114-Status: UNSURE ( 8.62 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hi all! Some substantial changes were requested, so I had to shuffle a few things around. All the bigger changes are in now. [Changes from v2]: * ifeq($(CONFIG_DYNAMIC_FTRACE_WITH_REGS),y) instead of ifdef * "fix" commit 06aeaaeabf69da4. (new patch 1) Made DYNAMIC_FTRACE_WITH_REGS a real choice. The current situation would be that a linux-4.20 kernel on arm64 should be built with gcc >= 8; as in this case, as well as all other archs, the "default y" works. Only kernels >= 4.20, arm64, gcc < 8, must change this to "n" in order to not be stopped by the Makefile $(error) from patch 2/4. You'll then fall back to the DYNAMIC_FTRACE, if selected, like before. * use some S_X* constants to refer to offsets into pt_regs in assembly. * have the compiler/assembler generate the mov x9,x30 instruction that saves LR at compile time, rather than generate it repeatedly at runtime. * flip the ftrace_regs_caller stack frame so that it is no longer upside down, as Ard remarked. This change broke the graph caller somehow. * extend handling of the module arch-dependent ftrace trampoline with a companion "regs" version. * clear the _TIF_PATCH_PENDING on do_notify_resume() * took care of arch/arm64/kernel/time.c when changing stack unwinder semantics [TODO] * use more S_X* constants * run the full livepatch test suite, especially test apply_relocate_add() functionality late after module load. [Changes from v1]: * Missing compiler support is now a Makefile error, instead of a warning. This will keep the compile log shorter and it will thus be easier to spot the problem. * A separate ftrace_regs_caller. Only that one will write out a complete pt_regs, for efficiency. * Replace the use of X19 with X28 to remember the old PC during live patch detection, as only that is saved&restored now for non-regs ftrace. * CONFIG_DYNAMIC_FTRACE_WITH_REGS and CC_USING_PATCHABLE_FUNCTION_ENTRY are currently synonymous on arm64, but differentiate better for the future when this is no longer the case. * Clean up "old"/"new" insn value setting vs. #ifdefs. * #define a INSN_MOV_X9_X30 with suggested aarch64_insn_gen call and use that instead of an immediate hex value. Torsten