public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Leonid Ravich <leonid.ravich@toganetworks.com>
Cc: "linux-trace-kernel@vger.kernel.org" 
	<IMCEAMAILTO-linux-trace-kernel+40vger+2Ekernel+2Eorg@eurprd02.prod.outlook.com>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Yigal Korman <yigal.korman@toganetworks.com>
Subject: Re: BUG:  ib_mad ftrace event unsupported migration
Date: Wed, 2 Nov 2022 07:44:57 -0400	[thread overview]
Message-ID: <20221102074457.08f538a8@rorschach.local.home> (raw)
In-Reply-To: <VI1PR02MB623706DA8A01842834FC191089399@VI1PR02MB6237.eurprd02.prod.outlook.com>

On Wed, 2 Nov 2022 10:49:26 +0000
Leonid Ravich <leonid.ravich@toganetworks.com> wrote:

> after investigation  looks like there is a broken assumption of rb_end_commit and rb_start_commit are on same CPU (no migration) during trace 
> looking in ib_mad trace  in include/trace/events/ib_mad.h there is a call to create_mad_addr_info during  TP assign which sleeps (at least under mlx5 ib driver)

Wait, WHAT?

> 
> so the scenario looks :
> 
> rb_start_commit - buffer 0xffffa0984777e400  CPU 1 pid 1368
> switch from 1368 to 1605
> thread 1368 () is migrating from 1 to 0
> rb_end_commit - buffer 0xffffa09847c14a00  CPU 0 pid 1368

That's a MAJOR bug with the use case of tracepoints!

> 
> before starting throwing some patch into the the air  I would like to align with you the approach we should take here. 
> 
> my suggestion here : 
> - ftrace infra should verify no migration happen  (end and start happens on same CPU)  in case not we will  throw warning for the issue  .

The scheduler should have. On entering the ring buffer code
ring_buffer_lock_reserver() it disables preemption and does not
re-enable it until ring_buffer_unlock_commit().

The only way to migrate is if you re-enable preemption. WHICH IS A BUG!

> - ftrace users will be responsible to avoid migration during TP assign (RDMA in my case)

Yes, it is responsible to do that. Just like it's up to users of
spin_locks to not enable preemption and migrate while holding one.
Entering the ring buffer code is the same as holding a spin_lock except
that the ring buffer code allows for reentrancy.

> 
> please let me know what do you think 

I think that whatever enabled preemption in the ib_mad trace event
needs to be fixed.

-- Steve

  reply	other threads:[~2022-11-02 11:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02 10:49 BUG: ib_mad ftrace event unsupported migration Leonid Ravich
2022-11-02 11:44 ` Steven Rostedt [this message]
2022-11-02 13:02   ` Jason Gunthorpe
2022-11-02 14:02     ` Leonid Ravich
2022-11-02 14:04       ` Jason Gunthorpe
2022-11-02 14:17         ` Steven Rostedt
2022-11-02 14:24           ` Jason Gunthorpe
2022-11-02 15:59             ` Steven Rostedt
2022-11-02 16:01               ` Jason Gunthorpe
2022-11-02 20:01               ` Leonid Ravich
2022-11-02 22:19                 ` Steven Rostedt
2022-11-03 12:22                   ` Leonid Ravich
2022-11-03 16:32                     ` Steven Rostedt
2022-11-02 14:20       ` Steven Rostedt

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=20221102074457.08f538a8@rorschach.local.home \
    --to=rostedt@goodmis.org \
    --cc=IMCEAMAILTO-linux-trace-kernel+40vger+2Ekernel+2Eorg@eurprd02.prod.outlook.com \
    --cc=leonid.ravich@toganetworks.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=yigal.korman@toganetworks.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