BPF List
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: Li Zhong <floridsleeves@gmail.com>,
	linux-perf-users@vger.kernel.org, bpf@vger.kernel.org,
	namhyung@kernel.org, jolsa@kernel.org,
	alexander.shishkin@linux.intel.com, mark.rutland@arm.com,
	acme@kernel.org, mingo@redhat.com
Subject: Re: [PATCH v2] kernel/events/core: check return value of task_function_call()
Date: Wed, 21 Sep 2022 10:10:00 +0200	[thread overview]
Message-ID: <YyrG2JL/hW5m7gSl@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <YyrBYE4iMvei/nNC@gmail.com>

On Wed, Sep 21, 2022 at 09:46:40AM +0200, Ingo Molnar wrote:
> 
> * Li Zhong <floridsleeves@gmail.com> wrote:
> 
> > From: lily <floridsleeves@gmail.com>
> > 
> > Check the return value of task_function_call(), which could be error
> > code when the execution fails. We log this on info level.
> > 
> > Signed-off-by: Li Zhong <floridsleeves@gmail.com>
> > ---
> >  kernel/events/core.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/kernel/events/core.c b/kernel/events/core.c
> > index 2621fd24ad26..3848631b009c 100644
> > --- a/kernel/events/core.c
> > +++ b/kernel/events/core.c
> > @@ -13520,7 +13520,10 @@ static void perf_cgroup_attach(struct cgroup_taskset *tset)
> >  	struct cgroup_subsys_state *css;
> >  
> >  	cgroup_taskset_for_each(task, css, tset)
> > -		task_function_call(task, __perf_cgroup_move, task);
> > +		if (!task_function_call(task, __perf_cgroup_move, task)) {
> > +			printk(KERN_INFO "perf: this process isn't running!\n");
> > +			continue;
> 
> If this is a 'should never happen' condition, then this should really be 
> WARN_ON_ONCE().
> 
> (If it can happen, then polluting the syslog is wrong.)

It can happen and is just fine. If this task_function_call() fails, it
means the context switch that made it fail ensured the new values have
been picked up.

      reply	other threads:[~2022-09-21  8:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-19 19:16 [PATCH v2] kernel/events/core: check return value of task_function_call() Li Zhong
2022-09-21  7:46 ` Ingo Molnar
2022-09-21  8:10   ` Peter Zijlstra [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=YyrG2JL/hW5m7gSl@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bpf@vger.kernel.org \
    --cc=floridsleeves@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@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