From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77493CA9ED3 for ; Mon, 4 Nov 2019 13:55:48 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 440CE20869 for ; Mon, 4 Nov 2019 13:55:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="SM/hKEud" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 440CE20869 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5GIZu+pmht2EcYwj5ex8aW2jmTTj0OaCxhjRjIsdCpE=; b=SM/hKEudZY/K8E aGbRdR52veY8Pp2EpwxWaVvjAxw5jMA2unPg18RctbQ0v4c52e1yDG1ApKx7qW2Y/4nyce6kZd1ZE 1Z1zYqA3Nnx2ViDQIHl3exG5vIbODTAhSAfGVu13lrQzuIvGoqG+eHIIgjxUbPHr/MxAMHw5SOQ0u pOuteFwZF+JyPLSiE3Iio1PpR3FT2Mkb4rEQq26Vnu7j0spL9LQC4JovRPt8MaHZ37RCUjg7nfmaZ GRMp8SHaE2m22LInlqj69gL8ZmIFSgVE7DNc+Qi/WH4duSKwZosfkQkyMU7ZNjJLPueniEWbefNRO zTEwenNgZ8Io/BD1GW7A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iRcpf-0003tT-JS; Mon, 04 Nov 2019 13:55:47 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iRcpd-0003t6-Dr for linux-arm-kernel@lists.infradead.org; Mon, 04 Nov 2019 13:55:46 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D21141FB; Mon, 4 Nov 2019 05:55:44 -0800 (PST) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 976583F6C4; Mon, 4 Nov 2019 05:55:42 -0800 (PST) Date: Mon, 4 Nov 2019 13:55:40 +0000 From: Mark Rutland To: Amit Daniel Kachhap Subject: Re: [PATCHv2 4/8] arm64: module/ftrace: intialize PLT at load time Message-ID: <20191104135540.GH45140@lakrids.cambridge.arm.com> References: <20191029165832.33606-1-mark.rutland@arm.com> <20191029165832.33606-5-mark.rutland@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.1+11 (2f07cb52) (2018-12-01) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191104_055545_505332_7379077D X-CRM114-Status: GOOD ( 12.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jthierry@redhat.com, linux-parisc@vger.kernel.org, peterz@infradead.org, catalin.marinas@arm.com, deller@gmx.de, jpoimboe@redhat.com, linux-kernel@vger.kernel.org, rostedt@goodmis.org, James.Bottomley@HansenPartnership.com, takahiro.akashi@linaro.org, will@kernel.org, mingo@redhat.com, james.morse@arm.com, jeyu@kernel.org, svens@stackframe.org, duwe@suse.de, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sat, Nov 02, 2019 at 05:50:02PM +0530, Amit Daniel Kachhap wrote: > On 10/29/19 10:28 PM, Mark Rutland wrote: > > @@ -485,24 +486,33 @@ static const Elf_Shdr *find_section(const Elf_Ehdr *hdr, > > return NULL; > > } > > +int module_init_ftrace_plt(const Elf_Ehdr *hdr, > > + const Elf_Shdr *sechdrs, > > + struct module *mod) > I think this function can be made static as it is not used anywhere. It's only called by module_finalize() below, so making it static makese sense; done. Thanks Mark. > > +{ > > +#if defined(CONFIG_ARM64_MODULE_PLTS) && defined(CONFIG_DYNAMIC_FTRACE) > > + const Elf_Shdr *s; > > + struct plt_entry *plt; > > + > > + s = find_section(hdr, sechdrs, ".text.ftrace_trampoline"); > > + if (!s) > > + return -ENOEXEC; > > + > > + plt = (void *)s->sh_addr; > > + *plt = get_plt_entry(FTRACE_ADDR, plt); > > + mod->arch.ftrace_trampoline = plt; > > +#endif > > + return 0; > > +} > > + > > int module_finalize(const Elf_Ehdr *hdr, > > const Elf_Shdr *sechdrs, > > struct module *me) > > { > > const Elf_Shdr *s; > > - > > s = find_section(hdr, sechdrs, ".altinstructions"); > > if (s) > > apply_alternatives_module((void *)s->sh_addr, s->sh_size); > > -#ifdef CONFIG_ARM64_MODULE_PLTS > > - if (IS_ENABLED(CONFIG_DYNAMIC_FTRACE)) { > > - s = find_section(hdr, sechdrs, ".text.ftrace_trampoline"); > > - if (!s) > > - return -ENOEXEC; > > - me->arch.ftrace_trampoline = (void *)s->sh_addr; > > - } > > -#endif > > - > > - return 0; > > + return module_init_ftrace_plt(hdr, sechdrs, me); > > } > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel