• Daniel Lezcano's avatar
    thermal/debugfs: Add thermal cooling device debugfs information · 755113d7
    Daniel Lezcano authored
    The thermal framework does not have any debug information except a
    sysfs stat which is a bit controversial. This one allocates big chunks
    of memory for every cooling devices with a high number of states and
    could represent on some systems in production several megabytes of
    memory for just a portion of it. As the sysfs is limited to a page
    size, the output is not exploitable with large data array and gets
    truncated.
    
    The patch provides the same information than sysfs except the
    transitions are dynamically allocated, thus they won't show more
    events than the ones which actually occurred. There is no longer a
    size limitation and it opens the field for more debugging information
    where the debugfs is designed for, not sysfs.
    
    The thermal debugfs directory structure tries to stay consistent with
    the sysfs one but in a very simplified way:
    
    thermal/
     -- cooling_devices
        |-- 0
        |   |-- clear
        |   |-- time_in_state_ms
        |   |-- total_trans
        |   `-- trans_table
        |-- 1
        |   |-- clear
        |   |-- time_in_state_ms
        |   |-- total_trans
        |   `-- trans_table
        |-- 2
        |   |-- clear
        |   |-- time_in_state_ms
        |   |-- total_trans
        |   `-- trans_table
        |-- 3
        |   |-- clear
        |   |-- time_in_state_ms
        |   |-- total_trans
        |   `-- trans_table
        `-- 4
            |-- clear
            |-- time_in_state_ms
            |-- total_trans
            `-- trans_table
    
    The content of the files in the cooling devices directory is the same
    as the sysfs one except for the trans_table which has the following
    format:
    
    Transition	Hits
    1->0      	246
    0->1      	246
    2->1      	632
    1->2      	632
    3->2      	98
    2->3      	98
    Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
    [ rjw: White space fixups, rebase ]
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    755113d7
Kconfig 16.6 KB