public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug runtime/30831] New: The do_each_thread macro has been removed from newest  linux 6.6 kernels
@ 2023-09-07 17:46 wcohen at redhat dot com
  2023-09-07 19:23 ` [Bug runtime/30831] Systemtap scripts fail to compile on " wcohen at redhat dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: wcohen at redhat dot com @ 2023-09-07 17:46 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=30831

            Bug ID: 30831
           Summary: The do_each_thread macro has been removed from newest
                    linux 6.6 kernels
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: runtime
          Assignee: systemtap at sourceware dot org
          Reporter: wcohen at redhat dot com
  Target Milestone: ---

When working with the newest linux 6.6 kernels in Fedora Rawhide scripts do not
compile because do_each_thread no longer exists in the kernel:

$ uname -a
Linux rawhide 6.6.0-0.rc0.20230905git3f86ed6ec0b3.7.fc40.x86_64 #1 SMP
PREEMPT_DYNAMIC Tue Sep  5 14:23:00 UTC 2023 x86_64 GNU/Linux
$ ../install/bin/stap -p4 -e 'probe begin {printf("hi!\n");exit()}'
In file included from
/home/wcohen/systemtap_write/install/share/systemtap/runtime/linux/task_finder.c:15,
                 from
/home/wcohen/systemtap_write/install/share/systemtap/runtime/linux/runtime.h:328,
                 from
/home/wcohen/systemtap_write/install/share/systemtap/runtime/runtime.h:26,
                 from
/tmp/stapFRPbtc/stap_c1555c4c3e68d9141933830206b88dd6_1339_src.c:21:
/home/wcohen/systemtap_write/install/share/systemtap/runtime/linux/task_finder2.c:
In function ‘stap_start_task_finder’:
/home/wcohen/systemtap_write/install/share/systemtap/runtime/linux/task_finder2.c:1721:9:
error: implicit declaration of function ‘do_each_thread’; did you mean
‘for_each_thread’? [-Werror=implicit-function-declaration]
 1721 |         do_each_thread(grp, tsk) {
      |         ^~~~~~~~~~~~~~
      |         for_each_thread
/home/wcohen/systemtap_write/install/share/systemtap/runtime/linux/task_finder2.c:1721:33:
error: expected ‘;’ before ‘{’ token
 1721 |         do_each_thread(grp, tsk) {
      |                                 ^~
      |                                 ;
/home/wcohen/systemtap_write/install/share/systemtap/runtime/linux/task_finder2.c:
In function ‘stap_task_finder_post_init’:
/home/wcohen/systemtap_write/install/share/systemtap/runtime/linux/task_finder2.c:1868:33:
error: expected ‘;’ before ‘{’ token
 1868 |         do_each_thread(grp, tsk) {
      |                                 ^~
      |                                 ;
In file included from
/home/wcohen/systemtap_write/install/share/systemtap/runtime/namespaces.h:17,
                 from
/tmp/stapFRPbtc/stap_c1555c4c3e68d9141933830206b88dd6_1339_src.c:73:
/home/wcohen/systemtap_write/install/share/systemtap/runtime/linux/namespaces.h:
In function ‘_stp_task_struct_valid’:
/home/wcohen/systemtap_write/install/share/systemtap/runtime/linux/namespaces.h:107:27:
error: expected ‘;’ before ‘{’ token
  107 |   do_each_thread(grp, tsk) {
      |                           ^~
      |                           ;
cc1: all warnings being treated as errors
make[1]: *** [scripts/Makefile.build:243:
/tmp/stapFRPbtc/stap_c1555c4c3e68d9141933830206b88dd6_1339_src.o] Error 1
make: *** [Makefile:2047: /tmp/stapFRPbtc] Error 2
WARNING: kbuild exited with status: 2
Pass 4: compilation failed.  [man error::pass4]


This is caused by kernel git commit 5ffd2c37cb7a53d52099e5ed1fd7ccbc9e358791

Author: Oleg Nesterov <oleg@redhat.com>  2023-08-17 12:37:08
Committer: Andrew Morton <akpm@linux-foundation.org>  2023-08-21 16:46:25
Parent: cdaac8e7e5a059f9b5e816cda257f08d0abffacd (nilfs2: fix WARNING in
mark_buffer_dirty due to discarded buffer reuse)
Child:  3d0b71398490fbf68f9c5766b6dce71eb89c4da0 (kstrtox: consistently use
_tolower())
Branches: master, remotes/origin/master
Follows: v6.5-rc4
Precedes: 

    kill do_each_thread()

    Eric has pointed out that we still have 3 users of do_each_thread().
    Change them to use for_each_process_thread() and kill this helper.

    There is a subtle change, after do_each_thread/while_each_thread g == t ==
    &init_task, while after for_each_process_thread() they both point to
    nowhere, but this doesn't matter.

    > Why is for_each_process_thread() better than do_each_thread()?

    Say, for_each_process_thread() is rcu safe, do_each_thread() is not.

    And certainly

        for_each_process_thread(p, t) {
                do_something(p, t);
        }

    looks better than

        do_each_thread(p, t) {
                do_something(p, t);
        } while_each_thread(p, t);

    And again, there are only 3 users of this awkward helper left.  It should
    have been killed years ago and in fact I thought it had already been
    killed.  It uses while_each_thread() which needs some changes.

    Link: https://lkml.kernel.org/r/20230817163708.GA8248@redhat.com
    Signed-off-by: Oleg Nesterov <oleg@redhat.com>
    Reviewed-by: Kees Cook <keescook@chromium.org>
    Cc: "Christian Brauner (Microsoft)" <brauner@kernel.org>
    Cc: Eric W. Biederman <ebiederm@xmission.com>
    Cc: Jiri Slaby <jirislaby@kernel.org> # tty/serial
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-12-17 10:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-07 17:46 [Bug runtime/30831] New: The do_each_thread macro has been removed from newest linux 6.6 kernels wcohen at redhat dot com
2023-09-07 19:23 ` [Bug runtime/30831] Systemtap scripts fail to compile on " wcohen at redhat dot com
2023-09-08  2:49 ` wcohen at redhat dot com
2023-09-18 13:46 ` wcohen at redhat dot com
2023-09-18 13:51 ` wcohen at redhat dot com
2023-09-27 14:24 ` wcohen at redhat dot com
2023-09-27 20:03 ` wcohen at redhat dot com
2023-11-23 15:16   ` Tetsuo Handa
2023-12-13 14:47     ` William Cohen
2023-12-17 10:41       ` Tetsuo Handa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).