pgo: modules Add definitions in pgo/pgo.h for modules
PATCH 2/6 pgo: modules Add definitions in pgo/pgo.h for modules
Add new function and struct definitions to pgo/pgo.h
Few functions are shared by the new machinery so mark them as extern.
Signed-off-by Jarmo Tiitto <[email protected]>
--- kernel/pgo/fs.c | 13 ++++++++----- kernel/pgo/pgo.h | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 5 deletions(-)
kernel/pgo/fs.c +8 -5
@@ -26,7 +26,7 @@#include <linux/vmalloc.h> #include "pgo.h" -static struct dentry *directory; +struct dentry *directory;struct prf_private_data {void *buffer;
@@ -82,7 +82,7 @@ static void prf_copy_to_buffer(void **buffer, void *src, unsigned long size) *buffer += size; } -static u32 __prf_get_value_size (struct llvm_prf_data *p,u32 *value_kinds) +u32 __prf_get_value_size (struct llvm_prf_data *p,u32 *value_kinds) {struct llvm_prf_value_node **nodes = (struct llvm_prf_value_node **)p->values;
@@ -140,7 +140,7 @@ static u32 prf_get_value_size(void) }/* Serialize the profiling's value. */ -static void prf_serialize_value (struct llvm_prf_data *p,void **buffer) +void prf_serialize_value (struct llvm_prf_data *p,void **buffer) {struct llvm_prf_value_data header; struct llvm_prf_value_node **nodes =
@@ -254,7 +254,10 @@ static int prf_serialize(struct prf_private_data *p)return err; } -/* open() implementation for PGO. Creates a copy of the profiling data set. */ +/* +* open() implementation for PGO. +* Creates a copy of the profiling data set. +*/ static int prf_open (struct inode *inode,struct file *file) {struct prf_private_data *data;
@@ -292,7 +295,7 @@ static ssize_t prf_read(struct file *file, char __user *buf, size_t count,BUG_ON (!data);return simple_read_from_buffer (buf, count, ppos, data->buffer, - data->size); + data->size); }/* release() implementation for PGO. Release resources allocated by open(). */
kernel/pgo/pgo.h +39 -0
@@ -19,6 +19,11 @@#ifndef _PGO_H#define _PGO_H +#include <linux/kernel.h> +#include <linux/debugfs.h> +#include <linux/fs.h> +#include <linux/module.h> +/* * Note: These internal LLVM definitions must match the compiler version. * See llvm/include/llvm/ProfileData/InstrProfData.inc in LLVM's source code.
@@ -200,4 +205,38 @@ __DEFINE_PRF_SIZE(vnds);#undef __DEFINE_PRF_SIZE +/* debugfs directory */ +extern struct dentry *directory; + +struct prf_mod_private_data { +struct list_head link; +struct rcu_head rcu; + +void *buffer; +unsigned long size; + +char mod_name[MODULE_NAME_LEN ]; +struct module *mod; +struct dentry *file; + +int current_node; +}; + +/* Mutex protecting the prf_mod_list and entries */ +extern struct mutex prf_mod_lock; + +/* List of modules profiled */ +extern struct list_head prf_mod_list; + +extern void prf_modules_init (void ); +extern void prf_modules_exit (void ); + +/* Update each modules snapshot of the profiling data. */ +extern int prf_modules_snapshot (void ); + +/* below funcs are required by prf_modules_snapshot() */ +extern u32 __prf_get_value_size (struct llvm_prf_data *p,u32 *value_kinds); + +extern void prf_serialize_value (struct llvm_prf_data *p,void **buffer); +#endif /* _PGO_H */
Signature · 1 line
2.31.1
Quoted 2 lines · Jarmo Tiitto
Add new function and struct definitions to
pgo/pgo.h
Few functions are shared by the new machinery so mark them as extern.
This patch probably belongs in 3/6 since these changes are only needed because of that and this patch is self contained to 'kernel/pgo'.
Quoted 115 lines
Signed-off-by Jarmo Tiitto <[email protected]>--- kernel/pgo/fs.c | 13 ++++++++----- kernel/pgo/pgo.h | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 5 deletions(-)kernel/pgo/fs.c +8
-5@@ -26,7 +26,7 @@#include <linux/vmalloc.h> #include "pgo.h" -static struct dentry *directory; +struct dentry *directory;struct prf_private_data {void *buffer;@@ -82,7 +82,7 @@ static void prf_copy_to_buffer(void **buffer, void *src, unsigned long size) *buffer += size; } -static u32 __prf_get_value_size (struct llvm_prf_data *p,u32 *value_kinds) +u32 __prf_get_value_size (struct llvm_prf_data *p,u32 *value_kinds) {struct llvm_prf_value_node **nodes = (struct llvm_prf_value_node **)p->values;@@ -140,7 +140,7 @@ static u32 prf_get_value_size(void) }/* Serialize the profiling's value. */ -static void prf_serialize_value (struct llvm_prf_data *p,void **buffer) +void prf_serialize_value (struct llvm_prf_data *p,void **buffer) {struct llvm_prf_value_data header; struct llvm_prf_value_node **nodes =@@ -254,7 +254,10 @@ static int prf_serialize(struct prf_private_data *p)return err; } -/* open() implementation for PGO. Creates a copy of the profiling data set. */ +/* +* open() implementation for PGO. +* Creates a copy of the profiling data set. +*/ static int prf_open (struct inode *inode,struct file *file) {struct prf_private_data *data;@@ -292,7 +295,7 @@ static ssize_t prf_read(struct file *file, char __user *buf, size_t count,BUG_ON (!data);return simple_read_from_buffer (buf, count, ppos, data->buffer, - data->size); + data->size); }/* release() implementation for PGO. Release resources allocated by open(). */ kernel/pgo/pgo.h +39
-0@@ -19,6 +19,11 @@#ifndef _PGO_H#define _PGO_H +#include <linux/kernel.h> +#include <linux/debugfs.h> +#include <linux/fs.h> +#include <linux/module.h> +/* * Note: These internal LLVM definitions must match the compiler version. * See llvm/include/llvm/ProfileData/InstrProfData.inc in LLVM's source code. @@ -200,4 +205,38 @@ __DEFINE_PRF_SIZE(vnds);#undef __DEFINE_PRF_SIZE +/* debugfs directory */ +extern struct dentry *directory; + +struct prf_mod_private_data { +struct list_head link; +struct rcu_head rcu; + +void *buffer; +unsigned long size; + +char mod_name[MODULE_NAME_LEN ]; +struct module *mod; +struct dentry *file; + +int current_node; +}; + +/* Mutex protecting the prf_mod_list and entries */ +extern struct mutex prf_mod_lock; + +/* List of modules profiled */ +extern struct list_head prf_mod_list; + +extern void prf_modules_init (void ); +extern void prf_modules_exit (void ); + +/* Update each modules snapshot of the profiling data. */ +extern int prf_modules_snapshot (void ); + +/* below funcs are required by prf_modules_snapshot() */ +extern u32 __prf_get_value_size (struct llvm_prf_data *p,u32 *value_kinds); + +extern void prf_serialize_value (struct llvm_prf_data *p,void **buffer); +#endif /* _PGO_H */ Signature · 1 line
2.31.1