From: Christoph Hellwig <hch@lst.de> To: Frederic Barrat <fbarrat@linux.ibm.com>, Andrew Donnellan <ajd@linux.ibm.com>, Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>, Jessica Yu <jeyu@kernel.org>, Josh Poimboeuf <jpoimboe@redhat.com>, Jiri Kosina <jikos@kernel.org>, Miroslav Benes <mbenes@suse.cz>, Petr Mladek <pmladek@suse.com>, Joe Lawrence <joe.lawrence@redhat.com> Cc: Masahiro Yamada <masahiroy@kernel.org>, Michal Marek <michal.lkml@markovi.net>, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, dri-devel@lists.freedesktop.org, live-patching@vger.kernel.org, linux-kbuild@vger.kernel.org Subject: [PATCH 06/13] kallsyms: only build {,module_}kallsyms_on_each_symbol when required Date: Tue, 2 Feb 2021 13:13:27 +0100 [thread overview] Message-ID: <20210202121334.1361503-7-hch@lst.de> (raw) In-Reply-To: <20210202121334.1361503-1-hch@lst.de> kallsyms_on_each_symbol and module_kallsyms_on_each_symbol are only used by the livepatching code, so don't build them if livepatching is not enabled. Signed-off-by: Christoph Hellwig <hch@lst.de> --- include/linux/kallsyms.h | 17 ++++------------- include/linux/module.h | 16 ++++------------ kernel/kallsyms.c | 2 ++ kernel/module.c | 2 ++ 4 files changed, 12 insertions(+), 25 deletions(-) diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h index 481273f0c72d42..465060acc9816f 100644 --- a/include/linux/kallsyms.h +++ b/include/linux/kallsyms.h @@ -71,15 +71,14 @@ static inline void *dereference_symbol_descriptor(void *ptr) return ptr; } -#ifdef CONFIG_KALLSYMS -/* Lookup the address for a symbol. Returns 0 if not found. */ -unsigned long kallsyms_lookup_name(const char *name); - -/* Call a function on each kallsyms symbol in the core kernel */ int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, unsigned long), void *data); +#ifdef CONFIG_KALLSYMS +/* Lookup the address for a symbol. Returns 0 if not found. */ +unsigned long kallsyms_lookup_name(const char *name); + extern int kallsyms_lookup_size_offset(unsigned long addr, unsigned long *symbolsize, unsigned long *offset); @@ -108,14 +107,6 @@ static inline unsigned long kallsyms_lookup_name(const char *name) return 0; } -static inline int kallsyms_on_each_symbol(int (*fn)(void *, const char *, - struct module *, - unsigned long), - void *data) -{ - return 0; -} - static inline int kallsyms_lookup_size_offset(unsigned long addr, unsigned long *symbolsize, unsigned long *offset) diff --git a/include/linux/module.h b/include/linux/module.h index a64aa84d1b182c..3ea4ffae608f97 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -608,10 +608,6 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type, /* Look for this name: can be of form module:name. */ unsigned long module_kallsyms_lookup_name(const char *name); -int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, - struct module *, unsigned long), - void *data); - extern void __noreturn __module_put_and_exit(struct module *mod, long code); #define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code) @@ -795,14 +791,6 @@ static inline unsigned long module_kallsyms_lookup_name(const char *name) return 0; } -static inline int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, - struct module *, - unsigned long), - void *data) -{ - return 0; -} - static inline int register_module_notifier(struct notifier_block *nb) { /* no events will happen anyway, so this can always succeed */ @@ -891,4 +879,8 @@ static inline bool module_sig_ok(struct module *module) } #endif /* CONFIG_MODULE_SIG */ +int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, + struct module *, unsigned long), + void *data); + #endif /* _LINUX_MODULE_H */ diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index a0d3f0865916f9..8043a90aa50ed3 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c @@ -177,6 +177,7 @@ unsigned long kallsyms_lookup_name(const char *name) return module_kallsyms_lookup_name(name); } +#ifdef CONFIG_LIVEPATCH /* * Iterate over all symbols in vmlinux. For symbols from modules use * module_kallsyms_on_each_symbol instead. @@ -198,6 +199,7 @@ int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, } return 0; } +#endif /* CONFIG_LIVEPATCH */ static unsigned long get_symbol_pos(unsigned long addr, unsigned long *symbolsize, diff --git a/kernel/module.c b/kernel/module.c index 25345792c770d1..470fd9d9d68f97 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -4366,6 +4366,7 @@ unsigned long module_kallsyms_lookup_name(const char *name) return ret; } +#ifdef CONFIG_LIVEPATCH int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, unsigned long), void *data) @@ -4396,6 +4397,7 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, mutex_unlock(&module_mutex); return ret; } +#endif /* CONFIG_LIVEPATCH */ #endif /* CONFIG_KALLSYMS */ /* Maximum number of characters written by module_flags() */ -- 2.29.2
WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de> To: Frederic Barrat <fbarrat@linux.ibm.com>, Andrew Donnellan <ajd@linux.ibm.com>, Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>, Jessica Yu <jeyu@kernel.org>, Josh Poimboeuf <jpoimboe@redhat.com>, Jiri Kosina <jikos@kernel.org>, Miroslav Benes <mbenes@suse.cz>, Petr Mladek <pmladek@suse.com>, Joe Lawrence <joe.lawrence@redhat.com> Cc: Michal Marek <michal.lkml@markovi.net>, linux-kbuild@vger.kernel.org, Masahiro Yamada <masahiroy@kernel.org>, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, live-patching@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH 06/13] kallsyms: only build {, module_}kallsyms_on_each_symbol when required Date: Tue, 2 Feb 2021 13:13:27 +0100 [thread overview] Message-ID: <20210202121334.1361503-7-hch@lst.de> (raw) In-Reply-To: <20210202121334.1361503-1-hch@lst.de> kallsyms_on_each_symbol and module_kallsyms_on_each_symbol are only used by the livepatching code, so don't build them if livepatching is not enabled. Signed-off-by: Christoph Hellwig <hch@lst.de> --- include/linux/kallsyms.h | 17 ++++------------- include/linux/module.h | 16 ++++------------ kernel/kallsyms.c | 2 ++ kernel/module.c | 2 ++ 4 files changed, 12 insertions(+), 25 deletions(-) diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h index 481273f0c72d42..465060acc9816f 100644 --- a/include/linux/kallsyms.h +++ b/include/linux/kallsyms.h @@ -71,15 +71,14 @@ static inline void *dereference_symbol_descriptor(void *ptr) return ptr; } -#ifdef CONFIG_KALLSYMS -/* Lookup the address for a symbol. Returns 0 if not found. */ -unsigned long kallsyms_lookup_name(const char *name); - -/* Call a function on each kallsyms symbol in the core kernel */ int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, unsigned long), void *data); +#ifdef CONFIG_KALLSYMS +/* Lookup the address for a symbol. Returns 0 if not found. */ +unsigned long kallsyms_lookup_name(const char *name); + extern int kallsyms_lookup_size_offset(unsigned long addr, unsigned long *symbolsize, unsigned long *offset); @@ -108,14 +107,6 @@ static inline unsigned long kallsyms_lookup_name(const char *name) return 0; } -static inline int kallsyms_on_each_symbol(int (*fn)(void *, const char *, - struct module *, - unsigned long), - void *data) -{ - return 0; -} - static inline int kallsyms_lookup_size_offset(unsigned long addr, unsigned long *symbolsize, unsigned long *offset) diff --git a/include/linux/module.h b/include/linux/module.h index a64aa84d1b182c..3ea4ffae608f97 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -608,10 +608,6 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type, /* Look for this name: can be of form module:name. */ unsigned long module_kallsyms_lookup_name(const char *name); -int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, - struct module *, unsigned long), - void *data); - extern void __noreturn __module_put_and_exit(struct module *mod, long code); #define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code) @@ -795,14 +791,6 @@ static inline unsigned long module_kallsyms_lookup_name(const char *name) return 0; } -static inline int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, - struct module *, - unsigned long), - void *data) -{ - return 0; -} - static inline int register_module_notifier(struct notifier_block *nb) { /* no events will happen anyway, so this can always succeed */ @@ -891,4 +879,8 @@ static inline bool module_sig_ok(struct module *module) } #endif /* CONFIG_MODULE_SIG */ +int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, + struct module *, unsigned long), + void *data); + #endif /* _LINUX_MODULE_H */ diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index a0d3f0865916f9..8043a90aa50ed3 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c @@ -177,6 +177,7 @@ unsigned long kallsyms_lookup_name(const char *name) return module_kallsyms_lookup_name(name); } +#ifdef CONFIG_LIVEPATCH /* * Iterate over all symbols in vmlinux. For symbols from modules use * module_kallsyms_on_each_symbol instead. @@ -198,6 +199,7 @@ int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, } return 0; } +#endif /* CONFIG_LIVEPATCH */ static unsigned long get_symbol_pos(unsigned long addr, unsigned long *symbolsize, diff --git a/kernel/module.c b/kernel/module.c index 25345792c770d1..470fd9d9d68f97 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -4366,6 +4366,7 @@ unsigned long module_kallsyms_lookup_name(const char *name) return ret; } +#ifdef CONFIG_LIVEPATCH int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, unsigned long), void *data) @@ -4396,6 +4397,7 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, mutex_unlock(&module_mutex); return ret; } +#endif /* CONFIG_LIVEPATCH */ #endif /* CONFIG_KALLSYMS */ /* Maximum number of characters written by module_flags() */ -- 2.29.2
next prev parent reply other threads:[~2021-02-02 12:15 UTC|newest] Thread overview: 79+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-02-02 12:13 module loader dead code removal and cleanups v3 Christoph Hellwig 2021-02-02 12:13 ` Christoph Hellwig 2021-02-02 12:13 ` [PATCH 01/13] powerpc/powernv: remove get_cxl_module Christoph Hellwig 2021-02-02 12:13 ` Christoph Hellwig 2021-02-04 10:44 ` Michael Ellerman 2021-02-04 10:44 ` Michael Ellerman 2021-02-04 10:44 ` Michael Ellerman 2021-02-02 12:13 ` [PATCH 02/13] drm: remove drm_fb_helper_modinit Christoph Hellwig 2021-02-02 12:13 ` Christoph Hellwig 2021-02-02 12:13 ` [PATCH 03/13] module: unexport find_module and module_mutex Christoph Hellwig 2021-02-02 12:13 ` Christoph Hellwig 2021-02-02 12:13 ` [PATCH 04/13] module: use RCU to synchronize find_module Christoph Hellwig 2021-02-02 12:13 ` Christoph Hellwig 2021-02-02 12:13 ` [PATCH 05/13] kallsyms: refactor {,module_}kallsyms_on_each_symbol Christoph Hellwig 2021-02-02 12:13 ` Christoph Hellwig 2021-02-03 8:58 ` Petr Mladek 2021-02-03 8:58 ` Petr Mladek 2021-02-03 8:58 ` Petr Mladek 2021-02-02 12:13 ` Christoph Hellwig [this message] 2021-02-02 12:13 ` [PATCH 06/13] kallsyms: only build {, module_}kallsyms_on_each_symbol when required Christoph Hellwig 2021-02-02 14:03 ` [PATCH 06/13] kallsyms: only build {,module_}kallsyms_on_each_symbol " Miroslav Benes 2021-02-02 14:03 ` [PATCH 06/13] kallsyms: only build {, module_}kallsyms_on_each_symbol " Miroslav Benes 2021-02-02 14:03 ` Miroslav Benes 2021-02-02 12:13 ` [PATCH 07/13] module: mark module_mutex static Christoph Hellwig 2021-02-02 12:13 ` Christoph Hellwig 2021-02-02 14:04 ` Miroslav Benes 2021-02-02 14:04 ` Miroslav Benes 2021-02-02 14:04 ` Miroslav Benes 2021-02-02 12:13 ` [PATCH 08/13] module: remove each_symbol_in_section Christoph Hellwig 2021-02-02 12:13 ` Christoph Hellwig 2021-02-02 14:04 ` Miroslav Benes 2021-02-02 14:04 ` Miroslav Benes 2021-02-02 14:04 ` Miroslav Benes 2021-02-02 12:13 ` [PATCH 09/13] module: merge each_symbol_section into find_symbol Christoph Hellwig 2021-02-02 12:13 ` Christoph Hellwig 2021-02-02 14:04 ` Miroslav Benes 2021-02-02 14:04 ` Miroslav Benes 2021-02-02 14:04 ` Miroslav Benes 2021-02-02 12:13 ` [PATCH 10/13] module: pass struct find_symbol_args to find_symbol Christoph Hellwig 2021-02-02 12:13 ` Christoph Hellwig 2021-02-02 14:07 ` Miroslav Benes 2021-02-02 14:07 ` Miroslav Benes 2021-02-02 14:07 ` Miroslav Benes 2021-02-02 15:41 ` Christoph Hellwig 2021-02-02 15:41 ` Christoph Hellwig 2021-02-03 9:04 ` Christoph Hellwig 2021-02-03 9:04 ` Christoph Hellwig 2021-02-03 9:31 ` Miroslav Benes 2021-02-03 9:31 ` Miroslav Benes 2021-02-03 9:31 ` Miroslav Benes 2021-02-02 12:13 ` [PATCH 11/13] module: move struct symsearch to module.c Christoph Hellwig 2021-02-02 12:13 ` Christoph Hellwig 2021-02-02 14:10 ` Miroslav Benes 2021-02-02 14:10 ` Miroslav Benes 2021-02-02 14:10 ` Miroslav Benes 2021-02-02 12:13 ` [PATCH 12/13] module: remove EXPORT_SYMBOL_GPL_FUTURE Christoph Hellwig 2021-02-02 12:13 ` Christoph Hellwig 2021-02-02 14:12 ` Miroslav Benes 2021-02-02 14:12 ` Miroslav Benes 2021-02-02 14:12 ` Miroslav Benes 2021-02-02 12:13 ` [PATCH 13/13] module: remove EXPORT_UNUSED_SYMBOL* Christoph Hellwig 2021-02-02 12:13 ` Christoph Hellwig 2021-02-02 14:21 ` Miroslav Benes 2021-02-02 14:21 ` Miroslav Benes 2021-02-02 14:21 ` Miroslav Benes 2021-02-02 14:37 ` module loader dead code removal and cleanups v3 Jessica Yu 2021-02-02 14:37 ` Jessica Yu 2021-02-02 14:37 ` Jessica Yu 2021-02-02 15:23 ` Christoph Hellwig 2021-02-02 15:23 ` Christoph Hellwig 2021-02-02 17:38 ` Emil Velikov 2021-02-02 17:38 ` Emil Velikov 2021-02-02 17:38 ` Emil Velikov 2021-02-08 11:36 ` Jessica Yu 2021-02-08 11:36 ` Jessica Yu 2021-02-08 11:36 ` Jessica Yu -- strict thread matches above, loose matches on Subject: below -- 2021-01-28 18:14 module loader dead code removal and cleanups v2 Christoph Hellwig 2021-01-28 18:14 ` [PATCH 06/13] kallsyms: only build {, module_}kallsyms_on_each_symbol when required Christoph Hellwig 2021-01-21 7:49 module loader dead code removal and cleanusp Christoph Hellwig 2021-01-21 7:49 ` [PATCH 06/13] kallsyms: only build {,module_}kallsyms_on_each_symbol when required Christoph Hellwig 2021-01-21 7:49 ` [PATCH 06/13] kallsyms: only build {, module_}kallsyms_on_each_symbol " Christoph Hellwig
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210202121334.1361503-7-hch@lst.de \ --to=hch@lst.de \ --cc=airlied@linux.ie \ --cc=ajd@linux.ibm.com \ --cc=daniel@ffwll.ch \ --cc=dri-devel@lists.freedesktop.org \ --cc=fbarrat@linux.ibm.com \ --cc=jeyu@kernel.org \ --cc=jikos@kernel.org \ --cc=joe.lawrence@redhat.com \ --cc=jpoimboe@redhat.com \ --cc=linux-kbuild@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linuxppc-dev@lists.ozlabs.org \ --cc=live-patching@vger.kernel.org \ --cc=maarten.lankhorst@linux.intel.com \ --cc=masahiroy@kernel.org \ --cc=mbenes@suse.cz \ --cc=michal.lkml@markovi.net \ --cc=mripard@kernel.org \ --cc=pmladek@suse.com \ --cc=tzimmermann@suse.de \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.