Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1428756pxf; Fri, 12 Mar 2021 09:15:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJyYNM0So7GTUzspzP6WFBwcY8XfBiIVvDpTLO+aREc8hxi9/ocw74pU7M1AGjxROLNivkJG X-Received: by 2002:a05:6402:484:: with SMTP id k4mr15164346edv.321.1615569357441; Fri, 12 Mar 2021 09:15:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615569357; cv=none; d=google.com; s=arc-20160816; b=q61enazaVtvt41HWGRYbP4NPsmn05ytduCMHQjAAPWRoGu2xy+KtxAeBFhnSMUhbUd mPjbUMw2r2pgTwSMl2oLlsR1gx67uugHW0oKOKngYy8KnwWP1lo6Cy1gIMi3WUm56GDq AvHMMpSSlo2+/NEHlVUkm7ODJpPwCz99Ynd+gIBu7QnFNGWArym1sCKAXa37rJ0C6zhP 1sN300MxIf4ES/1HbBsNTWoFUMMi2GxAUHU2tW3YR/c+QnsetmtcUqS/qI7dDeVG45/c U/PWQQoOhYUP8EubJsjBo8tlBs/OTZvLjWMrM1HSgDAtObq7rejax2U3jkE4xxk9OnvM MN7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:subject:from; bh=FWAnbiulRnuB8pjwaLvnBW/ZL0/qcL+ylNOS7fMJFQg=; b=Iqxbu4ZtN8quWCIq1RGfpDYveEp5NOYltglcThgiPgU5KdaW8NMyTTSarQ5kfI1R6y 0MDiXVO0SNr80FDp/v/VaIfRoV9XddCkhfq8hjM9fjZ0G2HmLdSQAv4WrkIsep7vxPYH W9vG+UcxOeTKZc8GwEFxlgU0oaj67FTW/mlP9EBHaB0dWoAsptZNLlrlsw0/OhcDRGjp 2x/yXQDIITlvRaPSm82d+R66+SVQN6bqrXXhkQ1cTd5iypY8qHbLfZAyoGTzdMzbH3FN rkJ92q5IAajtRA8nMFQuAo1pHGurpty0pZ+tPm+5K5nYURTp6lmorkajqzZeT4agOJUZ khQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u5si4578301ejf.438.2021.03.12.09.15.34; Fri, 12 Mar 2021 09:15:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232384AbhCLRLi (ORCPT + 99 others); Fri, 12 Mar 2021 12:11:38 -0500 Received: from foss.arm.com ([217.140.110.172]:57590 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232342AbhCLRLJ (ORCPT ); Fri, 12 Mar 2021 12:11:09 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 014F211FB; Fri, 12 Mar 2021 09:11:09 -0800 (PST) Received: from [192.168.0.14] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 73FF33F7D7; Fri, 12 Mar 2021 09:11:07 -0800 (PST) From: James Morse Subject: Re: [PATCH 05/24] x86/resctrl: Pass the schema in resdir's private pointer To: Reinette Chatre , x86@kernel.org, linux-kernel@vger.kernel.org Cc: Fenghua Yu , Thomas Gleixner , Ingo Molnar , Borislav Petkov , shameerali.kolothum.thodi@huawei.com, Jamie Iles , D Scott Phillips OS References: <20201030161120.227225-1-james.morse@arm.com> <20201030161120.227225-6-james.morse@arm.com> Message-ID: <892c8c20-92e3-750f-00cf-8d559b0d181b@arm.com> Date: Fri, 12 Mar 2021 17:11:06 +0000 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Reinette, On 17/11/2020 21:49, Reinette Chatre wrote: > It is not clear what "resdir" mentioned in subject line refers to. rdtgroup_mkdir_info_resdir(), it looks I picked the wrong bit to identify it. ('info' in a name usually conveys no information at all!) > Could it be changed to "info dir"? Sure, > On 10/30/2020 9:11 AM, James Morse wrote: >> Moving properties that resctrl exposes to user-space into the core >> 'fs' code, (e.g. the name of the schema), means some of the functions >> that back the filesystem need the schema struct, but currently take the >> resource. > > I think a simple addition would help to parse the above ... > > " ... need the schema struct (to where the properties are moved), ..." > >> >> Once the CDP resources are merged, the resource doesn't reflect the >> right level of information. >> >> For the info dirs that represent a control, the information needed >> is in the schema, as this is how the resource is being used. For the >> monitors, its the resource as L3CODE_MON doesn't make sense, and would >> monitor data too. >> >> This difference means the type of the private pointers varies >> between control and monitor info dirs. >> >> If the flags are RF_MON_INFO, its a struct rdt_resource. If the >> flags are RF_CTRL_INFO, its a struct resctrl_schema. Nothing in >> res_common_files[] has both flags. >> @@ -1794,6 +1803,7 @@ static int rdtgroup_mkdir_info_resdir(struct rdt_resource *r, char >> *name, >>     static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn) >>   { >> +    struct resctrl_schema *s; >>       struct rdt_resource *r; >>       unsigned long fflags; >>       char name[32]; >> @@ -1809,9 +1819,10 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn) >>       if (ret) >>           goto out_destroy; >>   -    for_each_alloc_enabled_rdt_resource(r) { >> +    list_for_each_entry(s, &resctrl_all_schema, list) { >> +        r = s->res; >>           fflags =  r->fflags | RF_CTRL_INFO; >> -        ret = rdtgroup_mkdir_info_resdir(r, r->name, fflags); >> +        ret = rdtgroup_mkdir_info_resdir(s, r->name, fflags); >>           if (ret) >>               goto out_destroy; >>       } > I think it would be helpful to add a comment here to compensate for the symmetry that is > removed ("for_each_alloc_enabled_rdt_resource()" followed by a > "for_each_mon_enabled_rdt_resource()"). Sure, the thing to convey is the first loop is for 'alloc_enabled' controls. Thanks, James