lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c500c170-c0af-40ae-9bb5-410edc7feaeb@amd.com>
Date: Tue, 20 Aug 2024 13:24:16 -0500
From: "Moger, Babu" <babu.moger@....com>
To: Reinette Chatre <reinette.chatre@...el.com>, corbet@....net,
 fenghua.yu@...el.com, tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
 dave.hansen@...ux.intel.com
Cc: x86@...nel.org, hpa@...or.com, paulmck@...nel.org, rdunlap@...radead.org,
 tj@...nel.org, peterz@...radead.org, yanjiewtw@...il.com,
 kim.phillips@....com, lukas.bulwahn@...il.com, seanjc@...gle.com,
 jmattson@...gle.com, leitao@...ian.org, jpoimboe@...nel.org,
 rick.p.edgecombe@...el.com, kirill.shutemov@...ux.intel.com,
 jithu.joseph@...el.com, kai.huang@...el.com, kan.liang@...ux.intel.com,
 daniel.sneddon@...ux.intel.com, pbonzini@...hat.com, sandipan.das@....com,
 ilpo.jarvinen@...ux.intel.com, peternewman@...gle.com,
 maciej.wieczor-retman@...el.com, linux-doc@...r.kernel.org,
 linux-kernel@...r.kernel.org, eranian@...gle.com, james.morse@....com
Subject: Re: [PATCH v6 12/22] x86/resctrl: Introduce mbm_cntr_map to track
 counters at domain

Hi Reinette,


On 8/16/24 16:37, Reinette Chatre wrote:
> Hi Babu,
> 
> On 8/6/24 3:00 PM, Babu Moger wrote:
>> The MBM counters are allocated at resctrl group level. It is tracked by
> 
> Are they not allocated globally? (but maybe that is about to change?

No. It is not changing. It is allocated globally and assigned to
RMID,event pair in a resctrl group.

> 
>> mbm_cntrs_free_map. Then it is assigned to the domain based on the user
>> input. It needs to be tracked at domain level also.
> 
> Please elaborate why it needs to be tracked at domain level.


The user can apply the counter assignment either to a specific domain
within a group or to all domains in the group. The mbm_cntr_map will be
used to track the domain-specific assignments.

> 
>>
>> Add the mbm_cntr_map bitmap in rdt_mon_domain structure to keep track of
> 
> "rdt_mon_domain structure" -> "struct rdt_mon_domain"

Sure.
> 
>> assignment at domain level. The global counter at mbm_cntrs_free_map can
>> be released when assignment at all the domain are cleared.
> 
> "all the domain" -> "all the domains"?
> 
Sure.

>>
>> Signed-off-by: Babu Moger <babu.moger@....com>
>> ---
>> v6: New patch to add domain level assignment.
>> ---
>>   arch/x86/kernel/cpu/resctrl/rdtgroup.c | 10 ++++++++++
>>   include/linux/resctrl.h                |  2 ++
>>   2 files changed, 12 insertions(+)
>>
>> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>> b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>> index 0047b4eb0ff5..1a90c671a027 100644
>> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>> @@ -4127,6 +4127,7 @@ static void __init rdtgroup_setup_default(void)
>>     static void domain_destroy_mon_state(struct rdt_mon_domain *d)
>>   {
>> +    bitmap_free(d->mbm_cntr_map);
>>       bitmap_free(d->rmid_busy_llc);
>>       kfree(d->mbm_total);
>>       kfree(d->mbm_local);
>> @@ -4200,6 +4201,15 @@ static int domain_setup_mon_state(struct
>> rdt_resource *r, struct rdt_mon_domain
>>               return -ENOMEM;
>>           }
>>       }
>> +    if (is_mbm_enabled()) {
> 
> This should also depend on whether the resource supports counter
> assignment, and that it
> is enabled to ensure that r->mon.num_mbm_cntrs is valid.

I can add the check if(r->mon.mbm_cntr_assignable) .

> 
>> +        d->mbm_cntr_map = bitmap_zalloc(r->mon.num_mbm_cntrs, GFP_KERNEL);
>> +        if (!d->mbm_cntr_map) {
>> +            bitmap_free(d->rmid_busy_llc);
>> +            kfree(d->mbm_total);
>> +            kfree(d->mbm_local);
>> +            return -ENOMEM;
>> +        }
>> +    }
>>         return 0;
>>   }
>> diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
>> index ef08f75191f2..034fa994e84f 100644
>> --- a/include/linux/resctrl.h
>> +++ b/include/linux/resctrl.h
>> @@ -105,6 +105,7 @@ struct rdt_ctrl_domain {
>>    * @cqm_limbo:        worker to periodically read CQM h/w counters
>>    * @mbm_work_cpu:    worker CPU for MBM h/w counters
>>    * @cqm_work_cpu:    worker CPU for CQM h/w counters
>> + * @mbm_cntr_map:    bitmap to track domain counter assignment
>>    */
>>   struct rdt_mon_domain {
>>       struct rdt_domain_hdr        hdr;
>> @@ -116,6 +117,7 @@ struct rdt_mon_domain {
>>       struct delayed_work        cqm_limbo;
>>       int                mbm_work_cpu;
>>       int                cqm_work_cpu;
>> +    unsigned long            *mbm_cntr_map;
>>   };
>>     /**
> 
> Reinette
> 

-- 
Thanks
Babu Moger

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ