• Sebastian Andrzej Siewior's avatar
    drm/amd/display: Simplify the per-CPU usage. · de5e73dc
    Sebastian Andrzej Siewior authored
    The fpu_recursion_depth counter is used to ensure that dc_fpu_begin()
    can be invoked multiple times while the FPU-disable function itself is
    only invoked once. Also the counter part (dc_fpu_end()) is ballanced
    properly.
    
    Instead of using the get_cpu_ptr() dance around the inc it is simpler to
    increment the per-CPU variable directly. Also the per-CPU variable has
    to be incremented and decremented on the same CPU. This is ensured by
    the inner-part which disables preemption. This is kind of not obvious,
    works and the preempt-counter is touched a few times for no reason.
    
    Disable preemption before incrementing fpu_recursion_depth for the first
    time. Keep preemption disabled until dc_fpu_end() where the counter is
    decremented making it obvious that the preemption has to stay disabled
    while the counter is non-zero.
    Use simple inc/dec functions.
    Remove the nested preempt_disable/enable functions which are now not
    needed.
    Acked-by: default avatarHarry Wentland <harry.wentland@amd.com>
    Reviewed-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
    Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: default avatarHamza Mahfooz <hamza.mahfooz@amd.com>
    Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    de5e73dc
dc_fpu.c 4.42 KB