RFC RAS daemon v3
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest20 patches 10 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/20 | perf: Start the massive restructuringkernel/ kernel/ kernel/ +1 more | +5904 | 0 replies | |
| 2/20 | perf: Add persistent event facilitiesinclude/ kernel/ kernel/ +1 more | +95 | 0 replies | |
| 3/20 | x86, mce: Add persistent MCE eventarch/ arch/ | +92 | 8 replies | |
| 4/20 | perf: Move trace-event-parse out of perf/util directorytools/ tools/ tools/ +3 more | +3582 | 0 replies | |
| 5/20 | perf: Update the lib parse-events to the latest codetools/ tools/ tools/ +13 more | +5648 | 0 replies | |
| 6/20 | perf: Move trace stuff into tools/lib/tracetools/ tools/ tools/ +15 more | +7923 | 0 replies | |
| 7/20 | perf: Export debugfs utilitiestools/ tools/ tools/ +62 more | +782 | 0 replies | |
| 8/20 | perf: Export cpumaptools/ tools/ tools/ +8 more | +166 | 0 replies | |
| 9/20 | perf: Carve out mmap helpers for general usetools/ tools/ tools/ +4 more | +166 | 0 replies | |
| 10/20 | perf: Export util.ch into librarytools/ tools/ tools/ +6 more | +128 | 0 replies | |
| 11/20 | perf: Move rbtree to librarytools/ tools/ tools/ +15 more | +20 | 0 replies | |
| 12/20 | perf: Export generic kernel utils to librarytools/ tools/ tools/ +20 more | +247 | 0 replies | |
| 13/20 | perf: Export compiler.h to the generic librarytools/ tools/ tools/ +4 more | +16 | 0 replies | |
| 14/20 | perf: Export color.ch and config.chtools/ tools/ tools/ +30 more | +1110 | 0 replies | |
| 15/20 | perf: Export strlist.chtools/ tools/ tools/ +12 more | +290 | 0 replies | |
| 16/20 | perf: Export map.ch and symbol.chtools/ tools/ tools/ +45 more | +3656 | 0 replies | |
| 17/20 | perf: Export trace parsing utilstools/ tools/ tools/ +26 more | +1574 | 0 replies | |
| 18/20 | Move string.c to the librarytools/ tools/ tools/ +3 more | +299 | 0 replies | |
| 19/20 | perf, trace: Export event parsing helperstools/ tools/ tools/ +1 more | +18 | 0 replies | |
| 20/20 | ras: Add RAS daemontools/ tools/ tools/ | +325 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [RFC PATCH 00/20] RAS daemon v3
From: Borislav Petkov <[email protected]>
Hi all,
I finally had some time to work on this thing again. This time it can parse the MCE tracepoint and should be conceptually almost done. What needs to be done now is fleshing out a bunch of details here and there. I'm sending it early so that I can collect some more feedback.
So the patchset is ontop of 2.6.36 + Steven's trace_cmd restructuring set from
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git tip/perf/parse-events
I'm adding his patches too here, for completeness (although they need some more work).
I've also cherry-picked the bunch of EDAC's MCE injection stuff for testing.
So, in the end of the day, if you do
echo 0x9c00410000010016 > /sys/devices/system/edac/mce/status
(0x9c.. is the MCE signature of a data cache L2 TLB multimatch, for example)
echo 0 > /sys/devices/system/edac/mce/bank
(0 means bank 0, i.e. data cache errors)
after having loaded the mce_amd_inj injection testing module, the RAS daemon get's the status signature in userspace:
...
DBG main: Read some mmapped data
DBG main: MCE status: 0x9c00410000010016
All of the remaining fields can be postprocessed in arbitrary manner after that. The MCE decoding in the kernel can then be simplified by sharing it with the daemon, if needed. But that's another story.
To the patches, individually:
#1. Start splitting perf_event.c as we talked last time. The remaining units could be carved out from there based on functionality.
#2. persistent events registration
#3. ... and their first user.
#4,5: Steven's stuff. Btw, Steven, feel free to pick up any of the later patches if it makes your life easier, like #6 for example.
#6: could go with the above
#7-#19: Export all the shared stuff to the different libraries. I've splitted them to as small units as possible for easier review.
#20: Adds the daemon. Still full of debugging code since work-in-progress.
Also, in order to make this work, I needed the following hunk:
drivers/edac/mce_amd.c +3 -0
@@ -1,4 +1,5 @@#include <linux/module.h> +#include <trace/events/mce.h> #include "mce_amd.h" static bool report_gart_errors;
@@ -376,6 +377,8 @@ int amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data)amd_decode_err_code (m->status &0xffff ); +trace_mce_record (m); +return NOTIFY_STOP ;
This is needed just for testing the code by easily injecting MCEs as described above.
kernel/events/core.c +3 -1
@@ -2682,7 +2682,9 @@ static void perf_mmap_close(struct vm_area_struct *vma)struct user_struct *user = event->mmap_user;struct perf_buffer *buffer = event->buffer; -atomic_long_sub ((size >>PAGE_SHIFT ) +1 , &user->locked_vm); +if (user) +atomic_long_sub ((size >>PAGE_SHIFT ) +1 , &user->locked_vm); +
event->mmap_user doesn't get initialized in perf_mmap() since we have preallocated buffers and exit early. Which means that perf has to know about persistent events somehow or PeterZ has a better idea...
@@ -2719,8 +2721,10 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
if (event->cpu == -1 && event->attr.inherit)
return -EINVAL;
+#if 0
if (!(vma->vm_flags & VM_SHARED))
return -EINVAL;
+#endif
Obviously, when mmaping the persistent buffers over debugfs, our vma is not shared. Uncommented for now until a figure out a sensible solution.
tools/lib/perf/mmap.c +4 -1
@@ -13,6 +13,7 @@ unsigned long mmap_read_head(struct mmap_data *md)return head; } +#if 0 static void mmap_write_tail (struct mmap_data *md,unsigned long tail) {struct perf_event_mmap_page *pc = md->base;
@@ -23,6 +24,7 @@ static void mmap_write_tail(struct mmap_data *md, unsigned long tail)/* mb(); */ pc->data_tail = tail; } +#endif static unsigned long mmap_read (struct mmap_data *md,void (*write_output)(void *,size_t ))
@@ -70,12 +72,13 @@ static unsigned long mmap_read(struct mmap_data *md, buf = &data[old & md->mask]; size = head - old; + old += size;write_output (buf, size); md->prev = old; -mmap_write_tail (md, old); +/* mmap_write_tail(md, old); */ return samples; }
This has to do with the previous change because mmap_write_tail() tries to write to RO mapping and there we segfault.
So anyway, here it is, it is still work in progress. Please take a look and let me know.
Thanks.