lkml.org 
[lkml]   [2022]   [Aug]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH v3 06/10] x86/resctrl: Introduce mon_configurable to detect Bandwidth Monitoring Event Configuration
    From
    Date
    Newer AMD processors support the new feature Bandwidth Monitoring Event
    Configuration (BMEC). The events mbm_total_bytes and mbm_local_bytes
    are configurable when this feature is present.

    Set mon_configurable if the feature is available.

    Signed-off-by: Babu Moger <babu.moger@amd.com>
    Reviewed-by: Ingo Molnar <mingo@kernel.org>
    ---
    arch/x86/kernel/cpu/resctrl/monitor.c | 14 ++++++++++++++
    arch/x86/kernel/cpu/resctrl/rdtgroup.c | 17 +++++++++++++++++
    include/linux/resctrl.h | 1 +
    3 files changed, 32 insertions(+)

    diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
    index eaf25a234ff5..b9de417dac1c 100644
    --- a/arch/x86/kernel/cpu/resctrl/monitor.c
    +++ b/arch/x86/kernel/cpu/resctrl/monitor.c
    @@ -682,6 +682,16 @@ static void l3_mon_evt_init(struct rdt_resource *r)
    list_add_tail(&mbm_local_event.list, &r->evt_list);
    }

    +
    +void __rdt_get_mon_l3_config_amd(struct rdt_resource *r)
    +{
    + /*
    + * Check if CPU supports the Bandwidth Monitoring Event Configuration
    + */
    + if (boot_cpu_has(X86_FEATURE_BMEC))
    + r->mon_configurable = true;
    +}
    +
    int rdt_get_mon_l3_config(struct rdt_resource *r)
    {
    unsigned int mbm_offset = boot_cpu_data.x86_cache_mbm_width_offset;
    @@ -714,6 +724,10 @@ int rdt_get_mon_l3_config(struct rdt_resource *r)
    if (ret)
    return ret;

    + if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
    + __rdt_get_mon_l3_config_amd(r);
    +
    +
    l3_mon_evt_init(r);

    r->mon_capable = true;
    diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
    index fc5286067201..855483b297a8 100644
    --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
    +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
    @@ -995,6 +995,16 @@ static int rdt_num_rmids_show(struct kernfs_open_file *of,
    return 0;
    }

    +static int rdt_mon_configurable_show(struct kernfs_open_file *of,
    + struct seq_file *seq, void *v)
    +{
    + struct rdt_resource *r = of->kn->parent->priv;
    +
    + seq_printf(seq, "%d\n", r->mon_configurable);
    +
    + return 0;
    +}
    +
    static int rdt_mon_features_show(struct kernfs_open_file *of,
    struct seq_file *seq, void *v)
    {
    @@ -1447,6 +1457,13 @@ static struct rftype res_common_files[] = {
    .seq_show = rdt_num_rmids_show,
    .fflags = RF_MON_INFO,
    },
    + {
    + .name = "mon_configurable",
    + .mode = 0444,
    + .kf_ops = &rdtgroup_kf_single_ops,
    + .seq_show = rdt_mon_configurable_show,
    + .fflags = RF_MON_INFO,
    + },
    {
    .name = "cbm_mask",
    .mode = 0444,
    diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
    index 21deb5212bbd..4ee2b606ac14 100644
    --- a/include/linux/resctrl.h
    +++ b/include/linux/resctrl.h
    @@ -154,6 +154,7 @@ struct rdt_resource {
    bool mon_enabled;
    bool alloc_capable;
    bool mon_capable;
    + bool mon_configurable;
    int num_rmid;
    int cache_level;
    struct resctrl_cache cache;

    \
     
     \ /
      Last update: 2022-08-22 15:45    [W:5.281 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site