mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Morse <james.morse@arm.com>
To: Reinette Chatre <reinette.chatre@intel.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Cc: Fenghua Yu <fenghua.yu@intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	H Peter Anvin <hpa@zytor.com>, Babu Moger <Babu.Moger@amd.com>,
	shameerali.kolothum.thodi@huawei.com,
	D Scott Phillips OS <scott@os.amperecomputing.com>,
	carl@os.amperecomputing.com, lcherian@marvell.com,
	bobo.shaobowang@huawei.com, tan.shaopeng@fujitsu.com,
	baolin.wang@linux.alibaba.com,
	Jamie Iles <quic_jiles@quicinc.com>,
	Xin Hao <xhao@linux.alibaba.com>,
	peternewman@google.com, dfustini@baylibre.com,
	amitsinght@marvell.com, David Hildenbrand <david@redhat.com>,
	Rex Nie <rex.nie@jaguarmicro.com>,
	Dave Martin <dave.martin@arm.com>
Subject: Re: [PATCH v3 03/38] x86/resctrl: Add a schema format enum and use this for fflags
Date: Fri, 2 Aug 2024 18:24:11 +0100	[thread overview]
Message-ID: <8c3dd90d-475d-47e9-8691-a447d8042596@arm.com> (raw)
In-Reply-To: <c79a1aae-6ab7-48d2-93fb-7b78198b5954@intel.com>

Hi Reinette,

On 01/07/2024 22:09, Reinette Chatre wrote:
> On 7/1/24 11:17 AM, James Morse wrote:
>> On 28/06/2024 17:43, Reinette Chatre wrote:
>>> On 6/14/24 7:59 AM, James Morse wrote:
>>>> resctrl has three types of control, these emerge from the way the
>>>> architecture initialises a number of properties in struct rdt_resource.
>>>>
>>>> A group of these properties need to be set the same on all architectures,
>>>> it would be better to specify the format the schema entry should use, and
>>>> allow resctrl to generate all the other properties it needs. This avoids
>>>> architectures having divergant behaviour here.
>>>
>>> divergant -> divergent ?
>>>
>>>>
>>>> Add a schema format enum, and as a first use, replace the fflags member
>>>> of struct rdt_resource.
>>>>
>>>> The MBA schema has a different format between AMD and Intel systems.
>>>> The schema_fmt property is changed by __rdt_get_mem_config_amd() to
>>>> enable the MBPS format.
>>
>>>> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>>>> b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>>>> index e3edc41882dc..b12307d465bc 100644
>>>> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>>>> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>>>> @@ -2162,6 +2162,19 @@ static int rdtgroup_mkdir_info_resdir(void *priv, char *name,
>>>>        return ret;
>>>>    }
>>>>    +static u32 fflags_from_resource(struct rdt_resource *r)
>>>> +{
>>>> +    switch (r->schema_fmt) {
>>>> +    case RESCTRL_SCHEMA_BITMAP:
>>>> +        return RFTYPE_RES_CACHE;
>>>> +    case RESCTRL_SCHEMA_PERCENTAGE:
>>>> +    case RESCTRL_SCHEMA_MBPS:
>>>> +        return RFTYPE_RES_MB;
>>>> +    }
>>>> +
>>>> +    return WARN_ON_ONCE(1);
>>>> +}
>>>> +
>>>
>>> The fflags returned specifies which files will be associated with the resource
>>> in the "info" directory. Basing this on a property of the schema does not look
>>> right to me. I understand that many of the info files relate to, for example,
>>> information related to the bitmap used by the cache,
>>
>> Do we agree that some of them are?
>>
>> One reason for doing this is it decouples the parsing and management of bitmaps from "this
>> is the L3 cache", which will make it much easier to support bitmaps on some other kind of
>> resource.

> The way I see it is that it changes the meaning of the RFTYPE_RES_CACHE flag from "this is a
> file related to the cache resource" to "this is a file containing a bitmap property".
> It prevents us from easily adding a file related to the cache resource, which
> the info directory is intended to contain.

I struggled to find something that is a property of a "cache control", but is neither a
property of the control (e.g. bitmap size) or the cache. I guess the 'bit_usage' stuff is
the best example.

Maybe we end up with two sets of flags - this will be for the distant future. Currently I
taking your 'base fflags on resource id'.


>> Ultimately I'd like to expose these to user-space, so that user-space can work out how to
>> configure resources it doesn't recognise. Today '100' could be a percentage, a bitmap, or
>> a value in MB/s. Today some knowledge of the control type is needed to work this out.
>>
>>
>>> but that is not the same for
>>> info files related to the MBA resource (all info files related to MBA resource
>>> are not about the schema property format).
>>
>> Hmmm, because the files min_bandwidth and bandwidth_gran both have bandwidth in their name?
>>
>> I agree 'delay_linear' and 'thread_throttle_mode' are a bit strange.
> 
> Right. This is not a clean association.
> 
>>
>>
>>> I do not think the type of values of a schema should dictate which files
>>> appear in the info directory.
>>
>> Longer term I think this will be a problem. We probably only have 3 types of control:
>> percentage, bitmap and MB/s... but if each resource on each architecture adds files here
>> the list will quickly grow. User-space won't be able to work out how to configure a
>> resource type it hadn't seen before.
> 
> That is fair. This makes the type of control a property of the resource as is done in this
> series. Perhaps this can be exposed to user space via the info directory?

Yes, that is something I intend to look at. I eventually need to get MPAM's "cache
capacity" controls working as there are a number of hardware platforms that have it. This
would probably be a percentage control for 'L2' or 'L3', exposing an "info/schema_format"
file makes the most sense. I can't convert the existing bitmap as it implies isolation,
which this control format can't do, so it does need to be separate.
But! - to prevent confusing existing software, I don't think the L2/L3 should be touched -
those will forever have to be implicitly a bitmap, so anything in this area would have to
be an additional schema.


> Possibly the files related to control can have new flags that that reflect the control type
> instead of the resource. For example, "bit_usage" currently has
> "RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE" and that could be (for lack of better
> term) "RFTYPE_CTRL_INFO | RFTYPE_CTRL_BITMAP" to disconnect the control type from the
> resource. Doing so may then map nicely to the fflags_from_resource() in this patch that
> connects the schema format to the _control_ type flag. As we have found there is not
> a clear mapping between the control type and the resource type so I expect RFTYPE_RES_CACHE
> and RFTYPE_RES_MB to remain and be associated with files that contain information
> specific to that resource. This enables future additions of files containing cache specific
> (non-bitmap) properties to still be added (with RFTYPE_RES_CACHE flag) without impacting
> everything that uses a bitmap.
> 
> What do you think?

Makes sense!


Thanks,

James

  reply	other threads:[~2024-08-02 17:24 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-14 14:59 [PATCH v3 00/38] x86/resctrl: Move the resctrl filesystem code to /fs/resctrl James Morse
2024-06-14 14:59 ` [PATCH v3 01/38] x86/resctrl: Fix allocation of cleanest CLOSID on platforms with no monitors James Morse
2024-06-28 16:41   ` Reinette Chatre
2024-06-14 14:59 ` [PATCH v3 02/38] x86/resctrl: Add a helper to avoid reaching into the arch code resource list James Morse
2024-06-28 16:42   ` Reinette Chatre
2024-06-14 14:59 ` [PATCH v3 03/38] x86/resctrl: Add a schema format enum and use this for fflags James Morse
2024-06-28 16:43   ` Reinette Chatre
2024-07-01 18:17     ` James Morse
2024-07-01 21:09       ` Reinette Chatre
2024-08-02 17:24         ` James Morse [this message]
2024-06-14 14:59 ` [PATCH v3 04/38] x86/resctrl: Use schema type to determine how to parse schema values James Morse
2024-06-28 16:43   ` Reinette Chatre
2024-06-14 15:00 ` [PATCH v3 05/38] x86/resctrl: Use schema type to determine the schema format string James Morse
2024-06-28 16:43   ` Reinette Chatre
2024-06-14 15:00 ` [PATCH v3 06/38] x86/resctrl: Move data_width to be a schema property James Morse
2024-06-28 16:45   ` Reinette Chatre
2024-06-14 15:00 ` [PATCH v3 07/38] x86/resctrl: Add max_bw to struct resctrl_membw James Morse
2024-06-14 15:00 ` [PATCH v3 08/38] x86/resctrl: Generate default_ctrl instead of sharing it James Morse
2024-06-14 15:00 ` [PATCH v3 09/38] x86/resctrl: Add helper for setting CPU default properties James Morse
2024-06-14 15:00 ` [PATCH v3 10/38] x86/resctrl: Remove rdtgroup from update_cpu_closid_rmid() James Morse
2024-06-14 15:00 ` [PATCH v3 11/38] x86/resctrl: Export resctrl fs's init function James Morse
2024-06-14 15:00 ` [PATCH v3 12/38] x86/resctrl: Wrap resctrl_arch_find_domain() around rdt_find_domain() James Morse
2024-06-14 15:00 ` [PATCH v3 13/38] x86/resctrl: Move resctrl types to a separate header James Morse
2024-06-28 16:45   ` Reinette Chatre
2024-07-01 18:16     ` James Morse
2024-06-14 15:00 ` [PATCH v3 14/38] x86/resctrl: Add a resctrl helper to reset all the resources James Morse
2024-06-14 15:00 ` [PATCH v3 15/38] x86/resctrl: Move monitor exit work to a restrl exit call James Morse
2024-06-28 16:46   ` Reinette Chatre
2024-07-01 18:17     ` James Morse
2024-07-11 21:12   ` Carl Worth
2024-06-14 15:00 ` [PATCH v3 16/38] x86/resctrl: Move monitor init work to a resctrl init call James Morse
2024-06-28 16:47   ` Reinette Chatre
2024-07-01 18:17     ` James Morse
2024-07-01 21:11       ` Reinette Chatre
2024-08-02 17:23         ` James Morse
2024-06-14 15:00 ` [PATCH v3 17/38] x86/resctrl: Stop using the for_each_*_rdt_resource() walkers James Morse
2024-06-28 16:48   ` Reinette Chatre
2024-07-01 18:16     ` James Morse
2024-07-01 21:10       ` Reinette Chatre
2024-08-02 17:22         ` James Morse
2024-06-14 15:00 ` [PATCH v3 18/38] x86/resctrl: Export the is_mbm_*_enabled() helpers to asm/resctrl.h James Morse
2024-06-14 15:00 ` [PATCH v3 19/38] x86/resctrl: Add resctrl_arch_is_evt_configurable() to abstract BMEC James Morse
2024-06-14 15:00 ` [PATCH v3 20/38] x86/resctrl: Change mon_event_config_{read,write}() to be arch helpers James Morse
2024-06-28 16:49   ` Reinette Chatre
2024-06-14 15:00 ` [PATCH v3 21/38] x86/resctrl: Move mbm_cfg_mask to struct rdt_resource James Morse
2024-06-28 16:53   ` Reinette Chatre
2024-06-14 15:00 ` [PATCH v3 22/38] x86/resctrl: Add resctrl_arch_ prefix to pseudo lock functions James Morse
2024-06-14 15:00 ` [PATCH v3 23/38] x86/resctrl: Allow an architecture to disable pseudo lock James Morse
2024-07-11 21:33   ` Carl Worth
2024-08-02 17:22     ` James Morse
2024-06-14 15:00 ` [PATCH v3 24/38] x86/resctrl: Make prefetch_disable_bits belong to the arch code James Morse
2024-06-14 15:00 ` [PATCH v3 25/38] x86/resctrl: Make resctrl_arch_pseudo_lock_fn() take a plr James Morse
2024-06-14 15:00 ` [PATCH v3 26/38] x86/resctrl: Move thread_throttle_mode_init() to be managed by resctrl James Morse
2024-06-14 15:00 ` [PATCH v3 27/38] x86/resctrl: Move get_config_index() to a header James Morse
2024-06-14 15:00 ` [PATCH v3 28/38] x86/resctrl: Claim get_domain_from_cpu() for resctrl James Morse
2024-06-14 15:00 ` [PATCH v3 29/38] x86/resctrl: Describe resctrl's bitmap size assumptions James Morse
2024-06-14 15:00 ` [PATCH v3 30/38] x86/resctrl: Rename resctrl_sched_in() to begin with "resctrl_arch_" James Morse
2024-06-14 15:00 ` [PATCH v3 31/38] x86/resctrl: resctrl_exit() teardown resctrl but leave the mount point James Morse
2024-06-28 16:53   ` Reinette Chatre
2024-07-04 16:41     ` James Morse
2024-07-08 17:47       ` Reinette Chatre
2024-08-02 17:28         ` James Morse
2024-06-14 15:00 ` [PATCH v3 32/38] x86/resctrl: Drop __init/__exit on assorted symbols James Morse
2024-06-14 15:00 ` [PATCH v3 33/38] x86/resctrl: Move is_mba_sc() out of core.c James Morse
2024-06-14 15:00 ` [PATCH v3 34/38] x86/resctrl: Add end-marker to the resctrl_event_id enum James Morse
2024-06-14 15:00 ` [PATCH v3 35/38] x86/resctrl: Remove a newline to avoid confusing the code move script James Morse
2024-06-14 15:00 ` [PATCH v3 36/38] fs/resctrl: Add boiler plate for external resctrl code James Morse
2024-06-28 16:54   ` Reinette Chatre
2024-07-04 16:40     ` James Morse
2024-07-08 17:47       ` Reinette Chatre
2024-06-14 15:00 ` [PATCH v3 37/38] x86/resctrl: Move the filesystem bits to headers visible to fs/resctrl James Morse
2024-06-28 17:04   ` Reinette Chatre
2024-06-14 15:00 ` [PATCH v3 38/38] x86/resctrl: Add python script to move resctrl code to /fs/resctrl James Morse
2024-07-11 22:00 ` [PATCH v3 00/38] x86/resctrl: Move the resctrl filesystem " Carl Worth
2024-08-02 17:22   ` James Morse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8c3dd90d-475d-47e9-8691-a447d8042596@arm.com \
    --to=james.morse@arm.com \
    --cc=Babu.Moger@amd.com \
    --cc=amitsinght@marvell.com \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=bobo.shaobowang@huawei.com \
    --cc=bp@alien8.de \
    --cc=carl@os.amperecomputing.com \
    --cc=dave.martin@arm.com \
    --cc=david@redhat.com \
    --cc=dfustini@baylibre.com \
    --cc=fenghua.yu@intel.com \
    --cc=hpa@zytor.com \
    --cc=lcherian@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peternewman@google.com \
    --cc=quic_jiles@quicinc.com \
    --cc=reinette.chatre@intel.com \
    --cc=rex.nie@jaguarmicro.com \
    --cc=scott@os.amperecomputing.com \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=tan.shaopeng@fujitsu.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xhao@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®