Linux PCI Non-Transparent Bridge framework and drivers
 help / color / mirror / Atom feed
From: "Allen Hubbe" <Allen.Hubbe@emc.com>
To: "Hubbe, Allen" <Allen.Hubbe@emc.com>,
	"'Jiang, Dave'" <dave.jiang@intel.com>
Cc: jdmason@kudzu.us, linux-ntb@googlegroups.com
Subject: RE: [PATCH v4] ntb: ntb perf tool
Date: Tue, 12 Jan 2016 10:59:48 -0500	[thread overview]
Message-ID: <002401d14d52$44057380$cc105a80$@emc.com> (raw)
In-Reply-To: <000001d14d4a$b145df00$13d19d00$@emc.com>

From: Allen Hubbe
> From: Jiang, Dave <dave.jiang@intel.com>
> > On Jan 12, 2016, at 7:08 AM, Hubbe, Allen <Allen.Hubbe@emc.com>
> > > From: Dave Jiang
> > >> Providing raw performance data via a tool that directly access data
> > from
> > >

> There might also be a race in link-up.  I got stuck with a lot of this,
> once, and no link related messages on the other side:
> [60025.597128] ntb_perf: ntb_hw_intel 0000:00:03.0: Remote version = 0x0
> [60025.607119] ntb_perf: ntb_hw_intel 0000:00:03.0: perf_link_work

I think the race has is between clearing local spads in link cleanup, and the peer writing the same spads in link work.

Suppose B is already loaded, and then A is loaded.
B: link was down - link cleanup - clear spads on B.

A: modprobe ntb_perf.
A: ntb_link_enable - tells the ntb hw to enable, but link up is async.
A: ntb_link_event - trigger a link event, even if there was no link state change.

Race #1: is the link up fast enough on A?
A: perf_link_event - link state is down, schedule link cleanup.

A & B: perf_link_event - link state is now up, schedule link work.

Race #2: A clears good data written by B, AND B reads good data written by A?
B: link work - write good data to spads on A, continue below...
A: link cleanup - clear spads on A (oops!).
B: link work continued - read spads on B have good data, work is done!

Result:
A: link work - write good data to spads on B, read spads on A are zero, reschedule... forever.

This would be a very short window to race, so there might be something else, too.  I don't recall seeing link work run on B at all, and I missed the opportunity to save that log.  Now it's lost among all the others in dmesg, and I can't distinguish "no output" from "maybe these messages" that far back in the log.  If a banner was printed each time the module is loaded, that would help.

In ntrdma, I avoid this race by /not/ clearing the local registers.  To avoid reading bad data, the peer updates a counter as long as the data is valid.  Observing a change in that counter value indicates good data.  That avoids a race between A and B each writing the same registers.

Allen


      reply	other threads:[~2016-01-12 16:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-11 23:33 [PATCH v4] ntb: ntb perf tool Dave Jiang
2016-01-12 14:07 ` Hubbe, Allen
2016-01-12 14:31   ` Jiang, Dave
2016-01-12 15:05     ` Allen Hubbe
2016-01-12 15:59       ` Allen Hubbe [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='002401d14d52$44057380$cc105a80$@emc.com' \
    --to=allen.hubbe@emc.com \
    --cc=dave.jiang@intel.com \
    --cc=jdmason@kudzu.us \
    --cc=linux-ntb@googlegroups.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