From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] perf/x86/intel/pt: Clean up error handling in pt_event_add()
Date: Fri, 17 Apr 2015 15:06:12 +0000 [thread overview]
Message-ID: <87lhhq7q1n.fsf@ashishki-desk.ger.corp.intel.com> (raw)
In-Reply-To: <20150416103830.GB7847@gmail.com>
Ingo Molnar <mingo@kernel.org> writes:
> * Alexander Shishkin <alexander.shishkin@linux.intel.com> wrote:
>
> So it's still not obvious enough IMO - I wrote the patch below.
> Untested.
>
> NOTE: I materially changed the existing clean up logic in the
> pt_event_start() failure case to use the direct perf_aux_output_end()
> path, not pt_event_del(). I could not convince myself that
> pt_event_del() is really needed there - but I might be wrong.
No, you're right, perf_aux_output_end() is sufficient there.
> In any case, these functions are a mess and they are barely
> documented! Please add proper comments about what the interaction and
> expected rules of perf_aux_output_begin(), pt_buffer_reset_offsets(),
> pt_buffer_reset_markers(), pt_event_start(), perf_aux_output_end() et
> al is, right now it's a guessing game mostly. (in a separate patch
> please)
Will do.
> Btw., pt_event_start() has weird error handling as well: it should
> probably return an error code, instead of open coding event->hw.state
> = PERF_HES_STOPPED. This would have to be changed in all PMU drivers,
> with core perf setting hw.state to PERF_HES_STOPPED or so?
The difference is that normal performance counters can't really fail to
start if their pmu::add() succeeded and afaict that such is also the
assumption in the perf core; aux counters, however, can run out of room
in the aux buffer. For most things tracking hw.state seems sufficient.
What I could do is have something like do_pt_event_start() that returns
-ENOSPC for the buffer-full condition and call it from both
pt_event_add() and pt_event_start(), which would both set hw.state to
HES_STOPPED if it fails. I'm not sure how much of a readability
improvement that is, I suspect that the same can be achieved by adding
appropriate comments to these functions. What do you think?
Thanks,
--
Alex
prev parent reply other threads:[~2015-04-17 15:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-16 10:38 [PATCH] perf/x86/intel/pt: Clean up error handling in pt_event_add() Ingo Molnar
2015-04-17 15:06 ` Alexander Shishkin [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=87lhhq7q1n.fsf@ashishki-desk.ger.corp.intel.com \
--to=alexander.shishkin@linux.intel.com \
--cc=kernel-janitors@vger.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