Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1592590pxb; Thu, 28 Oct 2021 06:38:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6XvI4khD6CtWtl4vbY6qDXD5vWXd3SOHNSjJX6hwwZt+qRjXJV7TDwALoN59cWp5LFXrg X-Received: by 2002:a05:6402:51d0:: with SMTP id r16mr6151187edd.353.1635428292946; Thu, 28 Oct 2021 06:38:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635428292; cv=none; d=google.com; s=arc-20160816; b=aEDCMX60EP3jZpumBt1W6mFfl/Wv/xWoRWp2veAEDS2G8XWqjBpcwzdDByw683VSxq K94gBP4WnRUrVt+b0SqJjY9dn9r9XzWDpjrIDHGSDmVeSVR1ZK4nEcvhoyQqmYPzZhe4 zKB4J6X6omwjvZUE4LF4FpfUGIVzQGGno3ylOHOgqx7Vywm7Uj3ZpAIctt/zmERFGB1V aLtpHdHoCfo1/hK1NaFGgxNm4mTuY+KJrU9nNQSPr1ohYReXl0P+g4epc6RFmtxIa5yw Zxt7wJUvbSU0hRAtnssSzABg8myC8fLxi+UCj3BEDIazXtHpN2gojxJP0A7IzgXsWCtE YCww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=QNZb9wShokXDwmdjyfYi8wtAvjFKYITKQijqIEf4Xfc=; b=iUiR5KvrpuQ0QR/Y+lMmfpr4lBM0mEPIIUPvG8IVsKiClfCgt8e8RgUIKVDhfRM2xX 1HBDQTSjmiK+TfxX4zaH2Rm8DCjxOT+dZyaoNnv45eGPGChsrDnmF7zcpq9b47y2lA46 RM98bc5D5xanr5pHjt2CJq/7Ue2Y2xJGPR5Kl/oqpwDhPRHbqwrbCzxV3rFgZuChcyKY 2K7FkJ6yRpVm8N20ZzJlqElY5xGTGIHrQvzW8oQuiaCLNBDDQqzoSDbDHP1J8Jos6UPV 9JaTC8W2N3UW5zlGNShhdZbaRHV+WRXKw3irRvoX/ukPpbtwseMvc5nbG+XykvLWny0D xyfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sa34si1441499ejc.235.2021.10.28.06.37.48; Thu, 28 Oct 2021 06:38:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230195AbhJ1NiT (ORCPT + 99 others); Thu, 28 Oct 2021 09:38:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:40130 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229887AbhJ1NiR (ORCPT ); Thu, 28 Oct 2021 09:38:17 -0400 Received: from gandalf.local.home (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 AFF5261038; Thu, 28 Oct 2021 13:35:49 +0000 (UTC) Date: Thu, 28 Oct 2021 09:35:47 -0400 From: Steven Rostedt To: Christophe Leroy Cc: Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Petr Mladek , Joe Lawrence , Ingo Molnar , "Naveen N . Rao" , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, live-patching@vger.kernel.org Subject: Re: [PATCH v1 0/5] Implement livepatch on PPC32 Message-ID: <20211028093547.48c69dfe@gandalf.local.home> In-Reply-To: References: X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 28 Oct 2021 14:24:00 +0200 Christophe Leroy wrote: > This series implements livepatch on PPC32. > > This is largely copied from what's done on PPC64. > > Christophe Leroy (5): > livepatch: Fix build failure on 32 bits processors > powerpc/ftrace: No need to read LR from stack in _mcount() > powerpc/ftrace: Add module_trampoline_target() for PPC32 > powerpc/ftrace: Activate HAVE_DYNAMIC_FTRACE_WITH_REGS on PPC32 > powerpc/ftrace: Add support for livepatch to PPC32 > > arch/powerpc/Kconfig | 2 +- > arch/powerpc/include/asm/livepatch.h | 4 +- > arch/powerpc/kernel/module_32.c | 33 +++++ > arch/powerpc/kernel/trace/ftrace.c | 53 +++----- > arch/powerpc/kernel/trace/ftrace_32.S | 187 ++++++++++++++++++++++++-- > kernel/livepatch/core.c | 4 +- > 6 files changed, 230 insertions(+), 53 deletions(-) > This is great that you are doing this, but I wonder if it would even be easier, and more efficient, if you could implement HAVE_DYNAMIC_FTRACE_WITH_ARGS? Then you don't need to save all regs for live kernel patching. And I am also working on function tracing with arguments with this too. That is, to call a generic ftrace callback, you need to save all the args that are stored in registers to prevent the callback from clobbering them. As live kernel patching only needs to have the arguments of the functions, you save time from having to save the other regs as well. The callbacks now have "struct ftrace_regs" instead of pt_regs, because it will allow non ftrace_regs_caller functions to access the arguments if it is supported. Look at how x86_64 implements this. It should be possible to do this for all other archs as well. Also note, by doing this, we can then get rid of the ftrace_graph_caller, and have function graph tracer be a function tracing callback, as it will allow ftrace_graph_caller to have access to the stack and the return as well. If you need any more help or information to do this, I'd be happy to assist you. Note, you can implement this first, (I looked over the patches and they seem fine) and then update both ppc64 and ppc32 to implement DYNAMIC_FTRACE_WITH_ARGS. Cheers, -- Steve