linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Reinette Chatre <reinette.chatre@intel.com>
Cc: fenghua.yu@intel.com, tony.luck@intel.com,
	jithu.joseph@intel.com, gavin.hindman@intel.com,
	dave.hansen@intel.com, mingo@redhat.com, hpa@zytor.com,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] x86/intel_rdt: CBM overlap should also check for overlap with CDP peer
Date: Wed, 3 Oct 2018 09:02:27 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1810030848580.1435@nanos.tec.linutronix.de> (raw)
In-Reply-To: <262e12b66c238517c4766190dd493d937825f563.1537987801.git.reinette.chatre@intel.com>

On Wed, 26 Sep 2018, Reinette Chatre wrote:
>  /**
> - * rdtgroup_cbm_overlaps - Does CBM for intended closid overlap with other
> + * _rdtgroup_cbm_overlaps - Does CBM for intended closid overlap with other
>   * @r: Resource to which domain instance @d belongs.
>   * @d: The domain instance for which @closid is being tested.
>   * @cbm: Capacity bitmask being tested.
> @@ -1049,8 +1048,8 @@ static int __attribute__((unused)) rdt_cdp_peer_get(struct rdt_resource *r,
>   *
>   * Return: false if CBM does not overlap, true if it does.
>   */
> -bool rdtgroup_cbm_overlaps(struct rdt_resource *r, struct rdt_domain *d,
> -			   u32 _cbm, int closid, bool exclusive)
> +static bool _rdtgroup_cbm_overlaps(struct rdt_resource *r, struct rdt_domain *d,
> +				   u32 _cbm, int closid, bool exclusive)

Existing issue. The documentation uses @cbm, but the argument is _cbm.

Also please make this __rdtgroup_cbm_overlaps(). Double underscores are
standing more out.

>  {
>  	unsigned long *cbm = (unsigned long *)&_cbm;
>  	unsigned long *ctrl_b;
> @@ -1087,6 +1086,44 @@ bool rdtgroup_cbm_overlaps(struct rdt_resource *r, struct rdt_domain *d,
>  	return false;
>  }
>  
> +/**
> + * rdtgroup_cbm_overlaps - Does CBM overlap with other use of hardware
> + * @r: Resource to which domain instance @d belongs.
> + * @d: The domain instance for which @closid is being tested.
> + * @cbm: Capacity bitmask being tested.
> + * @closid: Intended closid for @cbm.
> + * @exclusive: Only check if overlaps with exclusive resource groups
> + *
> + * Resources that can be allocated using a CBM can use the CBM to control
> + * the overlap of these allocations. rdtgroup_cmb_overlaps() is the test
> + * for overlap. Overlap test is not limited to the specific resource for
> + * which the CBM is intended though - when dealing with CDP resources that
> + * share the underlying hardware the overlap check should be performed on
> + * the CDP resource sharing the hardware also.
> + *
> + * Refer to description of _rdtgroup_cbm_overlaps() for the details of the
> + * overlap test.
> + *
> + * Return: true if CBM overlap detected, false if there is no overlap
> + */
> +bool rdtgroup_cbm_overlaps(struct rdt_resource *r, struct rdt_domain *d,
> +			   u32 _cbm, int closid, bool exclusive)

Ditto. And here is no reason for using _cbm.

> +{
> +	struct rdt_resource *r_cdp;
> +	struct rdt_domain *d_cdp;
> +	bool ret;
> +
> +	ret = _rdtgroup_cbm_overlaps(r, d, _cbm, closid, exclusive);
> +	if (ret)
> +		return ret;

  	if (__rdtgroup_cbm_overlaps(r, d, _cbm, closid, exclusive))
		return true;

> +
> +	if (rdt_cdp_peer_get(r, d, &r_cdp, &d_cdp) == 0)
> +		return _rdtgroup_cbm_overlaps(r_cdp, d_cdp, _cbm,
> +					      closid, exclusive);

	if (rdt_cdp_peer_get(r, d, &r_cdp, &d_cdp) < 0)
		return false;

	return __rdtgroup_cbm_overlaps(r_cpd, d_cdp, _cbm, closid, exclusive);

Makes the whole thing more obvious.

Thanks,

	tglx


  reply	other threads:[~2018-10-03  7:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-26 18:59 [PATCH 0/3] x86/intel_rdt: Fix exclusive mode with CDP resources Reinette Chatre
2018-09-26 18:59 ` [PATCH 1/3] x86/intel_rdt: Introduce utility to obtain CDP peer Reinette Chatre
2018-10-03  6:46   ` Thomas Gleixner
2018-09-26 18:59 ` [PATCH 2/3] x86/intel_rdt: CBM overlap should also check for overlap with " Reinette Chatre
2018-10-03  7:02   ` Thomas Gleixner [this message]
2018-10-03 18:16     ` Reinette Chatre
2018-10-03 19:43       ` Thomas Gleixner
2018-10-03 19:51         ` Reinette Chatre
2018-09-26 18:59 ` [PATCH 3/3] x86/intel_rdt: Fix initial allocation to consider CDP Reinette Chatre

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=alpine.DEB.2.21.1810030848580.1435@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=dave.hansen@intel.com \
    --cc=fenghua.yu@intel.com \
    --cc=gavin.hindman@intel.com \
    --cc=hpa@zytor.com \
    --cc=jithu.joseph@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=reinette.chatre@intel.com \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).