549f1f Introduce a function to get reserved memory size

Authored and Committed by Lichen Liu a year ago
    Introduce a function to get reserved memory size
    
    Resolves: bz2232499
    Upstream: Fedora Rawhide
    Conflict: None
    
    commit 4b7b7736eef8c682a8af07081d7f06eeb774172f
    Author: Sourabh Jain <sourabhjain@linux.ibm.com>
    Date:   Wed Aug 2 20:36:48 2023 +0530
    
        Introduce a function to get reserved memory size
    
        The size of the reserved memory in the functions show_reserved_mem,
        check_crash_mem_reserved, and do_estimate are fetched from the sysfs
        node `/sys/kernel/kexec_crash_size`. However, in the case of fadump,
        the reserved area size is instead present in
        /sys/kernel/fadump/mem_reserved.
    
        For example:
    
        $ kdumpctl showmem
        kdump: Dump mode is fadump
        kdump: Reserved 0MB memory for crash kernel
    
        The above command showed 0MB for Reserved memory which is incorrect, the
        actual reservation was 2048MB.
    
        To resolve this issue a new helper function is introduced to fetch
        reserved memory size based on the dump mode. For "fadump" mode,
        it looks in `/sys/kernel/fadump/mem_reserved`, otherwise, it uses
        `/sys/kernel/kexec_crash_size`. And all functions that previously
        fetching reserved memory directly from `/sys/kernel/kexec_crash_size`
        sysfs node are now updated to use this new function to get the reserved
        memory size.
    
        With the fix in place, the `kdumpctl showmem` command will now display
        correct reserved memory size.
    
        $ kdumpctl showmem
        kdump: Dump mode is fadump
        kdump: Reserved 2048MB memory for crash kernel
    
        Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
        Reported-by: Sachin P Bappalige <sachinpb@linux.vnet.ibm.com>
        Reviewed-by: Coiby Xu <coxu@redhat.com>
    
    Signed-off-by: Lichen Liu <lichliu@redhat.com>
    
        
file modified
+14 -1
file modified
+2 -2