Commit Graph

18835 Commits

Author SHA1 Message Date
Kozlowski Mateusz
b5e2c59ad6 FTL: Add fast shutdown path
Adds the ability to persist only the most important metadata. The rest
is stored in shared memory.

Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Change-Id: I4084c04ba09115a7a08ff66fd33552a2ec60d801
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13360
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2022-09-02 17:40:09 +00:00
Kozlowski Mateusz
ef93cc38ee FTL: Persist metadata on clean shutdown
Add an extra step during FTL shutdown to save all metadata.

Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Change-Id: Idc2f77e15bbd02028548cc88355cd450175830e8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13359
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2022-09-02 17:40:09 +00:00
Kozlowski Mateusz
b4b70e8303 FTL: Make L2P caching default mode
Flat L2P (all L2P in memory) needs to be specifically built against, due
to large memory consumption for big devices.

Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Change-Id: Ib8906e10868455f88725b69b2b033b70a9f7256c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13358
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2022-09-02 17:40:09 +00:00
Kozlowski Mateusz
94b7f8d82d FTL: Add L2P cache eviction logic
Adds eviction of least recently used pages from the L2P cache - dirty
pages will be persisted.

Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Change-Id: Ic646f7e9da777d077b5cb9b409c3f03ef05b1273
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13357
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2022-09-02 17:40:09 +00:00
Kozlowski Mateusz
73f9b4f5fe FTL: L2P cache page in logic
Adds paging in from the cache device to memory.

Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Change-Id: I250009d12e9ed5ad52ee861ec5157cf983cf8cfc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13356
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2022-09-02 17:40:09 +00:00
Kozlowski Mateusz
905fbf946c ftl: Add L2P cache pin/unpin logic
There is a set amount of pinned pages available. If exceeded they will be deferred
and processed in the future, using eviction logic.

Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Change-Id: Ic642a5870db009ccf57152dd8a4178a6b2098ee1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13355
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2022-09-02 17:40:09 +00:00
Kozlowski Mateusz
db65602a39 FTL: Add l2p cache get/set logic
This commit also introduces ranking pages, based on usage for determining the least used
page to be evicted.

Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Change-Id: Iaf3812177b61376bb38aa209e4ba8576d784ffb5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13354
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2022-09-02 17:40:09 +00:00
Kozlowski Mateusz
e7e5bc07b2 FTL: Add initial L2P cache logic
L2P cache allows for partial storing of L2P in memory, paging in and out
as necessary, lowering the total memory consumption.

Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Change-Id: I727fec9d2f0ade4ca73e872d62a2ec10cfdb0a88
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13353
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2022-09-02 17:40:09 +00:00
Jim Harris
01cec2499f vhost: add start_session
vhost_blk_start and vhost_scsi_start are now just
a single vhost_user_session_send_event() call, so
make this more generic by adding a top-level
start_session function.

Now this function will do the
vhost_user_session_send_event(), using the
user_dev_backend's start_session function pointer.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ia89ba15011e231f0474405fb7225e713dcc920bf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14327
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2022-09-02 07:32:54 +00:00
Jim Harris
f8df19a49f vhost: assign svdev from spdk thread context
Currently scsi sets it's svdev from the vhost
thread context, while blk does it from the
spdk thread context.

Make scsi match what blk does, to make the code
more consistent.  This also will allow for an
upcoming simplification.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I609513bc8e05b49dd9455f2f61ba0cedc35236e6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14326
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2022-09-02 07:32:54 +00:00
tongkunkun
bb432b4eea json: fix parsing json problems when json config is invalid.
Add parsing json as invalid cases:
1.json content that not enclosed in {}, it should be parsed as invalid, e.g.

"abc":"not encloesed in {}"

2.json content that 'subsystems' not associate with array, it will report error and return failure, e.g.

{"subsystems":"123"}

3.handle other invalid json formats, report and return failure, e.g. duplicate keys.

Added `spdk_json_find` API return errcode: EPROTOTYPE - json not enclosed in {}.

json config with content:
1."not enclosed in {}"
2."'subsystems' not be an array"
3."duplicate key in json"
and some other invaild cases will be regarded as invalid json config, and will fail to start app.

Fixes #2599

Signed-off-by: tongkunkun <tongkunkun_yewu@cmss.chinamobile.com>
Change-Id: I02574c9acd7671e336d4c589ebbff8ed21eb3681
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13754
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2022-09-02 07:32:21 +00:00
Aleksey Marchuk
19518dfb47 configure: Don't build ipsec-mb on aarch
This library can't be compiled on aarch, so disable it

Signed-off-by: Aleksey Marchuk <alexeymar@nvidia.com>
Change-Id: I3a8ab2f8d95c122b45f6211a1ce4916389728476
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14288
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2022-09-02 07:31:46 +00:00
Jacek Kalwas
e9438453d4 build: explicitly clear pkg-config sysroot env
depending on building environment "pkg-config --variable=libdir"
might return absolute path (including sysroot dir) or relative path

this has implication for readlink just below which concatenate strings
including sysroot dir, if sysroot dir occurs in both vars then
readlink will fail and configuration will be terminated

it seems like a grey area of pkg-config documentaion, the behavior is
not well defined and consistent across pkg-config versions

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Signed-off-by: Lei Li <lei.l.li@intel.com>
Change-Id: I3ab459632ff656b40f87c42cc7b1527982a33545
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14294
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2022-09-02 07:31:28 +00:00
Jim Harris
8216e70a14 Revert "test/vhost/initiator: Don't use spdk_tgt to generate json config"
This reverts commit 0c30154eb5.

Make a change in the revert to pre-allocate 1GB of memory for the
spdk_tgt initiator process, which is required for the virtio
initiator.

Fixes issue #2596.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Id594fa1ccb2daf535b1aaaef0a397bda2ec98579
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13828
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2022-09-01 18:30:56 +00:00
Krzysztof Karas
c527d09f30 hotplug: add new software hotplug test
Add a new test to sw_hotplug.sh based on SPDK target
in addition to examples/hotplug application.

Change-Id: I352ee4dfe934fa88082101bb92c6db41da10c10c
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10088
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2022-09-01 11:15:03 +00:00
Krzysztof Karas
eaebf84102 autotest_common.sh: change rpc_py to rpc_cmd
Change rpc_py to use rpc_cmd function.
The former needs to be defined explicitly in the scripts
that uses function, while the latter is a function
already available in autotest_common.sh.
Additionally delete unnecessary rpc_py declarations
and override rpc_cmd where additional arguments are
needed (like -s sock_name.sock).

Change-Id: I835f7eb308cd77658a2a425e153ab7ca460b5b61
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12872
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2022-09-01 11:15:03 +00:00
Konrad Sztyber
4cbd23e28b vmd: method for forcing a rescan
Added a new RPC, vmd_rescan, that forces the VMD driver to do a rescan
of all devices behind the VMD.  A device that was previously removed via
spdk_vmd_remove_device() will be found again during vmd_rescan.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ide87eb44c1d6d524234820dc07c78ba5b8bcd3ad
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13958
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2022-09-01 08:48:32 +00:00
Konrad Sztyber
052ea0baac vmd: method for removing devices behind VMD
Added new RPC, vmd_remove_device, that allows users to remove a PCI
device managed by the VMD library simulating a hot-remove.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ifb84818ce8d147d1d586b52590527e85fe9c10de
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13957
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
2022-09-01 08:48:32 +00:00
Konrad Sztyber
9a9aed4e7b env/pci: use TAILQ_FOREACH_SAFE in pci_foreach_device()
It'll make it possible to remove a PCI device from within the callback.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I4cea2207a29bb145aee968715e873076a8c0993c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13956
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
2022-09-01 08:48:32 +00:00
Konrad Sztyber
4c482a623b vmd: don't create new buses in hotplug
This doesn't work anyway and can cause creating duplicate bus objects if
vmd_scan_single_bus() is called on a parent bus with previously
allocated child buses.  Also, while here, removed a few unused functions
and flags in struct vmd_adapter.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ic757070188157d9851f648acd074ca4943a14c39
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13955
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
2022-09-01 08:48:32 +00:00
Konrad Sztyber
ee1ab6f6be vmd: increment dev_cnt once device is initialized
This is done in order to avoid having to decrement this counter in case
of a failure.  Also, it makes the result valid for the few error cases
when we didn't decrement it.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ia944fb8b810ce69caa8db5bc7c941e0905c9d3bd
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13954
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
2022-09-01 08:48:32 +00:00
Konrad Sztyber
f0441b29db vmd: rename enable_vmd RPC to vmd_enable
The new name is consistent with the naming scheme of
<subsystem>_<action> that all of our other RPCs use.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I2cae7af5715add8eba26501cd192a6ac4884ec69
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13952
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2022-09-01 08:48:32 +00:00
Konrad Sztyber
dc5b33d982 module/vmd: move subsystem start to ->init()
This makes sure that if the app is killed before the subsystems have
been initialized (i.e. before framework_start_init is called), we don't
leak resources.  Before this change, we initialized the VMD library and
registered the hotplug poller from the context of the RPC and we only
freed it in subsystem's fini().  However, if subsystems were never
initialized, we never freed them.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I56b746c46b94135ef56a478c5f80194ebe51a942
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13951
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
2022-09-01 08:48:32 +00:00
Konrad Sztyber
55bdd88506 env/pci: add detach() callback to pci_device_provider
This makes it possible to notify other PCI device providers (VMD) that a
PCI device is no longer used.  The VMD will driver will unhook that
device and free any resources tied to it.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I42752afbb371a1d33972dac50fd679f68d05b597
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13887
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
2022-09-01 08:48:32 +00:00
Konrad Sztyber
690eebb447 vmd: extract removing devices to separate function
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Idc9c7d0e5d0ebce8278e089bcfe5b7f76b86c270
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13953
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2022-09-01 08:48:32 +00:00
Konrad Sztyber
ffa9953a14 vmd: add attach_device()
This patch implements the callback for attaching devices behind the VMD
with a given PCI address.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I07cf92c94cc7e6d3c8e31af7a8615e9a4ca641bf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13886
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
2022-09-01 08:48:32 +00:00
Konrad Sztyber
3b2097f313 vmd: use vmd_container.count when iterating over domains
It makes it possible to call this function even if the VMD library
wasn't initialized.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I3d0f4677c4a1189f9d8acf07baee50a4e2050459
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14260
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
2022-09-01 08:48:32 +00:00
Konrad Sztyber
4b08c07a62 env/pci: call driver callback in pci_hook_device
Now that we have a attach_device() callback, the devices can be hooked
during spdk_pci_device_attach().  With DPDK, driver->cb_fn() is called
in pci_device_init(), so we need to do the same in
spdk_pci_hook_device().

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Iada8b83ce7592aa62561530192072a50ec3a904b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13884
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2022-09-01 08:48:32 +00:00
Konrad Sztyber
ac8b65bdd2 vmd: extract freeing device resources to vmd_dev_free
This allows to free resources tied to a vmd_pci_device that isn't on the
dev_list or wasn't hooked to the PCI driver.  Also, use that function
whenever a vmd_pci_device is freed instead of regular free().

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ifca177a7eb6d8180d6f2ee2a9d9e36d58810e8ad
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14259
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2022-09-01 08:48:32 +00:00
Konrad Sztyber
3f4e968dab vmd: add device to dev_list after initialization is complete
That way, we don't have to do TAILQ_REMOVE if vmd_assign_base_addrs()
fails.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Id7a5df2093e4f9dfc95ee1fe415eb644c61bc971
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14258
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2022-09-01 08:48:32 +00:00
Konrad Sztyber
35f8bd2a13 vmd: move pci_hook_device to vmd_dev_init_end_device
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I79c35600fc9a758bbd9d58393b7eb98c8ac82acc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14257
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2022-09-01 08:48:32 +00:00
Konrad Sztyber
2dfd36772f vmd: extract end device initialization
It'll make it easier to reuse this part of the code.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Id26f3f00abeeea6205df4f44689ffab1d367d777
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13885
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2022-09-01 08:48:32 +00:00
Konrad Sztyber
b20f3678dd env/pci: method for registering PCI device providers
The primary motivation for this patch is to allow the VMD driver to be
notified of when users wants to attach a device under a given BDF and to
make it more similar to the regular PCI path.  Currently, the way the
VMD driver scans for the devices is a little bit different.  The initial
scan is done during initialization and there's a separate poller for
checking hotplugs. Also, there's no device_attach() interface, so with
hotplug poller disabled, it isn't possible to attach to a device not
present in the initial scan, even if the BDF is known.

This causes a few issues.  First of all, the VMD library isn't notified
when a device is stopped being used (i.e. user calls
spdk_pci_device_detach()), so when such a device is hotremoved, it never
gets unhooked.  But we cannot simply add a spdk_pci_device.detach()
callback, as this would break cases when user detaches a device (without
hotremove) and then tries to reattach it again (via
spdk_pci_device_attach()), as the VMD doesn't get notified about the
device_attach() call.

So, in order to resolve this, a device_attach() callback is added, which
will notify the VMD library that the user wants to attach a device under
a specific PCI address.  Then, in subsequent patches, a
spdk_pci_device_provider.detach_cb() callback is added to make sure that
devices are unhooked once they're no longer used.

Once that is done, it'll be also possible to get rid of the VMD hotplug
poller by adding something like scan_cb() to spdk_pci_device_provider and
call it from spdk_pci_enumerate().

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I084a27dcd12455f0f841440b7692375e80d07e84
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13883
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2022-09-01 08:48:32 +00:00
Jim Harris
b90d7b5b43 nvme: add admin queue size quirk for Hyper-V
Hyper-V NVMe SSD controllers require admin queue
size to be even multiples of a page. Add quirk to
adjust the admin queue size if user overrides the
default value to something other than an even
multiple.

As part of this change, set the quirks earlier
when constructing a pcie controller, so that the
quirks value can be used in the generic
nvme_ctrlr_construct() function.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I417cd3cdc7e3ba512ec412f4876b0e0b7432341c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14220
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2022-09-01 08:31:46 +00:00
yidong0635
0447dca450 include: Remove the last line break.
The last line doesn't need the line break, otherwise
it will wrongly include the next line.

Signed-off-by: yidong0635 <dongx.yi@intel.com>
Change-Id: I06257b18d25c060b7c6bb00853fa44963fe5b439
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14241
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
2022-09-01 08:30:24 +00:00
Pawel Piatek
d21dc1501f scripts/vagrant: add support for FreeBSD 13
Signed-off-by: Pawel Piatek <pawelx.piatek@intel.com>
Change-Id: I719df0334dc786418e9eee05390c03f5f0b99434
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13622
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Michal Berger <michal.berger@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
2022-09-01 08:28:20 +00:00
Richael Zhuang
8c4f6f49fe perf: allow to set zerocopy_threshold
add --zerocopy_threshold option to allow data sent with or without
MSG_ZEROCOPY flag according to data size in perf test. This option
can be set when specifying --zerocopy-threshold-sock-impl impl.

Change-Id: Ic187aadba38287bc8f2f082319e26881a13a6766
Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12814
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
2022-09-01 08:27:01 +00:00
yidong0635
b813f998ea nvme_pcie_common: Move group right before using.
Better not to cache a value especially for there's an error return.

Signed-off-by: yidong0635 <dongx.yi@intel.com>
Change-Id: I3b243a66f4db9af34bc2ea01bafdac33004be128
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13650
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2022-09-01 08:26:34 +00:00
Jonathan Davies
510f4c134a Make libvfio-user build reliable on ninja < 1.9
Sadly, before v1.9.0, ninja used per-second granularity timestamps.
This had the unfortunate consequence that a "meson configure"
immediately following a "meson setup" would not be picked up by ninja,
thinking that no regeneration of the build config was needed during
"meson compile". See https://github.com/mesonbuild/meson/issues/3992 for
background and general dismay.

This means that VFIO_USER_CFG_OPTS are ignored 50% of the time,
depending on the wall clock. Unlucky builds would therefore end up with
libvfio-user being built as a shared object (rather than a static
archive) and for installation in /usr/local/lib64 (rather than
/usr/local/lib, as per VFIO_USER_LIB_PREFIX).

This is worked around by injecting a sleep between "meson setup" and
"meson configure" when ninja < 1.9 is in use.

Note that ninja v1.8.2 ships in el8, so suffers from this problem.

Signed-off-by: Jonathan Davies <jonathan.davies@nutanix.com>
Change-Id: I4d555dcc5bc63df4475ec6fd6014e3502123e92b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14236
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: John Levon <levon@movementarian.org>
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2022-09-01 08:26:11 +00:00
Michal Berger
51a8f16e72 test/vhost: Fix parse_fio_results() for a single client
Signed-off-by: Michal Berger <michal.berger@intel.com>
Change-Id: I5aa53d0d06564030a3dbae8a8aa5c6179e972980
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13713
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
2022-09-01 08:25:55 +00:00
Michal Berger
c1cb6b0d4f perf/vhost: Skip comments in disk map files
Signed-off-by: Michal Berger <michal.berger@intel.com>
Change-Id: Ibb713d5a597c83730cc81f8ab2d7a16334407ff8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13740
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
2022-09-01 08:25:55 +00:00
Michal Berger
fb41398ae7 test/vhost: Replace error() with simple echo
In this particular case, error() is called before it's declared,
hence bash complains that it's missing, failing to print out the
actual error message.

To not shuffle code around, simply replace this call with an echo
to stderr.

Signed-off-by: Michal Berger <michallinuxstuff@gmail.com>
Change-Id: I6f0a6e5b0dfd6893aee6a66e6efdb9874245fafb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12427
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
2022-09-01 08:25:55 +00:00
Shuhei Matsumoto
03f8da8819 bdev/nvme: Set multipath policy correctly when creating nvme_bdev_channel
bdev_nvme_create_bdev_channel_cb() did not initialized the multipath
policy of the newly created channel. 0 was active-passive and hence
multipath policy was always initialized to active-passive.

Fix the bug and add unit tests for verification.

Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: I6e44108740da4b9ff72311ae4b5500558c65c5c3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14225
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
2022-09-01 08:25:22 +00:00
Shuhei Matsumoto
db75f4b678 bdev/nvme: Remove admin passthrough retry and failover
Admin passthrough supported retry and failover as same as I/O by
using the bdev_retry_count. However, doing retry or failover for
admin passthrough may have unexpected side effects and its value
is not clear. The safest way is to limit retry and failover for I/O.
If we need to support retry and failover for admin passthrough,
restore the code and add a new option bdev_admin_retry_count.

Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: I680513a40a80041f6ea6f546c74c672f2a81812d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14227
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2022-09-01 08:25:22 +00:00
Shuhei Matsumoto
fc912a0284 bdev/nvme: Prioritize aborted_by_request higher than ctrlr_is_unavailable
Abort is used usually for error cases. When abort is done, controller
may not be available. At completion, controller availability was checked
prior to aborted by request. Hence if abort is done when controller is
not available, the aborted request is retried.

Fix the case in this patch.

Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: I3e7b356797dd50faed0e5113f6f7a47fea26d9cc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14098
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2022-09-01 08:25:22 +00:00
Jim Harris
3d59045a2a nvme: remove incorrect comment about spdk_nvme_ctrlr structs
This was correct back when we only supported PCIe, but doesn't
in the newfangled world of fabrics and vfio-user.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I565edd2dab1eff862844585df8c25da508e4816d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14136
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
Reviewed-by: Jacek Kalwas <jacek.kalwas@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
2022-08-30 16:20:23 +00:00
Artur Paszkiewicz
8fad5718e1 ftl: validate band metadata in debug mode
Adds a debug function, that scans the whole P2L of band, when
it's getting closed. The P2L is compared against both L2P and
valid map to check for any discrepancies.

Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
Change-Id: Ia4d7be65415e6af3752d676de69b6fdcb73effb4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13352
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2022-08-30 14:48:50 +00:00
Artur Paszkiewicz
57cfab6808 ftl: use valid map to optimize compaction and reloc
Utilize the valid map when picking physical blocks to compact/relocate,
speeding up the process.

Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
Change-Id: I860e3cf25a5907591e4f3043def67156fec8b0df
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13351
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2022-08-30 14:48:50 +00:00
Artur Paszkiewicz
cea8dadecf ftl: valid map
Adds P2L validity map tracking - a bitmap marking all physical LBAs
as containing valid (current) user data or not. A clear bit denotes
the location has no valid data and may be skipped during relocation
or compaction. A set bit means it may have valid data (it's still
necessary to do the necessary comparision against L2P).

Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
Change-Id: I6a831a97b3080eb7c880d9c4feab41b523467885
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13350
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2022-08-30 14:48:50 +00:00
Artur Paszkiewicz
1e904e2b75 ftl: fast startup
Adding API for the bringup part of fast shutdown/startup. Adds
shared memory utilization for necessary functions during initialization.

Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
Change-Id: Iab2da102fd0ccaa56fbdb9b3c765be5eeefff145
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13349
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2022-08-30 14:48:50 +00:00