diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-02-21 11:36:45 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-02-21 11:48:45 -0500 |
commit | c7ef7645544131b0750478d1cf94cdfa945c809d (patch) | |
tree | 4442e415b365cd43be1d8a73703f809f78177560 /include/linux/edac.h | |
parent | 80cc7d87d5eb34375f916d282450a0906a8ead60 (diff) |
edac: reduce stack pressure by using a pre-allocated buffer
The number of variables at the stack is too big.
Reduces the stack usage by using a pre-allocated error
buffer.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/linux/edac.h')
-rw-r--r-- | include/linux/edac.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/include/linux/edac.h b/include/linux/edac.h index ff18efc754f3..096b7fcdf484 100644 --- a/include/linux/edac.h +++ b/include/linux/edac.h | |||
@@ -47,8 +47,18 @@ static inline void opstate_init(void) | |||
47 | return; | 47 | return; |
48 | } | 48 | } |
49 | 49 | ||
50 | /* Max length of a DIMM label*/ | ||
50 | #define EDAC_MC_LABEL_LEN 31 | 51 | #define EDAC_MC_LABEL_LEN 31 |
51 | 52 | ||
53 | /* Maximum size of the location string */ | ||
54 | #define LOCATION_SIZE 80 | ||
55 | |||
56 | /* Defines the maximum number of labels that can be reported */ | ||
57 | #define EDAC_MAX_LABELS 8 | ||
58 | |||
59 | /* String used to join two or more labels */ | ||
60 | #define OTHER_LABEL " or " | ||
61 | |||
52 | /** | 62 | /** |
53 | * enum dev_type - describe the type of memory DRAM chips used at the stick | 63 | * enum dev_type - describe the type of memory DRAM chips used at the stick |
54 | * @DEV_UNKNOWN: Can't be determined, or MC doesn't support detect it | 64 | * @DEV_UNKNOWN: Can't be determined, or MC doesn't support detect it |
@@ -553,6 +563,46 @@ struct errcount_attribute_data { | |||
553 | int layer0, layer1, layer2; | 563 | int layer0, layer1, layer2; |
554 | }; | 564 | }; |
555 | 565 | ||
566 | /** | ||
567 | * edac_raw_error_desc - Raw error report structure | ||
568 | * @grain: minimum granularity for an error report, in bytes | ||
569 | * @error_count: number of errors of the same type | ||
570 | * @top_layer: top layer of the error (layer[0]) | ||
571 | * @mid_layer: middle layer of the error (layer[1]) | ||
572 | * @low_layer: low layer of the error (layer[2]) | ||
573 | * @page_frame_number: page where the error happened | ||
574 | * @offset_in_page: page offset | ||
575 | * @syndrome: syndrome of the error (or 0 if unknown or if | ||
576 | * the syndrome is not applicable) | ||
577 | * @msg: error message | ||
578 | * @location: location of the error | ||
579 | * @label: label of the affected DIMM(s) | ||
580 | * @other_detail: other driver-specific detail about the error | ||
581 | * @enable_per_layer_report: if false, the error affects all layers | ||
582 | * (typically, a memory controller error) | ||
583 | */ | ||
584 | struct edac_raw_error_desc { | ||
585 | /* | ||
586 | * NOTE: everything before grain won't be cleaned by | ||
587 | * edac_raw_error_desc_clean() | ||
588 | */ | ||
589 | char location[LOCATION_SIZE]; | ||
590 | char label[(EDAC_MC_LABEL_LEN + 1 + sizeof(OTHER_LABEL)) * EDAC_MAX_LABELS]; | ||
591 | long grain; | ||
592 | |||
593 | /* the vars below and grain will be cleaned on every new error report */ | ||
594 | u16 error_count; | ||
595 | int top_layer; | ||
596 | int mid_layer; | ||
597 | int low_layer; | ||
598 | unsigned long page_frame_number; | ||
599 | unsigned long offset_in_page; | ||
600 | unsigned long syndrome; | ||
601 | const char *msg; | ||
602 | const char *other_detail; | ||
603 | bool enable_per_layer_report; | ||
604 | }; | ||
605 | |||
556 | /* MEMORY controller information structure | 606 | /* MEMORY controller information structure |
557 | */ | 607 | */ |
558 | struct mem_ctl_info { | 608 | struct mem_ctl_info { |
@@ -660,6 +710,12 @@ struct mem_ctl_info { | |||
660 | /* work struct for this MC */ | 710 | /* work struct for this MC */ |
661 | struct delayed_work work; | 711 | struct delayed_work work; |
662 | 712 | ||
713 | /* | ||
714 | * Used to report an error - by being at the global struct | ||
715 | * makes the memory allocated by the EDAC core | ||
716 | */ | ||
717 | struct edac_raw_error_desc error_desc; | ||
718 | |||
663 | /* the internal state of this controller instance */ | 719 | /* the internal state of this controller instance */ |
664 | int op_state; | 720 | int op_state; |
665 | 721 | ||