All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org, jolsa@redhat.com,
	Mansour Alharthi <malharthi9@gatech.edu>,
	acme@kernel.org
Subject: Re: [PATCH v0 1/2] perf: Copy parent's address filter offsets on clone
Date: Fri, 15 Feb 2019 16:10:38 -0200	[thread overview]
Message-ID: <20190215181038.GK5784@redhat.com> (raw)
In-Reply-To: <20190215115655.63469-2-alexander.shishkin@linux.intel.com>

Em Fri, Feb 15, 2019 at 01:56:54PM +0200, Alexander Shishkin escreveu:
> When a child event is allocated in the inherit_event() path, the VMA
> based filter offsets are not copied from the parent, even though the
> address space mapping of the new task remains the same, which leads
> to no trace for the new task until exec.

Peter, I'm processing this one, ok? Ack?

- Arnaldo
 
> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Fixes: 375637bc5249 ("perf/core: Introduce address range filtering")
> Reported-by: Mansour Alharthi <malharthi9@gatech.edu>
> ---
>  kernel/events/core.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 5aeb4c74fb99..2d89efc0a3e0 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -1255,6 +1255,7 @@ static void put_ctx(struct perf_event_context *ctx)
>   *	      perf_event_context::lock
>   *	    perf_event::mmap_mutex
>   *	    mmap_sem
> + *	      perf_addr_filters_head::lock
>   *
>   *    cpu_hotplug_lock
>   *      pmus_lock
> @@ -10312,6 +10313,20 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu,
>  			goto err_per_task;
>  		}
>  
> +		/*
> +		 * Clone the parent's vma offsets: they are valid until exec()
> +		 * even if the mm is not shared with the parent.
> +		 */
> +		if (event->parent) {
> +			struct perf_addr_filters_head *ifh = perf_event_addr_filters(event);
> +
> +			raw_spin_lock_irq(&ifh->lock);
> +			memcpy(event->addr_filters_offs,
> +			       event->parent->addr_filters_offs,
> +			       pmu->nr_addr_filters * sizeof(unsigned long));
> +			raw_spin_unlock_irq(&ifh->lock);
> +		}
> +
>  		/* force hw sync on the address filters */
>  		event->addr_filters_gen = 1;
>  	}
> -- 
> 2.20.1

  reply	other threads:[~2019-02-15 18:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-15 11:56 [PATCH v0 0/2] perf: Address range filtering fixes Alexander Shishkin
2019-02-15 11:56 ` [PATCH v0 1/2] perf: Copy parent's address filter offsets on clone Alexander Shishkin
2019-02-15 18:10   ` Arnaldo Carvalho de Melo [this message]
2019-02-22 12:56     ` Alexander Shishkin
2019-02-22 14:54       ` Arnaldo Carvalho de Melo
2019-02-28  7:57   ` [tip:perf/core] " tip-bot for Alexander Shishkin
2019-02-15 11:56 ` [PATCH v0 2/2] perf, pt, coresight: Fix address filters for vmas with non-zero offset Alexander Shishkin
2019-02-15 14:54   ` Arnaldo Carvalho de Melo
2019-02-15 17:38     ` Mathieu Poirier
2019-02-28  7:58   ` [tip:perf/core] " tip-bot for 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=20190215181038.GK5784@redhat.com \
    --to=acme@redhat.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=malharthi9@gatech.edu \
    --cc=mingo@redhat.com \
    --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 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.