mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "fweisbec@gmail.com" <fweisbec@gmail.com>,
	"mingo@kernel.org" <mingo@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [BUG] perf: arch_perf_out_copy_user default
Date: Wed, 30 Oct 2013 19:29:27 +0000	[thread overview]
Message-ID: <20131030192927.GB27625@mudshark.cambridge.arm.com> (raw)
In-Reply-To: <20131030143750.GT19466@laptop.lan>

On Wed, Oct 30, 2013 at 02:37:50PM +0000, Peter Zijlstra wrote:
> Hi Frederic,

Hi Peter,

> I just spotted:
> 
> #ifndef arch_perf_out_copy_user
> #define arch_perf_out_copy_user __copy_from_user_inatomic
> #endif
> 
> vs:
> 
> arch/x86/include/asm/perf_event.h:#define arch_perf_out_copy_user copy_from_user_nmi
> 
> 
> Now the problem is that copy_from_user_nmi() and
> __copy_from_user_inatomic() have different return semantics.
> 
> Furthermore, the macro you use them in DEFINE_OUTPUT_COPY() assumes the
> return value is the amount of memory copied; as also illustrated by
> memcpy_common().
> 
> Trouble is, __copy_from_user_inatomic() returns the number of bytes
> _NOT_ copied.
> 
> With this, my question to Will is, how did your ARM unwind support
> patches ever work? AFAICT they end up using the
> __copy_from_user_inatomic() thing.

Yeah, that's weird, because they *do* appear to work! In fact, looking at
the code in kernel/events/core.c, it looks like __output_copy_user is
expected to return the number of bytes not copied, so providing the
__copy_from_user_inatomic succeeds first time around, the DEFINE_OUTPUT_COPY
macro will return len (dump_size) and the perf_output_skip will deal with
the buffer pointers for us. The issue then is that dynamic size will be 0,
and the unwind code in perf will never be called (except I know that it *is*
being called).

I'll go dig further...

Will

  parent reply	other threads:[~2013-10-30 19:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-30 14:37 Peter Zijlstra
2013-10-30 18:44 ` [PATCH] perf: Fix arch_perf_out_copy_user default implementation Peter Zijlstra
2013-10-30 19:29 ` Will Deacon [this message]
2013-10-30 19:35   ` [BUG] perf: arch_perf_out_copy_user default Peter Zijlstra
2013-10-30 19:50 ` Frederic Weisbecker
2013-10-30 20:16   ` Peter Zijlstra
2013-10-30 20:47     ` Frederic Weisbecker
2013-10-30 22:31     ` Will Deacon
2013-11-06 13:19     ` [tip:perf/core] perf: Fix " tip-bot for Peter Zijlstra

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=20131030192927.GB27625@mudshark.cambridge.arm.com \
    --to=will.deacon@arm.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.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

all inboxes | Powered by JetHome®