linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: Thomas Gleixner <tglx@linutronix.de>
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 12:51:38 -0700	[thread overview]
Message-ID: <cd0877d5-e860-21f7-0f5f-e348d996e45c@intel.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1810032138290.27796@nanos.tec.linutronix.de>

Hi Thomas,

On 10/3/2018 12:43 PM, Thomas Gleixner wrote:
> On Wed, 3 Oct 2018, Reinette Chatre wrote:
>> On 10/3/2018 12:02 AM, Thomas Gleixner wrote:
>>>> +{
>>>> +	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.
>>
>> I think a different change is needed to support the request from your
>> review of the first patch to propagate that unthinkable error where only
>> one of the CDP peers could have an rdt_domain associated with it.
>>
>> In the above that error in question from rdt_cdp_peer_get() will be lost.
>>
>> I could do the following in support of propagating that error (note that
>> in support of the code below __rdtgroup_cbm_overlaps() also changes to
>> return int instead of bool):
>>
>> int rdtgroup_cbm_overlaps(struct rdt_resource *r, struct rdt_domain *d,
>>                           u32 cbm, int closid, bool exclusive)
>> {
>>         struct rdt_resource *r_cdp;
>>         struct rdt_domain *d_cdp;
>>         int ret;
>>
>>         if (__rdtgroup_cbm_overlaps(r, d, cbm, closid, exclusive))
>>                 return 1;
>>
>>         ret = rdt_cdp_peer_get(r, d, &r_cdp, &d_cdp);
>>         if (ret == -ENOENT) {
>>                 return 0;
>>         } else if (ret == -EINVAL) {
>>                 rdt_last_cmd_puts("Error finding CDP peer\n");
>>                 return ret;
>>         } else {
>>                 return  __rdtgroup_cbm_overlaps(r_cdp, d_cdp, cbm,
>>                                                 closid, exclusive);
>>         }
>>
>>         return -EINVAL;
>> }
>>
>> With the above change in rdtgroup_cbm_overlaps() the call sites then
>> change to for example:
>>
>>         ret = rdtgroup_cbm_overlaps(r, d, cbm_val, rdtgrp->closid, true);
>>         if (ret < 0) {
>>                 /* last_cmd_status already populated with error */
>>                 return -EINVAL;
>>         } else if (ret == 1) {
>>                 rdt_last_cmd_puts("overlaps with exclusive group\n");
>>                 return -EINVAL;
>>         }
>>         /* fall through when no overlap detected */
>>
>> Would this be acceptable?
> 
> We really have to think about that whether it's worth it. Looking at the
> resulting code I doubt it. Then I'd rather prefer the warnon and the
> simpler code. But either way works for me.

Thank you very much. I'll resubmit with the changes you prefer.

Reinette


  reply	other threads:[~2018-10-03 19:51 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
2018-10-03 18:16     ` Reinette Chatre
2018-10-03 19:43       ` Thomas Gleixner
2018-10-03 19:51         ` Reinette Chatre [this message]
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=cd0877d5-e860-21f7-0f5f-e348d996e45c@intel.com \
    --to=reinette.chatre@intel.com \
    --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=tglx@linutronix.de \
    --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).