* [PATCH 0/4] libtracefs: Address the comments that Tzvetomir had for the get affinity functions
@ 2022-01-19 15:57 Steven Rostedt
2022-01-19 15:57 ` [PATCH 1/4] libtracefs: Add the get_affinity functions to the main libtracefs man page Steven Rostedt
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Steven Rostedt @ 2022-01-19 15:57 UTC (permalink / raw)
To: linux-trace-devel; +Cc: Steven Rostedt (Google)
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
This set fixes the issues that Tzvetomir had on the commits that added the
tracefs_instance_get_affinity*() functions.
Link: https://lore.kernel.org/all/CAPpZLN4n=L-ZHCXM+LDRiQu0XwR4iCnGeCKJOuOWenkz2EhESA@mail.gmail.com/
Steven Rostedt (Google) (4):
libtracefs: Add the get_affinity functions to the main libtracefs man
page
libtracefs: Fix typos and grammar in get_affinity man page
libtracefs: Fix grammar in tracefs_instance_get_affinity() comment
libtracefs: Do not count CPUs beyond set size in get_affinity
Documentation/libtracefs-instances-affinity.txt | 4 ++--
Documentation/libtracefs.txt | 3 +++
src/tracefs-instance.c | 13 +++++++++++--
3 files changed, 16 insertions(+), 4 deletions(-)
--
2.33.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] libtracefs: Add the get_affinity functions to the main libtracefs man page
2022-01-19 15:57 [PATCH 0/4] libtracefs: Address the comments that Tzvetomir had for the get affinity functions Steven Rostedt
@ 2022-01-19 15:57 ` Steven Rostedt
2022-01-19 15:57 ` [PATCH 2/4] libtracefs: Fix typos and grammar in get_affinity " Steven Rostedt
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2022-01-19 15:57 UTC (permalink / raw)
To: linux-trace-devel; +Cc: Steven Rostedt (Google), Tzvetomir Stoyanov
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
The main libtracefs man page should contain all the available API
functions.
Link: https://lore.kernel.org/all/CAPpZLN4n=L-ZHCXM+LDRiQu0XwR4iCnGeCKJOuOWenkz2EhESA@mail.gmail.com/
Reported-by: Tzvetomir Stoyanov <tz.stoyanov@gmail.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
Documentation/libtracefs.txt | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Documentation/libtracefs.txt b/Documentation/libtracefs.txt
index e7eb090b8268..33988007d865 100644
--- a/Documentation/libtracefs.txt
+++ b/Documentation/libtracefs.txt
@@ -35,6 +35,9 @@ Trace instances:
int *tracefs_instance_set_affinity*(struct tracefs_instance pass:[*]_instance_, const char pass:[*]_cpu_str_);
int *tracefs_instance_set_affinity_set*(struct tracefs_instance pass:[*]_instance_, cpu_set_t pass:[*]_set_, size_t _set_size_);
int *tracefs_instance_set_affinity_raw*(struct tracefs_instance pass:[*]_instance_, const char pass:[*]_mask_);
+ char pass:[*]*tracefs_instance_get_affinity*(struct tracefs_instance pass:[*]_instance_);
+ int *tracefs_instance_get_affinity_set*(struct tracefs_instance pass:[*]_instance_, cpu_set_t pass:[*]_set_, size_t _set_size_);
+ char pass:[*]*tracefs_instance_get_affinity_raw*(struct tracefs_instance pass:[*]_instance_);
Trace events:
char pass:[*]pass:[*]*tracefs_event_systems*(const char pass:[*]_tracing_dir_);
--
2.33.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] libtracefs: Fix typos and grammar in get_affinity man page
2022-01-19 15:57 [PATCH 0/4] libtracefs: Address the comments that Tzvetomir had for the get affinity functions Steven Rostedt
2022-01-19 15:57 ` [PATCH 1/4] libtracefs: Add the get_affinity functions to the main libtracefs man page Steven Rostedt
@ 2022-01-19 15:57 ` Steven Rostedt
2022-01-19 15:57 ` [PATCH 3/4] libtracefs: Fix grammar in tracefs_instance_get_affinity() comment Steven Rostedt
2022-01-19 15:57 ` [PATCH 4/4] libtracefs: Do not count CPUs beyond set size in get_affinity Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2022-01-19 15:57 UTC (permalink / raw)
To: linux-trace-devel; +Cc: Steven Rostedt (Google), Tzvetomir Stoyanov
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
There were some mistakes in the man page for the get_affinity() API
functions. Fix them.
Link: https://lore.kernel.org/all/CAPpZLN4n=L-ZHCXM+LDRiQu0XwR4iCnGeCKJOuOWenkz2EhESA@mail.gmail.com/
Reported-by: Tzvetomir Stoyanov <tz.stoyanov@gmail.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
Documentation/libtracefs-instances-affinity.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/libtracefs-instances-affinity.txt b/Documentation/libtracefs-instances-affinity.txt
index 0f3093d62035..107334dd1298 100644
--- a/Documentation/libtracefs-instances-affinity.txt
+++ b/Documentation/libtracefs-instances-affinity.txt
@@ -24,7 +24,7 @@ char pass:[*]*tracefs_instance_get_affinity_raw*(struct tracefs_instance pass:[*
DESCRIPTION
-----------
-These functions set or retrieves the CPU affinity that limits what CPUs will have tracing enabled
+These functions set or retrieve the CPU affinity that limits what CPUs will have tracing enabled
for a given instance defined by the _instance_ parameter. If _instance_ is NULL, then
the top level instance is affected.
@@ -71,7 +71,7 @@ RETURN VALUE
------------
All the set functions return 0 on success and -1 on error.
-The functinos *tracefs_instance_get_affinity()* and *tracefs_instance_get_affinity_raw()*
+The functions *tracefs_instance_get_affinity()* and *tracefs_instance_get_affinity_raw()*
returns an allocated string that must be freed with *free*(3), or NULL on error.
The function *tracefs_instance_get_affinity_set()* returns the number of CPUs that
--
2.33.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] libtracefs: Fix grammar in tracefs_instance_get_affinity() comment
2022-01-19 15:57 [PATCH 0/4] libtracefs: Address the comments that Tzvetomir had for the get affinity functions Steven Rostedt
2022-01-19 15:57 ` [PATCH 1/4] libtracefs: Add the get_affinity functions to the main libtracefs man page Steven Rostedt
2022-01-19 15:57 ` [PATCH 2/4] libtracefs: Fix typos and grammar in get_affinity " Steven Rostedt
@ 2022-01-19 15:57 ` Steven Rostedt
2022-01-19 15:57 ` [PATCH 4/4] libtracefs: Do not count CPUs beyond set size in get_affinity Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2022-01-19 15:57 UTC (permalink / raw)
To: linux-trace-devel; +Cc: Steven Rostedt (Google), Tzvetomir Stoyanov
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
There was a grammar mistake in the comment describing the
tracefs_instance_get_affinity() function. Fix it.
Link: https://lore.kernel.org/all/CAPpZLN4n=L-ZHCXM+LDRiQu0XwR4iCnGeCKJOuOWenkz2EhESA@mail.gmail.com/
Reported-by: Tzvetomir Stoyanov <tz.stoyanov@gmail.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
src/tracefs-instance.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/tracefs-instance.c b/src/tracefs-instance.c
index 2d825b0e3bd0..db51af3818f0 100644
--- a/src/tracefs-instance.c
+++ b/src/tracefs-instance.c
@@ -1112,7 +1112,7 @@ static inline int update_cpu(int cpus, int cpu_set, int cpu, int s, char **set)
* If no CPUs are set, an empty string is returned "\0", and it too needs
* to be freed.
*
- * Returns an allocate string containing the CPU affinity in "human readable"
+ * Returns an allocated string containing the CPU affinity in "human readable"
* format which needs to be freed with free(), or NULL on error.
*/
char *tracefs_instance_get_affinity(struct tracefs_instance *instance)
--
2.33.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] libtracefs: Do not count CPUs beyond set size in get_affinity
2022-01-19 15:57 [PATCH 0/4] libtracefs: Address the comments that Tzvetomir had for the get affinity functions Steven Rostedt
` (2 preceding siblings ...)
2022-01-19 15:57 ` [PATCH 3/4] libtracefs: Fix grammar in tracefs_instance_get_affinity() comment Steven Rostedt
@ 2022-01-19 15:57 ` Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2022-01-19 15:57 UTC (permalink / raw)
To: linux-trace-devel; +Cc: Steven Rostedt (Google), Tzvetomir Stoyanov
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
If the string of CPUs has bits set that are beyond the size that the
passed in cpu_set_t size can hold, do not set them.
This relies on the _S version of the CPU_SET macros from not crashing if
the size if too big. One would think that the _S versions would be made
specifically to protect against being too big.
If a CPU is set in the string but is outside the size limit of the
cpu_set_t passed in, then do not add it to the count that is returned by
tracefs_instance_get_affinity_set().
Link: https://lore.kernel.org/all/CAPpZLN4n=L-ZHCXM+LDRiQu0XwR4iCnGeCKJOuOWenkz2EhESA@mail.gmail.com/
Reported-by: Tzvetomir Stoyanov <tz.stoyanov@gmail.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
src/tracefs-instance.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/tracefs-instance.c b/src/tracefs-instance.c
index db51af3818f0..1493938fa445 100644
--- a/src/tracefs-instance.c
+++ b/src/tracefs-instance.c
@@ -1000,7 +1000,16 @@ static inline int update_cpu_set(int cpus, int cpu_set, int cpu,
return 0;
CPU_SET_S(cpu_set + cpu, set_size, set);
- return 1;
+
+ /*
+ * It is possible that the passed in set_size is not big enough
+ * to hold the cpu we just set. If that's the case, do not report
+ * it as being set.
+ *
+ * The CPU_ISSET_S() should return false if the CPU given to it
+ * is bigger than the set itself.
+ */
+ return CPU_ISSET_S(cpu_set + cpu, set_size, set) ? 1 : 0;
}
/**
--
2.33.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-01-19 15:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19 15:57 [PATCH 0/4] libtracefs: Address the comments that Tzvetomir had for the get affinity functions Steven Rostedt
2022-01-19 15:57 ` [PATCH 1/4] libtracefs: Add the get_affinity functions to the main libtracefs man page Steven Rostedt
2022-01-19 15:57 ` [PATCH 2/4] libtracefs: Fix typos and grammar in get_affinity " Steven Rostedt
2022-01-19 15:57 ` [PATCH 3/4] libtracefs: Fix grammar in tracefs_instance_get_affinity() comment Steven Rostedt
2022-01-19 15:57 ` [PATCH 4/4] libtracefs: Do not count CPUs beyond set size in get_affinity Steven Rostedt
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.