Skip to contentSkip to conversation

tracing: Remove useless 4 bytes of padding from every event

RFC PATCH Superseded Steven Rostedt 5 participants 16 messages May 16, 2012 – May 17, 2012

Subsystems (2)
lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

RFC PATCH 1/1 tracing: Remove useless 4 bytes of padding from every event

Now that PowerTop v2 is out, which uses the parse-event library, it no longer is broken by the removal of the lock-depth field from every event. Currently we add 4 bytes of empty space to every event. If we have 1 million events, 4 million bytes are wasted in the ring buffers (for both ftrace and perf).

But this change will break PowerTop v1. Thus my question is, how long do we need to keep this wasted space in the ring buffers to satisfy an out of date tool?

include/linux/ftrace_event.h +0 -1
index 5f3f3be..f96dfef 100644
@@ -49,7 +49,6 @@ struct trace_entry {
 	unsigned char		flags;
 	unsigned char		preempt_count;
 	int			pid;
-	int			padding;
 };
 
 #define FTRACE_MAX_EVENT						\
author maintainer
#1 lore raw

RFC PATCH v2 1/1 tracing: Remove useless 4 bytes of padding from every event

Quoted 10 lines · Steven Rostedt

Now that PowerTop v2 is out, which uses the parse-event library, it no longer is broken by the removal of the lock-depth field from every event. Currently we add 4 bytes of empty space to every event. If we have 1 million events, 4 million bytes are wasted in the ring buffers (for both ftrace and perf).

But this change will break PowerTop v1. Thus my question is, how long do we need to keep this wasted space in the ring buffers to satisfy an out of date tool?

Would help if I compiled it :-)

include/linux/ftrace_event.h +0 -1
index 5f3f3be..f96dfef 100644
@@ -49,7 +49,6 @@ struct trace_entry {
 	unsigned char		flags;
 	unsigned char		preempt_count;
 	int			pid;
-	int			padding;
 };
 
 #define FTRACE_MAX_EVENT						\
kernel/trace/trace.c +0 -1
index 08a08ba..0960aa7 100644
@@ -1145,7 +1145,6 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags,
 
 	entry->preempt_count		= pc & 0xff;
 	entry->pid			= (tsk) ? tsk->pid : 0;
-	entry->padding			= 0;
 	entry->flags =
 #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
 		(irqs_disabled_flags(flags) ? TRACE_FLAG_IRQS_OFF : 0) |
kernel/trace/trace_events.c +0 -1
index 079a93a..5845731 100644
@@ -116,7 +116,6 @@ static int trace_define_common_fields(void)
 	__common_field(unsigned char, flags);
 	__common_field(unsigned char, preempt_count);
 	__common_field(int, pid);
-	__common_field(int, padding);
 
 	return ret;
 }
#2 lore raw
In reply to Steven Rostedt
Quoted 4 lines · Steven Rostedt

But this change will break PowerTop v1. Thus my question is, how long do we need to keep this wasted space in the ring buffers to satisfy an out of date tool?

The wasted space seems of limited importance.

More important is to check which distros have the new powertop.

F16 and F17 seem to have powertop-1.98, which I assume is the new world order already. But maybe I assume incorrectly.

F14 (which I personally still use, since it doesn't have gnome3) is 1.13.

SuSE, Ubuntu?

Linus

#3 lore raw
Quoted 6 lines · Linus Torvalds
Quoted 4 lines · Steven Rostedt

But this change will break PowerTop v1. Thus my question is, how long do we need to keep this wasted space in the ring buffers to satisfy an out of date tool?

Quoted 6 lines

The wasted space seems of limited importance.

More important is to check which distros have the new powertop.

F16 and F17 seem to have powertop-1.98, which I assume is the new world order already. But maybe I assume incorrectly.

this is the one that will break

Quoted 2 lines

F14 (which I personally still use, since it doesn't have gnome3) is 1.13.

this one is fine, it does not use perf events at all.

author maintainer
#4 lore raw

[ Fixes David Sharps email. I have two versions, and picked the broken
one :-p ]

Quoted 8 lines · Arjan van de Ven
Quoted 7 lines · Linus Torvalds
Quoted 4 lines · Steven Rostedt

But this change will break PowerTop v1. Thus my question is, how long do we need to keep this wasted space in the ring buffers to satisfy an out of date tool?

The wasted space seems of limited importance.

Depends on who you ask. For you, it's probably of no importance. For someone trying to get as many events as possible, it's of much greater importance. Lack of events in a report is one of the biggest issues we have. Especially for those that are trying to debug an issue and needs as much info as possible. (function tracing sucks up a hell of a lot)

But that said, it doesn't go against what you stated. "limited importance". Its importance is limited to a group of people.

Quoted 7 lines
Quoted 5 lines

More important is to check which distros have the new powertop.

F16 and F17 seem to have powertop-1.98, which I assume is the new world order already. But maybe I assume incorrectly.

this is the one that will break

Shh ;-)

Quoted 5 lines
Quoted 3 lines

F14 (which I personally still use, since it doesn't have gnome3) is 1.13.

this one is fine, it does not use perf events at all.

Oo oo! We can change it and Linus won't know.

-- Steve

#5 lore raw
In reply to Arjan van de Ven
Quoted 2 lines · Arjan van de Ven

this is the one that will break

Oh, ok. So we need to wait at *least* for F16/F17 to upgrade. I assume that SuSE/Ubuntu are in the same boat.

Quoted 3 lines
Quoted 1 line

F14 (which I personally still use, since it doesn't have gnome3) is 1.13.

this one is fine, it does not use perf events at all.

Ok. Sadly, my actual laptop (which is where I've used it) runs F17 these days, since F14 can't handle the SNB graphics. So I'd actually notice.

Steven is foiled again.

Linus

author maintainer
#8 lore raw
In reply to Linus Torvalds
Quoted 2 lines · Linus Torvalds

F16 and F17 seem to have powertop-1.98, which I assume is the new world order already. But maybe I assume incorrectly.

Seriously though. What's your take on changing the kernel that will break an older distro. Obviously, this change is too early to apply. But because an old distro has one app that will break if we make a change in the kernel, is that enough to keep that change out?

Lets say we are at F23, and F18+ have the new powertop tools. Lets even go to say that F16 and F17 have updated their powertop to powertop v2.

Because someone may be running a F17 without updates, which has powertop that will break if they update their kernel, rational to keeping that change out?

I want to know if this change will ever go in. Otherwise, I have to make workarounds for it. I have no problem with that, as I will be adding workarounds anyway, but this will continue to punish the tools that use the non-workaround methods even though they don't break with the change.

Now if you say that it's OK to break and old distro if the affected tools in the new distros work. What's the timeframe of that? One year?

-- Steve

author maintainer
#6 lore raw
In reply to Linus Torvalds
Quoted 7 lines · Linus Torvalds
Quoted 2 lines · Arjan van de Ven

this is the one that will break

Oh, ok. So we need to wait at *least* for F16/F17 to upgrade. I assume that SuSE/Ubuntu are in the same boat.

Ah, so you just answered the email I sent while you sent this one. You must be psychic.

Quoted 10 lines
Quoted 4 lines
Quoted 2 lines

F14 (which I personally still use, since it doesn't have gnome3) is 1.13.

this one is fine, it does not use perf events at all.

Ok. Sadly, my actual laptop (which is where I've used it) runs F17 these days, since F14 can't handle the SNB graphics. So I'd actually notice.

Steven is foiled again.

/me curses! That damn rascal Linus!

#9 lore raw
In reply to Steven Rostedt
Quoted 5 lines · Steven Rostedt

Seriously though. What's your take on changing the kernel that will break an older distro. Obviously, this change is too early to apply. But because an old distro has one app that will break if we make a change in the kernel, is that enough to keep that change out?

I suspect that powertop is enough of a developer thing that if that's the only thing that breaks, we don't have to worry too much.

I don't want to break *everybody*, so new distro's should be up-to-date. But breaking something like a F14-15 timeframe distro or something staid like a SLES (or "Debian Stale" or whatever they call that thing that only takes crazy-old binaries)? It's fine. We don't want to *rush* into it, but no, if those distros are basically not updating, we can't care about them forever for something like powertop.

Things that break *normal* applications are different. There the rule really must be "never".

Linus

#10 lore raw
Quoted 10 lines · Linus Torvalds
Quoted 5 lines · Steven Rostedt

Seriously though. What's your take on changing the kernel that will break an older distro. Obviously, this change is too early to apply. But because an old distro has one app that will break if we make a change in the kernel, is that enough to keep that change out?

I suspect that powertop is enough of a developer thing that if that's the only thing that breaks, we don't have to worry too much.

Quoted 7 lines

I don't want to break *everybody*, so new distro's should be up-to-date. But breaking something like a F14-15 timeframe distro or something staid like a SLES (or "Debian Stale" or whatever they call that thing that only takes crazy-old binaries)? It's fine. We don't want to *rush* into it, but no, if those distros are basically not updating, we can't care about them forever for something like powertop.

agreed.

I would say something like "6 months" (e.g. 3.6); anybody who's likely to update anything will have done the powertop upgrade from his distro by then, and anybody who isn't isn't going to update the kernel either.

author maintainer
#11 lore raw
Quoted 19 lines · Arjan van de Ven
Quoted 10 lines · Linus Torvalds
Quoted 5 lines · Steven Rostedt

Seriously though. What's your take on changing the kernel that will break an older distro. Obviously, this change is too early to apply. But because an old distro has one app that will break if we make a change in the kernel, is that enough to keep that change out?

I suspect that powertop is enough of a developer thing that if that's the only thing that breaks, we don't have to worry too much.

Quoted 7 lines

I don't want to break *everybody*, so new distro's should be up-to-date. But breaking something like a F14-15 timeframe distro or something staid like a SLES (or "Debian Stale" or whatever they call that thing that only takes crazy-old binaries)? It's fine. We don't want to *rush* into it, but no, if those distros are basically not updating, we can't care about them forever for something like powertop.

Quoted 6 lines

agreed.

I would say something like "6 months" (e.g. 3.6); anybody who's likely to update anything will have done the powertop upgrade from his distro by then, and anybody who isn't isn't going to update the kernel either.

Thanks for the clarification. I'll put the patch in my 3.6 or 3.7 queue.

-- Steve

#12 lore raw
In reply to Arjan van de Ven
Quoted 19 lines · Arjan van de Ven
Quoted 10 lines · Linus Torvalds
Quoted 5 lines · Steven Rostedt

Seriously though. What's your take on changing the kernel that will break an older distro. Obviously, this change is too early to apply. But because an old distro has one app that will break if we make a change in the kernel, is that enough to keep that change out?

I suspect that powertop is enough of a developer thing that if that's the only thing that breaks, we don't have to worry too much.

Quoted 7 lines

I don't want to break *everybody*, so new distro's should be up-to-date. But breaking something like a F14-15 timeframe distro or something staid like a SLES (or "Debian Stale" or whatever they call that thing that only takes crazy-old binaries)? It's fine. We don't want to *rush* into it, but no, if those distros are basically not updating, we can't care about them forever for something like powertop.

Quoted 5 lines

agreed.

I would say something like "6 months" (e.g. 3.6); anybody who's likely to update anything will have done the powertop upgrade from his distro by then, and anybody who isn't isn't going to update the kernel either.

One possibility would be a config symbol to enable the deprecated field (kind of like what we did with compat vdso). Distros that have a new enough powertop can then disable it.

Dave

#13 lore raw
Quoted 22 lines · Dave Jones
Quoted 21 lines · Arjan van de Ven
Quoted 10 lines · Linus Torvalds
Quoted 5 lines · Steven Rostedt

Seriously though. What's your take on changing the kernel that will break an older distro. Obviously, this change is too early to apply. But because an old distro has one app that will break if we make a change in the kernel, is that enough to keep that change out?

I suspect that powertop is enough of a developer thing that if that's the only thing that breaks, we don't have to worry too much.

Quoted 7 lines

I don't want to break *everybody*, so new distro's should be up-to-date. But breaking something like a F14-15 timeframe distro or something staid like a SLES (or "Debian Stale" or whatever they call that thing that only takes crazy-old binaries)? It's fine. We don't want to *rush* into it, but no, if those distros are basically not updating, we can't care about them forever for something like powertop.

agreed.

Quoted 7 lines
Quoted 3 lines

I would say something like "6 months" (e.g. 3.6); anybody who's likely to update anything will have done the powertop upgrade from his distro by then, and anybody who isn't isn't going to update the kernel either.

One possibility would be a config symbol to enable the deprecated field (kind of like what we did with compat vdso). Distros that have a new enough powertop can then disable it.

this isn't really about distro kernels; a distro that pushes a 3.7 kernel to Fedora 15 might as well do a powertop upgrade.. the later is much simpler and lighter (the main difference between 1.98 and 2.0 is the use of the perfevent library anyway)

it's about people who compile their own upstream kernel...

#7 lore raw
In reply to Steven Rostedt
Quoted 7 lines · Steven Rostedt
Quoted 5 lines

Ok. Sadly, my actual laptop (which is where I've used it) runs F17 these days, since F14 can't handle the SNB graphics. So I'd actually notice.

Steven is foiled again.

/me curses! That damn rascal Linus!

Binary compatibility's a bitch!

But yeah, since this is instrumentation, the rules are somewhat relaxed to current widespread installations of tools, because few people are running old tools on old kernels to produce new code against new kernels, right?

Thanks,

Ingo

#14 lore raw
In reply to Arjan van de Ven
Quoted 5 lines · Arjan van de Ven
Quoted 4 lines

One possibility would be a config symbol to enable the deprecated field (kind of like what we did with compat vdso). Distros that have a new enough powertop can then disable it.

Quoted 7 lines

this isn't really about distro kernels; a distro that pushes a 3.7 kernel to Fedora 15 might as well do a powertop upgrade.. the later is much simpler and lighter (the main difference between 1.98 and 2.0 is the use of the perfevent library anyway)

it's about people who compile their own upstream kernel...

Nor should we waste too much time over these 4 bytes really. Is the kernel really in such a good shape that we must spend our time trying to break working apps, over a mostly cosmetic detail in an ABI which will soon be messed up with our next set up mistakes anyway? ;-)

Thanks,

Ingo

author maintainer
#15 lore raw
Quoted 6 lines · Ingo Molnar

Nor should we waste too much time over these 4 bytes really. Is the kernel really in such a good shape that we must spend our time trying to break working apps, over a mostly cosmetic detail in an ABI which will soon be messed up with our next set up mistakes anyway? ;-)

4 bytes is not cosmetic for a 32 byte event. That's 1/8th overhead. If we could get rid of 4 bytes from struct page, would we do that? It's only just 4 bytes for ever 4096 bytes. Just a 1/1024 overhead. Of course perf events are much bigger than 32 bytes. It's one of the biggest complaints I hear about perf, the size of its events. We should be trying hard to fix that.

And we are not spending time trying to break tools. The tools were already broken. The main motivator for getting parse-events into powertop was that the older version (due to this binary interface) could not be used on a system running a 32bit userspace on a 64bit kernel.

With the proper parsing, it not only was able to run on a 32/64 environment, it can also parse the events like perf does and not need direct padding of space.

-- Steve