• Darren Hart's avatar
    topology: make core_mask include at least cluster_siblings · db1e5948
    Darren Hart authored
    Ampere Altra defines CPU clusters in the ACPI PPTT. They share a Snoop
    Control Unit, but have no shared CPU-side last level cache.
    
    cpu_coregroup_mask() will return a cpumask with weight 1, while
    cpu_clustergroup_mask() will return a cpumask with weight 2.
    
    As a result, build_sched_domain() will BUG() once per CPU with:
    
    BUG: arch topology borken
    the CLS domain not a subset of the MC domain
    
    The MC level cpumask is then extended to that of the CLS child, and is
    later removed entirely as redundant. This sched domain topology is an
    improvement over previous topologies, or those built without
    SCHED_CLUSTER, particularly for certain latency sensitive workloads.
    With the current scheduler model and heuristics, this is a desirable
    default topology for Ampere Altra and Altra Max system.
    
    Rather than create a custom sched domains topology structure and
    introduce new logic in arch/arm64 to detect these systems, update the
    core_mask so coregroup is never a subset of clustergroup, extending it
    to cluster_siblings if necessary. Only do this if CONFIG_SCHED_CLUSTER
    is enabled to avoid also changing the topology (MC) when
    CONFIG_SCHED_CLUSTER is disabled.
    
    This has the added benefit over a custom topology of working for both
    symmetric and asymmetric topologies. It does not address systems where
    the CLUSTER topology is above a populated MC topology, but these are not
    considered today and can be addressed separately if and when they
    appear.
    
    The final sched domain topology for a 2 socket Ampere Altra system is
    unchanged with or without CONFIG_SCHED_CLUSTER, and the BUG is avoided:
    
    For CPU0:
    
    CONFIG_SCHED_CLUSTER=y
    CLS  [0-1]
    DIE  [0-79]
    NUMA [0-159]
    
    CONFIG_SCHED_CLUSTER is not set
    DIE  [0-79]
    NUMA [0-159]
    
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: "Rafael J. Wysocki" <rafael@kernel.org>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Will Deacon <will@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Vincent Guittot <vincent.guittot@linaro.org>
    Cc: D. Scott Phillips <scott@os.amperecomputing.com>
    Cc: Ilkka Koskinen <ilkka@os.amperecomputing.com>
    Cc: <stable@vger.kernel.org> # 5.16.x
    Suggested-by: default avatarBarry Song <song.bao.hua@hisilicon.com>
    Reviewed-by: default avatarBarry Song <song.bao.hua@hisilicon.com>
    Reviewed-by: default avatarDietmar Eggemann <dietmar.eggemann@arm.com>
    Acked-by: default avatarSudeep Holla <sudeep.holla@arm.com>
    Signed-off-by: default avatarDarren Hart <darren@os.amperecomputing.com>
    Link: https://lore.kernel.org/r/c8fe9fce7c86ed56b4c455b8c902982dc2303868.1649696956.git.darren@os.amperecomputing.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    db1e5948
arch_topology.c 19.3 KB