The WARN_ON in the ring buffer when a commit is preempted and the buffer is filled by preceding writes can happen in normal operations. The WARN_ON makes it look like a bug, not to mention, because it does not stop tracing and calls printk which can also recurse, this is prone to deadlock (the WARN_ON is not in a position to recurse). This patch removes the WARN_ON and replaces it with a counter that can be retrieved by a tracer. This counter is called commit_overrun. While at it, I added a nmi_dropped counter to count any time an NMI entry is dropped because the NMI could not take the spinlock. [ Impact: prevent deadlock by printing normal case warning ]
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -153,6 +153,8 @@ unsigned long ring_buffer_entries(struct ring_buffer *buffer); · 152 unmodified lines | |||
| 153 | unsigned long ring_buffer_overruns(struct ring_buffer *buffer); | 153 | unsigned long ring_buffer_overruns(struct ring_buffer *buffer); |
| 154 | unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu); | 154 | unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu); |
| 155 | unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu); | 155 | unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu); |
| 156 | unsigned long ring_buffer_commit_overrun_cpu(struct ring_buffer *buffer, int cpu); | ||
| 157 | unsigned long ring_buffer_nmi_dropped_cpu(struct ring_buffer *buffer, int cpu); | ||
| 156 | 158 | ||
| 157 | u64 ring_buffer_time_stamp(struct ring_buffer *buffer, int cpu); | 159 | u64 ring_buffer_time_stamp(struct ring_buffer *buffer, int cpu); |
| 158 | void ring_buffer_normalize_time_stamp(struct ring_buffer *buffer, | 160 | void ring_buffer_normalize_time_stamp(struct ring_buffer *buffer, |