All of lore.kernel.org
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Fenghua Yu <fenghua.yu@intel.com>, Borislav Petkov <bp@alien8.de>,
	Tony Luck <tony.luck@intel.com>,
	kuo-lang.tseng@intel.com, ravi.v.shankar@intel.com,
	Ingo Molnar <mingo@redhat.com>, Babu Moger <babu.moger@amd.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
	<x86@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: [PATCH V5 4/4] x86/resctrl: Use appropriate API for strings terminated by newline
Date: Tue, 19 May 2020 08:50:22 -0700	[thread overview]
Message-ID: <4a9603b8-32fb-024a-e2f5-14e95b4e3763@intel.com> (raw)
In-Reply-To: <CAHp75Vc_VA-2UNJh7epe+oQEiU3WBedomLbAVTD_L4_ocvt8Dw@mail.gmail.com>

Hi Andy,

On a high level the changes from v4 to v5 aimed to address your feedback
and also ensure that original user interface behavior is maintained.

On 5/19/2020 1:28 AM, Andy Shevchenko wrote:
> On Tue, May 19, 2020 at 2:50 AM Reinette Chatre
> <reinette.chatre@intel.com> wrote:
> 
> ...
> 
>> +       ret = sysfs_match_string(rdt_mode_str, buf);
>> +       if (ret < 0) {
>> +               rdt_last_cmd_puts("Unknown or unsupported mode\n");
>> +               ret = -EINVAL;
>> +               goto out;
>> +       }

From your previous email ...

>> +       ret = sysfs_match_string(rdt_mode_str, buf);
>> +       if (ret < 0) {
>> +               rdt_last_cmd_puts("Unknown or unsupported mode\n");
>
>> +               ret = -EINVAL;
>
> This is redundant.

I understand that shadowing an error code is generally of concern. In
this case the error code is set to -EINVAL to ensure that it is the same
error code that was returned to user space originally and will continue
to be so no matter what changes may come to sysfs_match_string().

>> +
>> +       user_m = ret;
> 
>> +       } else if (user_m == RDT_MODE_PSEUDO_LOCKED) {
>>                 rdt_last_cmd_puts("Unknown or unsupported mode\n");
>>                 ret = -EINVAL;
>> +               goto out;
>>         }
> 
> Can't we unify latter with a former like
> 
>   if (ret == RDT_MODE_PSEUDO_LOCKED)
>     ret = -EINVAL;
>   if (ret < 0) {
>       rdt_last_cmd_puts("Unknown or unsupported mode\n");
>       goto out;
>   }
> 
> ?
> 
> Or closer to initial like
> 
>   if (ret < 0 || ret == RDT_MODE_PSEUDO_LOCKED) {
>     rdt_last_cmd_puts("Unknown or unsupported mode\n");
>     ret = -EINVAL;
>     goto out;
>   }
> 

This would have been ideal if done from the start but currently "0" is
returned if the current mode is pseudo-locked and user attempts to
change the mode to pseudo-locked. Thus, to maintain the current user
interface the check if user wants to set pseudo-locked mode is moved
after the check if new mode is same as existing mode and thus not
unified because that will result in an error returned always when user
requests pseudo-locked mode.

Reinette

  reply	other threads:[~2020-05-19 15:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-18 23:46 [PATCH V5 0/4] x86/resctrl: Enable user to view and select thread throttling mode Reinette Chatre
2020-05-18 23:46 ` [PATCH V5 1/4] " Reinette Chatre
2020-05-18 23:46 ` [PATCH V5 2/4] x86/resctrl: Enumerate per-thread MBA Reinette Chatre
2020-05-18 23:46 ` [PATCH V5 3/4] x86/resctrl: Enable " Reinette Chatre
2020-05-18 23:46 ` [PATCH V5 4/4] x86/resctrl: Use appropriate API for strings terminated by newline Reinette Chatre
2020-05-19  8:19   ` Andy Shevchenko
2020-05-19  8:28   ` Andy Shevchenko
2020-05-19 15:50     ` Reinette Chatre [this message]
2020-05-19 16:07       ` Andy Shevchenko
2020-05-19 16:08         ` Andy Shevchenko
2020-05-19 17:54         ` 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=4a9603b8-32fb-024a-e2f5-14e95b4e3763@intel.com \
    --to=reinette.chatre@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=babu.moger@amd.com \
    --cc=bp@alien8.de \
    --cc=fenghua.yu@intel.com \
    --cc=hpa@zytor.com \
    --cc=kuo-lang.tseng@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=ravi.v.shankar@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.