Page MenuHomeFreeBSD

nvme: Don't active memory space until all BARs are configured
Needs ReviewPublic

Authored by ziaee on Thu, Feb 26, 7:47 PM.
Tags
None
Referenced Files
F146093480: D55541.diff
Fri, Feb 27, 6:23 PM
F146087415: D55541.diff
Fri, Feb 27, 5:07 PM
F146081453: D55541.id.diff
Fri, Feb 27, 3:51 PM
F146077514: D55541.id172789.diff
Fri, Feb 27, 2:59 PM
F146065423: D55541.id172789.diff
Fri, Feb 27, 12:22 PM
F146065316: D55541.id.diff
Fri, Feb 27, 12:20 PM

Details

Summary

In the current current behavior the 2nd and 3rd BARs can be activated
when they're configured with address zero. This change defers the
activation of all BARs until after they've all been configured with an
address.

Proxying on behalf of Matt Delco <delco@google.com>, I don't know if
phabricator will mangle the author. Tested by NetApp, I think this fixes
a bug where their FreeBSD based OS is crashing on GCE.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 71079
Build 67962: arc lint + arc unit

Event Timeline

ziaee requested review of this revision.Thu, Feb 26, 7:47 PM

This looks OK to me, but I defer to Warner.

This will work as is, but I have a couple of comments to make it a bit better.

sys/dev/nvme/nvme_pci.c
155

These need to be bool.

243

The tag/handle doesn't change when we activate the resource, so these lines don't need to move, imho.

ziaee added a subscriber: fuz.

attempt to convert to bool, thanks @fuz

cperciva added inline comments.
sys/dev/nvme/nvme_pci.c
153

You lost the opening { somehow.

jrtc27 added inline comments.
sys/dev/nvme/nvme_pci.c
212

Given bus_activate_resource returns an error code it might be nice to print it?

215

Is there a reason to use these bools? Won't the bool be true if and only if the corresponding resource member of ctrlr is non-NULL?

restore missing brace, thanks @cperciva!

finish converting to bool

I think @jrtc27 is right about the observation that we don't need the bools.

kevans added inline comments.
sys/dev/nvme/nvme_pci.c
34

This doesn't need to be here, sys/param.h includes sys/types.h (see style(9)) -- it would have been sorted higher if it was necessary, though

attempt to restore ints

That's not what we meant by "don't need the bools"; rather you can instead check e.g. ctrlr->msix_table_resource != NULL instead of activate_msi_bar.