Patch "tools/rtla: fix collision with glibc sched_attr/sched_set_attr" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    tools/rtla: fix collision with glibc sched_attr/sched_set_attr

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     tools-rtla-fix-collision-with-glibc-sched_attr-sched.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit aaed64f9a7b9fa2d3f2d0226f9322caa1b127907
Author: Jan Stancek <jstancek@xxxxxxxxxx>
Date:   Thu Oct 10 17:09:48 2024 +0200

    tools/rtla: fix collision with glibc sched_attr/sched_set_attr
    
    [ Upstream commit 0eecee340672c4b512f6f4a8c6add26df05d130c ]
    
    glibc commit 21571ca0d703 ("Linux: Add the sched_setattr
    and sched_getattr functions") now also provides 'struct sched_attr'
    and sched_setattr() which collide with the ones from rtla.
    
      In file included from src/trace.c:11:
      src/utils.h:49:8: error: redefinition of ‘struct sched_attr’
         49 | struct sched_attr {
            |        ^~~~~~~~~~
      In file included from /usr/include/bits/sched.h:60,
                       from /usr/include/sched.h:43,
                       from /usr/include/tracefs/tracefs.h:10,
                       from src/trace.c:4:
      /usr/include/linux/sched/types.h:98:8: note: originally defined here
         98 | struct sched_attr {
            |        ^~~~~~~~~~
    
    Define 'struct sched_attr' conditionally, similar to what strace did:
      https://lore.kernel.org/all/20240930222913.3981407-1-raj.khem@xxxxxxxxx/
    and rename rtla's version of sched_setattr() to avoid collision.
    
    Link: https://lore.kernel.org/8088f66a7a57c1b209cd8ae0ae7c336a7f8c930d.1728572865.git.jstancek@xxxxxxxxxx
    Signed-off-by: Jan Stancek <jstancek@xxxxxxxxxx>
    Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/tracing/rtla/src/utils.c b/tools/tracing/rtla/src/utils.c
index 8c8d63c7196cf..02194773ef12d 100644
--- a/tools/tracing/rtla/src/utils.c
+++ b/tools/tracing/rtla/src/utils.c
@@ -238,7 +238,7 @@ long parse_ns_duration(char *val)
 
 #define SCHED_DEADLINE		6
 
-static inline int sched_setattr(pid_t pid, const struct sched_attr *attr,
+static inline int syscall_sched_setattr(pid_t pid, const struct sched_attr *attr,
 				unsigned int flags) {
 	return syscall(__NR_sched_setattr, pid, attr, flags);
 }
@@ -248,7 +248,7 @@ int __set_sched_attr(int pid, struct sched_attr *attr)
 	int flags = 0;
 	int retval;
 
-	retval = sched_setattr(pid, attr, flags);
+	retval = syscall_sched_setattr(pid, attr, flags);
 	if (retval < 0) {
 		err_msg("Failed to set sched attributes to the pid %d: %s\n",
 			pid, strerror(errno));
diff --git a/tools/tracing/rtla/src/utils.h b/tools/tracing/rtla/src/utils.h
index 92da41aaf4c4c..e445ccf15e701 100644
--- a/tools/tracing/rtla/src/utils.h
+++ b/tools/tracing/rtla/src/utils.h
@@ -44,6 +44,7 @@ update_sum(unsigned long long *a, unsigned long long *b)
 	*a += *b;
 }
 
+#ifndef SCHED_ATTR_SIZE_VER0
 struct sched_attr {
 	uint32_t size;
 	uint32_t sched_policy;
@@ -54,6 +55,7 @@ struct sched_attr {
 	uint64_t sched_deadline;
 	uint64_t sched_period;
 };
+#endif /* SCHED_ATTR_SIZE_VER0 */
 
 int parse_prio(char *arg, struct sched_attr *sched_param);
 int set_comm_sched_attr(const char *comm_prefix, struct sched_attr *attr);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux