mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
To: Jonathan Corbet <corbet@lwn.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org, vince@deater.net,
	eranian@google.com, johannes@sipsolutions.net,
	Arnaldo Carvalho de Melo <acme@infradead.org>
Subject: Re: [PATCH RFC v3 1/6] exterr: Introduce extended syscall error reporting
Date: Tue, 15 Sep 2015 17:15:12 +0300	[thread overview]
Message-ID: <87a8snn4zz.fsf@ashishki-desk.ger.corp.intel.com> (raw)
In-Reply-To: <20150914141931.39f6be92@lwn.net>

Jonathan Corbet <corbet@lwn.net> writes:

> So, a couple of comments as I try to figure this stuff out...

Thanks for taking the time to look at this.

> On Fri, 11 Sep 2015 19:00:00 +0300
> Alexander Shishkin <alexander.shishkin@linux.intel.com> wrote:
>
>> +int ext_err_copy_to_user(void __user *buf, size_t size)
>> +{
>> +	struct ext_err_domain_desc *dom = ext_err_domain_find(current->ext_err_code);
>> +	struct ext_err_site *site = ext_err_site_find(current->ext_err_code);
>
> Here too you use ext_err_code without making sure it has a useful value.
> This will also result in two calls to ext_err_domain_find(), and, thus, a
> redundant search of the domains array.  Why not just pass dom to the second
> call?

Yes, this is a bit too much of a quick and dirty rfc (as you can
probably guess from the way it's written), you're absolutely right.

> [...]
>
>> +	if (!ret)
>> +		current->ext_err_code = 0;
>
> Back to this code: here is the only place you ever clear it, and this seems
> to be an error response in its own right.  So, if I read this correctly,
> once an extended error has been signalled, it will remain forever in the
> task state until another extended error overwrites it, right?

Yes, and this brings us to an important point (below).

> What that says to me is that there will be no way to know whether an error
> description returned from prctl() corresponds to an error just reported to
> the application or not; it could be an old error from last week.  That
> strikes me as being less useful than it could otherwise be.

It seems to make sense to allow the program to clear it (via a flag in
that prctl(), for example). That is, if we get an error, we try to fetch
the extended description, clear it and forget about it.

Then, this prctl() may be a part of the syscall wrapper (or a library
function that uses that syscall), which might or might not want to leave
the extended error code for the main program to inspect. Or a debugger
might call this prctl() for its debugging purposes, but still keep it
around for the main program.

> It seems to me that current->ext_err_code needs to be cleared on each
> system call entry (except for your special prctl() of course!).

I'd say, it should be up to the program to decide for how long they want
to keep the extended error code around.

Thanks,
--
Alex

  reply	other threads:[~2015-09-15 14:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-11 15:59 [PATCH RFC v3 0/6] " Alexander Shishkin
2015-09-11 16:00 ` [PATCH RFC v3 1/6] exterr: " Alexander Shishkin
2015-09-14 20:19   ` Jonathan Corbet
2015-09-15 14:15     ` Alexander Shishkin [this message]
2015-09-15 14:31       ` Johannes Berg
2015-09-15 15:24         ` Alexander Shishkin
2015-09-15 16:35           ` Jonathan Corbet
2015-09-15 17:02             ` Johannes Berg
2015-09-14 21:59   ` Jonathan Corbet
2016-01-11 10:34   ` Alexander Shishkin
2015-09-11 16:00 ` [PATCH RFC v3 2/6] perf: Use " Alexander Shishkin
2015-09-11 16:00 ` [PATCH RFC v3 3/6] perf/x86: Annotate a BTS error with extended " Alexander Shishkin
2015-09-11 16:00 ` [PATCH RFC v3 4/6] perf tools: Add a simple JSON parser Alexander Shishkin
2015-09-11 16:00 ` [PATCH RFC v3 5/6] perf tools: Add userspace counterpart for extended error reporting Alexander Shishkin
2015-09-11 16:00 ` [PATCH RFC v3 6/6] perf tools: Use extended syscall " Alexander Shishkin

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=87a8snn4zz.fsf@ashishki-desk.ger.corp.intel.com \
    --to=alexander.shishkin@linux.intel.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@infradead.org \
    --cc=corbet@lwn.net \
    --cc=eranian@google.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=vince@deater.net \
    /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

all inboxes | Powered by JetHome®