mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: vatsa@in.ibm.com, Arnaldo Carvalho de Melo <acme@redhat.com>,
	Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org, Mike Galbraith <efault@gmx.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Corey Ashford <cjashfor@linux.vnet.ibm.com>,
	Oleg Nesterov <oleg@redhat.com>
Subject: Re: perf counter issue - WARN_ON_ONCE(!list_empty(&tsk->perf_counter_ctx.counter_list));
Date: Mon, 18 May 2009 14:45:27 +1000	[thread overview]
Message-ID: <18960.59367.956231.752086@drongo.ozlabs.ibm.com> (raw)
In-Reply-To: <1242419228.32543.360.camel@laptop>

Peter Zijlstra writes:

> OK, so the cleanup isn't solid.. I've been poking at things, and below
> is the current state of my tinkering, but it seems to make things
> worse...
> 
> With only the callback in do_exit() the above test works but hackbench
> fails, with only the call in wait_task_zombie() hackbench works and the
> above fails.
> 
> With both, we segfault the kernel on a list op on either :-)

I don't know if this is the problem, but I have noticed a basic
lifetime issue: a counter on a task points to a context which is
embedded in the task_struct of the task being counted, but the counter
might outlive the task.  For example, task A puts a counter on task B,
task B dies and is reaped by its parent, but the counter still exists
because task A hasn't closed its fd.  When task A does close the fd,
perf_release will call perf_counter_remove_from_context which will go
and use counter->ctx, but that is in B's task struct, which has gone
away.

I want to change the task struct to have just a pointer to the context
rather than the context struct itself for other reasons (it will make
it much easier to implement lazy PMU switching).  If we do that we
could refcount the context and solve the lifetime issue that way.  I'm
working on a patch; hopefully I'll have more to report later today.

Paul.

  reply	other threads:[~2009-05-18  5:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-13 16:54 Srivatsa Vaddagiri
2009-05-13 16:57 ` Srivatsa Vaddagiri
2009-05-15 13:56   ` Ingo Molnar
2009-05-15 14:51     ` Arnaldo Carvalho de Melo
2009-05-15 15:58       ` Srivatsa Vaddagiri
2009-05-15 16:13         ` Peter Zijlstra
2009-05-15 17:37           ` Peter Zijlstra
2009-05-15 20:27             ` Peter Zijlstra
2009-05-18  4:45               ` Paul Mackerras [this message]
2009-05-22  6:25               ` Srivatsa Vaddagiri

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=18960.59367.956231.752086@drongo.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --cc=acme@redhat.com \
    --cc=cjashfor@linux.vnet.ibm.com \
    --cc=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=vatsa@in.ibm.com \
    /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®