Message ID | 20230616085038.4121892-12-rppt@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1184673vqr; Fri, 16 Jun 2023 02:02:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ71+e1I7MBekDbl3mj50/yshYfno9LEB+ZSWZiaWqmesUBGGh1uHGsDyM200Oj6rR332lxP X-Received: by 2002:a17:902:82c5:b0:1b0:6c3:e851 with SMTP id u5-20020a17090282c500b001b006c3e851mr1221106plz.18.1686906130441; Fri, 16 Jun 2023 02:02:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686906130; cv=none; d=google.com; s=arc-20160816; b=RjrraGlgXFrRUCUpgIVcLU6B/h6uf6AIXkUJj6cW1eX8bJ6pj7RKgjZACcOopVzTlp C/IO9aZe/VBxYXzuS8/eZw8LVX3+46WbD/QJvjrI6WHfOWdY9b/EPVqFncMIcO626gls wH6BQZtpyOUx3lO4vZXchcTV564HoykUbDt4ekUQqCAyCMbo2A1WLnEEhvYrRDokOrie OBIOqRlAuykXOucM1ywRtpSyjZ4vm3P0AP88x7mTUeuwVlbXs23xaDcA+zwn1aWkp7nA L3NE/K8i8lhKGIy+FN/RALQGD9iSlui/lWlo70I9jdrUWVJsPBxKJJZnpzeTNM+mwaTD V7xw== 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:date:subject:cc:to:from :dkim-signature; bh=OgAt4ezC9xg1K/VziibYiK4HUTJaPJMQPYbGPHPDUy4=; b=JlAPE3NL5GYaf29IVPLNtSUW9cUVYP4GcIEwxONW+QlmdCHzmy8oPBTxiMycKXqgfy zoKMZX/07UMWZV2+SD9ZlGXZ/jennAj64KiY+yqQWG6RXBoiWmFZRVi6LcMzmBminYfF KHcUvQW6g1TPnjQ79qiOuDcQVFBufq4oP9NiHbN8vc9t33M/wxB3UjZBz1duyVk4tenw OLnmARmFn4vLFuO4nC8D+sDE401YLx2EzY08KGTLwOFtIKmEpzLb5ZmZYnzrtv/spFSK XI3wte/niFrC8suYy1eonEJZJ7VPRFBQoQpxjfR4R4+prryK84uNjFsVrTzKUhxoTbBN ZEvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZchgUMnn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i1-20020a170902c94100b001b3ce5b5415si9516098pla.401.2023.06.16.02.01.58; Fri, 16 Jun 2023 02:02:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZchgUMnn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244736AbjFPIxq (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Fri, 16 Jun 2023 04:53:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343849AbjFPIw5 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 16 Jun 2023 04:52:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E3AC3A81; Fri, 16 Jun 2023 01:52:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 927E463178; Fri, 16 Jun 2023 08:52:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63411C433CD; Fri, 16 Jun 2023 08:52:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686905566; bh=AxRcB1rbG7MX4ajPnkYNEbWMZh1yl4AN5nTT9Qz7DHU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZchgUMnnGJtygAK+raIh8zX9M61bZysDceEU+itjtebjtydTZ0C8fH1hI5bi4yGBb 0+mHlJlsA3sTSWJjXOVsf+IFNO63l+46LQ4D8pW+jkx2afKib/rMkLoAvh4O974KxA QCl4Bqu8K2hxeNPu/cB6HvnMBzBbnvOHtf3y2YLFQGcwRgm1+P0WIvE/z5ZbUIw91u ba1rD6V2jMggpxQpwYe/sAWEddvOz0cJmvshYC2bRpQgDYIvsL6oUpJnQkOfJkKIux i+LFm6hoyQ9aaY4Ey4iQt1b/bqoxupbOQ2/L2miYy/B9MD5ckQj1/ij4pRHCf3zadw X6rUYOmGj4t1Q== From: Mike Rapoport <rppt@kernel.org> To: linux-kernel@vger.kernel.org Cc: Andrew Morton <akpm@linux-foundation.org>, Catalin Marinas <catalin.marinas@arm.com>, Christophe Leroy <christophe.leroy@csgroup.eu>, "David S. Miller" <davem@davemloft.net>, Dinh Nguyen <dinguyen@kernel.org>, Heiko Carstens <hca@linux.ibm.com>, Helge Deller <deller@gmx.de>, Huacai Chen <chenhuacai@kernel.org>, Kent Overstreet <kent.overstreet@linux.dev>, Luis Chamberlain <mcgrof@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Michael Ellerman <mpe@ellerman.id.au>, Mike Rapoport <rppt@kernel.org>, Nadav Amit <nadav.amit@gmail.com>, "Naveen N. Rao" <naveen.n.rao@linux.ibm.com>, Palmer Dabbelt <palmer@dabbelt.com>, Puranjay Mohan <puranjay12@gmail.com>, Rick Edgecombe <rick.p.edgecombe@intel.com>, Russell King <linux@armlinux.org.uk>, Song Liu <song@kernel.org>, Steven Rostedt <rostedt@goodmis.org>, Thomas Bogendoerfer <tsbogend@alpha.franken.de>, Thomas Gleixner <tglx@linutronix.de>, Will Deacon <will@kernel.org>, bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, netdev@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org Subject: [PATCH v2 11/12] x86/ftrace: enable dynamic ftrace without CONFIG_MODULES Date: Fri, 16 Jun 2023 11:50:37 +0300 Message-Id: <20230616085038.4121892-12-rppt@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230616085038.4121892-1-rppt@kernel.org> References: <20230616085038.4121892-1-rppt@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768849282297807036?= X-GMAIL-MSGID: =?utf-8?q?1768849282297807036?= |
Series |
mm: jit/text allocator
|
|
Commit Message
Mike Rapoport
June 16, 2023, 8:50 a.m. UTC
From: "Mike Rapoport (IBM)" <rppt@kernel.org> Dynamic ftrace must allocate memory for code and this was impossible without CONFIG_MODULES. With execmem separated from the modules code, execmem_text_alloc() is available regardless of CONFIG_MODULES. Remove dependency of dynamic ftrace on CONFIG_MODULES and make CONFIG_DYNAMIC_FTRACE select CONFIG_EXECMEM in Kconfig. Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org> --- arch/x86/Kconfig | 1 + arch/x86/kernel/ftrace.c | 10 ---------- 2 files changed, 1 insertion(+), 10 deletions(-)
Comments
On Fri, Jun 16, 2023 at 1:52 AM Mike Rapoport <rppt@kernel.org> wrote: > > From: "Mike Rapoport (IBM)" <rppt@kernel.org> > > Dynamic ftrace must allocate memory for code and this was impossible > without CONFIG_MODULES. > > With execmem separated from the modules code, execmem_text_alloc() is > available regardless of CONFIG_MODULES. > > Remove dependency of dynamic ftrace on CONFIG_MODULES and make > CONFIG_DYNAMIC_FTRACE select CONFIG_EXECMEM in Kconfig. > > Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org> Acked-by: Song Liu <song@kernel.org> > --- > arch/x86/Kconfig | 1 + > arch/x86/kernel/ftrace.c | 10 ---------- > 2 files changed, 1 insertion(+), 10 deletions(-) > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > index 53bab123a8ee..ab64bbef9e50 100644 > --- a/arch/x86/Kconfig > +++ b/arch/x86/Kconfig > @@ -35,6 +35,7 @@ config X86_64 > select SWIOTLB > select ARCH_HAS_ELFCORE_COMPAT > select ZONE_DMA32 > + select EXECMEM if DYNAMIC_FTRACE > > config FORCE_DYNAMIC_FTRACE > def_bool y > diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c > index f77c63bb3203..a824a5d3b129 100644 > --- a/arch/x86/kernel/ftrace.c > +++ b/arch/x86/kernel/ftrace.c > @@ -261,8 +261,6 @@ void arch_ftrace_update_code(int command) > /* Currently only x86_64 supports dynamic trampolines */ > #ifdef CONFIG_X86_64 > > -#ifdef CONFIG_MODULES > -/* Module allocation simplifies allocating memory for code */ > static inline void *alloc_tramp(unsigned long size) > { > return execmem_text_alloc(size); > @@ -271,14 +269,6 @@ static inline void tramp_free(void *tramp) > { > execmem_free(tramp); > } > -#else > -/* Trampolines can only be created if modules are supported */ > -static inline void *alloc_tramp(unsigned long size) > -{ > - return NULL; > -} > -static inline void tramp_free(void *tramp) { } > -#endif > > /* Defined as markers to the end of the ftrace default trampolines */ > extern void ftrace_regs_caller_end(void); > -- > 2.35.1 >
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 53bab123a8ee..ab64bbef9e50 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -35,6 +35,7 @@ config X86_64 select SWIOTLB select ARCH_HAS_ELFCORE_COMPAT select ZONE_DMA32 + select EXECMEM if DYNAMIC_FTRACE config FORCE_DYNAMIC_FTRACE def_bool y diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index f77c63bb3203..a824a5d3b129 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c @@ -261,8 +261,6 @@ void arch_ftrace_update_code(int command) /* Currently only x86_64 supports dynamic trampolines */ #ifdef CONFIG_X86_64 -#ifdef CONFIG_MODULES -/* Module allocation simplifies allocating memory for code */ static inline void *alloc_tramp(unsigned long size) { return execmem_text_alloc(size); @@ -271,14 +269,6 @@ static inline void tramp_free(void *tramp) { execmem_free(tramp); } -#else -/* Trampolines can only be created if modules are supported */ -static inline void *alloc_tramp(unsigned long size) -{ - return NULL; -} -static inline void tramp_free(void *tramp) { } -#endif /* Defined as markers to the end of the ftrace default trampolines */ extern void ftrace_regs_caller_end(void);