Posts
22
Following
22
Followers
27
Kernel livepatching, beer, squash
@mpdesouza cool, thanks for taking a look. Feel free to ask any questions about the concept or the repo. I don't normally organize patchsets in this fashion, but it's been a lot of work to build and test for so many arches. (Also the kernel selftest infra is not really designed to verify build failures.).
1
0
0
@mpdesouza Hi, yea that v7 is in progress for a while. If you are working on selftest reorg, don't hesitate to post your work first. The klp-convert patchset isn't in any hurry and I can rebase accordingly.
1
0
0

TIL: gcc’s -H flag to untangle header files

While backporting upstream patches to an older distro kernel:

  f6ac18fafcf6 sched: Improve try_invoke_on_locked_down_task()
  9b3c4ab3045e sched,rcu: Rework try_invoke_on_locked_down_task()
  00619f7c650e sched,livepatch: Use task_call_func()
  8850cb663b5c sched: Simplify wake_up_*idle*()
  5de62ea84abd sched,livepatch: Use wake_up_if_idle()

I ran into compilation error:

  kernel/livepatch/transition.c:434:33: error: implicit declaration of function ‘wake_up_if_idle’

A closer look at the upstream commits shows (“sched,livepatch: Use task_call_func()”) removed “../sched/sched.h” from kernel/livepatch/transition.c. wake_up_if_idle() is defined in include/linux/sched/idle.h so there is probably a connection – but how does this even build upstream and how to untangle the rat’s nest of kernel includes?

Enter gcc and the -H flag.

I rebuilt the upstream kernel kernel/livepatch/transition.o with V=1 and snarfed its gcc compilation line. Pasted into the terminal, added -H, and gcc generates a long header file stack. The header of interest was six includes deep:

  . ./include/linux/cpu.h
  .. ./include/linux/node.h
  ... ./include/linux/device.h
  .... ./include/linux/energy_model.h
  ..... ./include/linux/sched/topology.h
  ...... ./include/linux/sched/idle.h

Moving back to my distro kernel, its device.h did not include energy_model.h (introduced upstream by 1bc138c62295 (“PM / EM: add support for other devices than CPUs in Energy Model”).

Mystery solved and a new trick to remember for a future problem.

0
5
6
@rostedt the emacs pedal would would look something like
1
1
2
A brisk disc session between meetings.
0
0
0
@monsieuricon Sounds like the kinda code I write and then double check with "shit show" instead of "git show" before pushing.
0
0
0

Had to verify. And yes. Kernighan and Ritchie really did this. TIL :)

0
3
0
Hi @mpdesouza I just joined (seems like a good time to jump off the bird app), not sure what I'll post, but will at least lurk on #kernel posts.
0
0
0
Obligatory #introduction: linux kernel livepatch for Red Hat kpatch by day, squash player and Philly sports fan by night. Reverb > distortion, pilsner > IPA, and other opinions.
0
1
6
Show older