Commit 38ced28b21efff18fd5e5c98a92830e8f0031cee
1 parent
69154d0698
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
edac: allow specifying the error count with fake_inject
In order to test if the error counters are properly incremented, add a way to specify how many errors were generated by a trace. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Showing 2 changed files with 14 additions and 2 deletions Side-by-side Diff
drivers/edac/edac_mc_sysfs.c
... | ... | @@ -812,18 +812,24 @@ |
812 | 812 | struct device *dev = file->private_data; |
813 | 813 | struct mem_ctl_info *mci = to_mci(dev); |
814 | 814 | static enum hw_event_mc_err_type type; |
815 | + u16 errcount = mci->fake_inject_count; | |
815 | 816 | |
817 | + if (!errcount) | |
818 | + errcount = 1; | |
819 | + | |
816 | 820 | type = mci->fake_inject_ue ? HW_EVENT_ERR_UNCORRECTED |
817 | 821 | : HW_EVENT_ERR_CORRECTED; |
818 | 822 | |
819 | 823 | printk(KERN_DEBUG |
820 | - "Generating a %s fake error to %d.%d.%d to test core handling. NOTE: this won't test the driver-specific decoding logic.\n", | |
824 | + "Generating %d %s fake error%s to %d.%d.%d to test core handling. NOTE: this won't test the driver-specific decoding logic.\n", | |
825 | + errcount, | |
821 | 826 | (type == HW_EVENT_ERR_UNCORRECTED) ? "UE" : "CE", |
827 | + errcount > 1 ? "s" : "", | |
822 | 828 | mci->fake_inject_layer[0], |
823 | 829 | mci->fake_inject_layer[1], |
824 | 830 | mci->fake_inject_layer[2] |
825 | 831 | ); |
826 | - edac_mc_handle_error(type, mci, 1, 0, 0, 0, | |
832 | + edac_mc_handle_error(type, mci, errcount, 0, 0, 0, | |
827 | 833 | mci->fake_inject_layer[0], |
828 | 834 | mci->fake_inject_layer[1], |
829 | 835 | mci->fake_inject_layer[2], |
... | ... | @@ -941,6 +947,11 @@ |
941 | 947 | |
942 | 948 | d = debugfs_create_bool("fake_inject_ue", S_IRUGO | S_IWUSR, parent, |
943 | 949 | &mci->fake_inject_ue); |
950 | + if (!d) | |
951 | + goto nomem; | |
952 | + | |
953 | + d = debugfs_create_u16("fake_inject_count", S_IRUGO | S_IWUSR, parent, | |
954 | + &mci->fake_inject_count); | |
944 | 955 | if (!d) |
945 | 956 | goto nomem; |
946 | 957 |