linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: Borislav Petkov <bp@alien8.de>
Cc: tglx@linutronix.de, fenghua.yu@intel.com, tony.luck@intel.com,
	jithu.joseph@intel.com, mingo@redhat.com, hpa@zytor.com,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/resctrl: Fix rdt_find_domain() return value checks
Date: Mon, 10 Dec 2018 13:42:10 -0800	[thread overview]
Message-ID: <3b097a0a-bcc5-1929-eb50-0e251ebc1152@intel.com> (raw)
In-Reply-To: <20181210210436.GI5482@zn.tnic>

Hi Boris,

On 12/10/2018 1:04 PM, Borislav Petkov wrote:
> On Mon, Dec 10, 2018 at 12:42:14PM -0800, Reinette Chatre wrote:
>> Would you be ok if the above is changed to
>>
>> if (id < 0)
>>         return ERR_PTR(-ENOENT);
>>
>> as part of this patch?
> 
> Yap.
> 
>> Looking at rdtgroup_mondata_show() is does seem as though ENOENT is the
>> actual intended error value,
> 
> #define ENOENT           2      /* No such file or directory */
> 
>> although ENODEV could perhaps also be considered since such a result
>> reflects that a particular cache instance could not be found.
> 
> #define ENODEV          19      /* No such device */
> 
> Yeah, they both kinda look ok to me and in the end of the day, the thing
> that matters most is pinpointing the place in the code which causes the
> error.

Thank you for the sanity check. I think ENODEV may reflect the issue
better and will do so in the next version. This would not affect the
current code (quoted below) that subsequently translates the error to
ENOENT.

> And looking at that particular part:
> 
>         r = &rdt_resources_all[resid];
>         d = rdt_find_domain(r, domid, NULL);
>         if (!d) {
>                 ret = -ENOENT;
>                 goto out;
>         }
> 
> You *could* put in there something like:
> 
> 	seq_printf(m, "Cannot find a domain for resource ID: %d\n", domid);
> 
> and this way it is perfectly clear which error path it is.
> 
> :-)
> 

From what I understand this scenario should never happen - at the time
knowledge of the resource instance is removed then these mondata files
referring to it will be removed also. Even so, I'd prefer not to make
any user visible changes without a specific requirement or need to do
so. In this case ENOENT is the only error code returned during this user
space interaction so from what I can tell it is currently clear which
error path it is.

Reinette

      reply	other threads:[~2018-12-10 21:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-28 18:20 [PATCH] x86/resctrl: Fix rdt_find_domain() return value checks Reinette Chatre
2018-12-10 19:13 ` Borislav Petkov
2018-12-10 20:42   ` Reinette Chatre
2018-12-10 21:04     ` Borislav Petkov
2018-12-10 21:42       ` Reinette Chatre [this message]

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=3b097a0a-bcc5-1929-eb50-0e251ebc1152@intel.com \
    --to=reinette.chatre@intel.com \
    --cc=bp@alien8.de \
    --cc=fenghua.yu@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).