• Qian Cai's avatar
    x86/resctrl: Fix an imbalance in domain_remove_cpu() · e278af89
    Qian Cai authored
    A system that supports resource monitoring may have multiple resources
    while not all of these resources are capable of monitoring. Monitoring
    related state is initialized only for resources that are capable of
    monitoring and correspondingly this state should subsequently only be
    removed from these resources that are capable of monitoring.
    
    domain_add_cpu() calls domain_setup_mon_state() only when r->mon_capable
    is true where it will initialize d->mbm_over. However,
    domain_remove_cpu() calls cancel_delayed_work(&d->mbm_over) without
    checking r->mon_capable resulting in an attempt to cancel d->mbm_over on
    all resources, even those that never initialized d->mbm_over because
    they are not capable of monitoring. Hence, it triggers a debugobjects
    warning when offlining CPUs because those timer debugobjects are never
    initialized:
    
      ODEBUG: assert_init not available (active state 0) object type:
      timer_list hint: 0x0
      WARNING: CPU: 143 PID: 789 at lib/debugobjects.c:484
      debug_print_object
      Hardware name: HP Synergy 680 Gen9/Synergy 680 Gen9 Compute Module, BIOS I40 05/23/2018
      RIP: 0010:debug_print_object
      Call Trace:
      debug_object_assert_init
      del_timer
      try_to_grab_pending
      cancel_delayed_work
      resctrl_offline_cpu
      cpuhp_invoke_callback
      cpuhp_thread_fun
      smpboot_thread_fn
      kthread
      ret_from_fork
    
    Fixes: e3302683 ("x86/intel_rdt/mbm: Handle counter overflow")
    Signed-off-by: default avatarQian Cai <cai@lca.pw>
    Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
    Acked-by: default avatarReinette Chatre <reinette.chatre@intel.com>
    Cc: Fenghua Yu <fenghua.yu@intel.com>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: john.stultz@linaro.org
    Cc: sboyd@kernel.org
    Cc: <stable@vger.kernel.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: tj@kernel.org
    Cc: Tony Luck <tony.luck@intel.com>
    Cc: Vikas Shivappa <vikas.shivappa@linux.intel.com>
    Cc: x86-ml <x86@kernel.org>
    Link: https://lkml.kernel.org/r/20191211033042.2188-1-cai@lca.pw
    e278af89
core.c 23.9 KB