• Andi Kleen's avatar
    x86, mce: implement dynamic machine check banks support · 0d7482e3
    Andi Kleen authored
    Impact: cleanup; making code future proof; memory saving on small systems
    
    This patch replaces the hardcoded max number of machine check banks with 
    dynamic allocation depending on what the CPU reports. The sysfs
    data structures and the banks array are dynamically allocated.
    
    There is still a hard bank limit (128) because the mcelog protocol uses
    banks >= 128 as pseudo banks to escape other events. But we expect
    that 128 banks is beyond any reasonable CPU for now.
    
    This supersedes an earlier patch by Venki, but it solves the problem
    more completely by making the limit fully dynamic (up to the 128
    boundary).
    
    This saves some memory on machines with less than 6 banks because
    they won't need sysdevs for unused ones and also allows to 
    use sysfs to control these banks on possible future CPUs with
    more than 6 banks.
    
    This is an updated patch addressing Venki's comments.  I also added in
    another patch from Thomas which fixed the error allocation path (that
    patch was previously separated)
    
    Cc: Venki Pallipadi <venkatesh.pallipadi@intel.com>
    Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
    Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
    0d7482e3
mce_64.c 24.8 KB