Re: [libvirt PATCH 2/3] docs: virtiofs: add section about externally-launched virtiofsd

2021-04-22 Thread Jonathon Jongsma
On Thu, 22 Apr 2021 13:40:53 +0200 Ján Tomko wrote: > Provide an exmple in a place more visible than formatdomain.html. > > Signed-off-by: Ján Tomko > --- > docs/kbase/virtiofs.rst | 14 ++ > 1 file changed, 14 insertions(+) > > diff --git a/docs/kbase/virtiofs.rst

[libvirt PATCH v2 1/3] nodedev: fix potential leak of command

2021-04-21 Thread Jonathon Jongsma
When returning early due to errors, cmd will be leaked. Use an autoptr to handle these early returns without leaking memory. Signed-off-by: Jonathon Jongsma Reviewed-by: Michal Privoznik --- src/node_device/node_device_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff

[libvirt PATCH v2 2/3] nodedev: handle failure to generate mdevctl cmd

2021-04-21 Thread Jonathon Jongsma
Coverity complained that the 'default' case of the switch in nodeDeviceGetMdevctlCommand() was falling through without initializing 'cmd'. Return NULL in this case even though it should never happen. Signed-off-by: Jonathon Jongsma Reviewed-by: Michal Privoznik --- src/node_device

[libvirt PATCH v2 3/3] nodedev: remove unnecessary checks for NULL cmd

2021-04-21 Thread Jonathon Jongsma
virCommandRun() already handles the case where the cmd argument is NULL, so there's no need for the caller to check. Make all callers consistent and remove unnecessary NULL checks. Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 6 -- 1 file changed, 6 deletions

[libvirt PATCH 2/2] nodedev: handle failure to generate mdevctl cmd

2021-04-20 Thread Jonathon Jongsma
handled it, but some didn't. Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c index e565cc29ec..c1fe9db149 100644

[libvirt PATCH 1/2] nodedev: fix potential leak of command

2021-04-20 Thread Jonathon Jongsma
When returning early due to errors, cmd will be leaked. Use an autoptr to handle these early returns without leaking memory. Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node_device

Re: Feature proposal: Add page-per-vq flag to the 'driver' element of virtio devices

2021-04-19 Thread Jonathon Jongsma
On Mon, 19 Apr 2021 14:16:59 +0200 Michal Privoznik wrote: > On 4/18/21 10:08 AM, Gavi Teitz wrote: > > Hi, > > > > The page-per-vq flag is important for vdpa with vhost-user > > performance [1]. > > > > Currently there is no way in libvirt to set it in the xml > > page-per-vq except with qemu

[libvirt PATCH v2 2/3] nodedev: refactor virMediatedDeviceGetIOMMUGroupNum()

2021-04-14 Thread Jonathon Jongsma
for *GroupNum(). Reverse the implementations and make *GroupDev() call *GroupNum(). Signed-off-by: Jonathon Jongsma Reviewed-by: Laine Stump --- src/util/virmdev.c | 38 +- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/src/util/virmdev.c b/src

[libvirt PATCH v2 1/3] qemu: remove unnecessary null check

2021-04-14 Thread Jonathon Jongsma
virMediatedDeviceGetSysfsPath() (via g_strdup_printf()) is guaranteed to return a non-NULL value, so remove the unnecessary checks for NULL. Signed-off-by: Jonathon Jongsma Reviewed-by: Laine Stump --- Changes in v2: - remove NULL checks from 2 additional locations src/qemu/qemu_command.c

[libvirt PATCH v2 3/3] nodedev: handle null return from GetIOMMUGroupDev()

2021-04-14 Thread Jonathon Jongsma
Coverity reported that this function can return NULL, so it should be handled properly. Signed-off-by: Jonathon Jongsma --- Changes in v2: - remove virReportError() to avoid error-stacking per review from Erik src/node_device/node_device_driver.c | 7 ++- 1 file changed, 6 insertions

Re: [libvirt PATCH v2 06/12] nodedev: driver: Introduce internal mdevctl commands enum

2021-04-14 Thread Jonathon Jongsma
On Wed, 14 Apr 2021 12:41:02 +0200 Erik Skultety wrote: > On Tue, Apr 13, 2021 at 03:39:42PM -0500, Jonathon Jongsma wrote: > > From: Erik Skultety > > > > This is not a 1:1 mapping to mdevctl because mdevctl doesn't > > support a 'create' command. It use

[libvirt PATCH 3/3] nodedev: handle null return from GetIOMMUGroupDev()

2021-04-13 Thread Jonathon Jongsma
Coverity reported that this function can return NULL, so it should be handled properly. Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/node_device/node_device_driver.c b/src

[libvirt PATCH 2/3] nodedev: refactor virMediatedDeviceGetIOMMUGroupNum()

2021-04-13 Thread Jonathon Jongsma
for *GroupNum(). Reverse the implementations and make *GroupDev() call *GroupNum(). Signed-off-by: Jonathon Jongsma --- src/util/virmdev.c | 38 +- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/src/util/virmdev.c b/src/util/virmdev.c index

[libvirt PATCH 1/3] nodedev: remove unnecessary null check

2021-04-13 Thread Jonathon Jongsma
g_strdup_printf() is guaranteed to return a non-NULL value, so remove the unnecessary check for NULL. Signed-off-by: Jonathon Jongsma --- src/util/virmdev.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/util/virmdev.c b/src/util/virmdev.c index 7f4a499536..102eb2bf67 100644

[libvirt PATCH v2 08/12] nodedev: Remove GetMdevctl*Command() wrappers

2021-04-13 Thread Jonathon Jongsma
These per-command generator functions were only exposed in the header to allow the commandline generation to be tested. Now that we have a generic mdevctl command generator, we can get rid of the per-command wrappers and reduce the noise in the header. Signed-off-by: Jonathon Jongsma --- src

[libvirt PATCH v2 11/12] tests: nodedev: remove unused variable

2021-04-13 Thread Jonathon Jongsma
This variable was leftover from previous changes but is no longer used. Signed-off-by: Jonathon Jongsma --- tests/nodedevmdevctltest.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/nodedevmdevctltest.c b/tests/nodedevmdevctltest.c index 4c316e3ed0..65286761c1 100644 --- a/tests

[libvirt PATCH v2 10/12] tests: nodedev: simplify test macros

2021-04-13 Thread Jonathon Jongsma
specifying it in the test macro. Signed-off-by: Jonathon Jongsma --- tests/nodedevmdevctltest.c | 43 +- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/tests/nodedevmdevctltest.c b/tests/nodedevmdevctltest.c index bba521e563..4c316e3ed0 100644 -

[libvirt PATCH v2 09/12] tests: nodedev: Make the mdevctl test function and helper generic

2021-04-13 Thread Jonathon Jongsma
From: Erik Skultety Now that we have a generic mdevctl command generator, we can unify the test infrastructure as well. Signed-off-by: Erik Skultety --- ...19_36ea_4111_8f0a_8c9a70e21366-start.argv} | 0 ...019_36ea_4111_8f0a_8c9a70e21366-stop.argv} | 0

[libvirt PATCH v2 05/12] nodedev: Switch to using long options for mdevctl

2021-04-13 Thread Jonathon Jongsma
rather than using short opentions (e.g. "-p :00:02.0"), use long options everywhere (e.g. "--parent=:00:02.0") Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 28 ++- ...19_36ea_4111_8f0a_8c9a70e21

[libvirt PATCH v2 12/12] tests: nodedev: remove unnecessary cleanup label

2021-04-13 Thread Jonathon Jongsma
Now that the last cleanup task was removed in the previous commit, just remove the label and return early on error rather than goto cleanup. Signed-off-by: Jonathon Jongsma --- tests/nodedevmdevctltest.c | 20 1 file changed, 8 insertions(+), 12 deletions(-) diff --git

[libvirt PATCH v2 06/12] nodedev: driver: Introduce internal mdevctl commands enum

2021-04-13 Thread Jonathon Jongsma
start" instance mean, use "create" internally instead only to translate it to "start" just before executing mdevctl. Signed-off-by: Erik Skultety Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 7 +++ src/node_device/node_device_driver.h |

[libvirt PATCH v2 04/12] nodedev: driver: Swap virMdevctlStart and virMdevctlCreate

2021-04-13 Thread Jonathon Jongsma
posed to be created. Signed-off-by: Erik Skultety Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 34 ++--- src/node_device/node_device_driver.h | 10 ++-- ...9_36ea_4111_8f0a_8c9a70e21366-create.argv} | 0 ...9_36ea_4111_8f0a_8c9a70e21366-c

[libvirt PATCH v2 07/12] nodedev: driver: Create a generic mdevctl command translator

2021-04-13 Thread Jonathon Jongsma
t them call a single global translator that handles all the mdevctl command differences and commonalities. Signed-off-by: Erik Skultety Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 125 --- src/node_device/node_device_driver.h | 6 +- tests/

[libvirt PATCH v2 02/12] nodedev: avoid use of VIR_ERR_NO_* errors internally

2021-04-13 Thread Jonathon Jongsma
as expected. [1] See the implementation of daemonErrorLogFilter() for details: https://gitlab.com/libvirt/libvirt/-/blob/e2f82a3704f680fbb37a733476d870c19232c23e/src/remote/remote_daemon.c#L89 Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 2 +- 1 file changed, 1

[libvirt PATCH v2 03/12] tests: nodedev: switch all test macros to accept a filename

2021-04-13 Thread Jonathon Jongsma
Rather than specifying a UUID string to some test macros, just pass a filename to an xml definition. This helps work toward unifying the test macros and making it more maintainable. Signed-off-by: Jonathon Jongsma --- tests/nodedevmdevctldata/mdevctl-create.argv | 2 +- tests

[libvirt PATCH v2 01/12] nodedev: don't log error in nodeDeviceFindAddressByName()

2021-04-13 Thread Jonathon Jongsma
The calling function will log the error. Just return NULL if a device cannot be found. Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/node_device/node_device_driver.c b/src/node_device

[libvirt PATCH v2 00/12] Some additional cleanups to mdev support

2021-04-13 Thread Jonathon Jongsma
test function and helper generic Jonathon Jongsma (8): nodedev: don't log error in nodeDeviceFindAddressByName() nodedev: avoid use of VIR_ERR_NO_* errors internally tests: nodedev: switch all test macros to accept a filename nodedev: Switch to using long options for mdevctl nodedev

[libvirt PATCH 08/11] nodedev: Remove GetMdevctl*Command() wrappers

2021-04-09 Thread Jonathon Jongsma
These per-command generator functions were only exposed in the header to allow the commandline generation to be tested. Now that we have a generic mdevctl command generator, we can get rid of the per-command wrappers and reduce the noise in the header. Signed-off-by: Jonathon Jongsma --- src

[libvirt PATCH 07/11] nodedev: driver: Create a generic mdevctl command translator

2021-04-09 Thread Jonathon Jongsma
t them call a single global translator that handles all the mdevctl command differences and commonalities. Signed-off-by: Erik Skultety Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 125 --- src/node_device/node_device_driver.h | 6 +- tests/

[libvirt PATCH 04/11] nodedev: driver: Swap virMdevctlStart and virMdevctlCreate

2021-04-09 Thread Jonathon Jongsma
posed to be created. Signed-off-by: Erik Skultety Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 34 ++--- src/node_device/node_device_driver.h | 10 ++-- ...9_36ea_4111_8f0a_8c9a70e21366-create.argv} | 0 ...9_36ea_4111_8f0a_8c9a70e21366-c

[libvirt PATCH 05/11] nodedev: Switch to using long options for mdevctl

2021-04-09 Thread Jonathon Jongsma
rather than using short opentions (e.g. "-p :00:02.0"), use long options everywhere (e.g. "--parent=:00:02.0") Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 28 ++- ...19_36ea_4111_8f0a_8c9a70e21

[libvirt PATCH 03/11] tests: nodedev: switch all test macros to accept a filename

2021-04-09 Thread Jonathon Jongsma
Rather than specifying a UUID string to some test macros, just pass a filename to an xml definition. This helps work toward unifying the test macros and making it more maintainable. Signed-off-by: Jonathon Jongsma --- tests/nodedevmdevctldata/mdevctl-create.argv | 2 +- tests

[libvirt PATCH 11/11] tests: nodedev: remove unused variable

2021-04-09 Thread Jonathon Jongsma
This variable was leftover from previous changes but is no longer used. Signed-off-by: Jonathon Jongsma --- tests/nodedevmdevctltest.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/nodedevmdevctltest.c b/tests/nodedevmdevctltest.c index 3a53254195..b2507e1567 100644 --- a/tests

[libvirt PATCH 06/11] nodedev: driver: Introduce internal mdevctl commands enum

2021-04-09 Thread Jonathon Jongsma
start" instance mean, use "create" internally instead only to translate it to "start" just before executing mdevctl. Signed-off-by: Erik Skultety Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 7 +++ src/node_device/node_device_driver.h |

[libvirt PATCH 10/11] tests: nodedev: simplify test macros

2021-04-09 Thread Jonathon Jongsma
specifying it in the test macro. Signed-off-by: Jonathon Jongsma --- tests/nodedevmdevctltest.c | 43 +- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/tests/nodedevmdevctltest.c b/tests/nodedevmdevctltest.c index 7e192ce118..3a53254195 100644 -

[libvirt PATCH 02/11] nodedev: avoid use of VIR_ERR_NO_* errors internally

2021-04-09 Thread Jonathon Jongsma
as expected. [1] See the implementation of daemonErrorLogFilter() for details: https://gitlab.com/libvirt/libvirt/-/blob/e2f82a3704f680fbb37a733476d870c19232c23e/src/remote/remote_daemon.c#L89 Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 2 +- 1 file changed, 1

[libvirt PATCH 00/11] Some additional cleanups to mdev support

2021-04-09 Thread Jonathon Jongsma
executing mdevctl). Erik Skultety (4): nodedev: driver: Swap virMdevctlStart and virMdevctlCreate nodedev: driver: Introduce internal mdevctl commands enum nodedev: driver: Create a generic mdevctl command translator tests: nodedev: Make the mdevctl test function and helper generic Jonathon

[libvirt PATCH 09/11] tests: nodedev: Make the mdevctl test function and helper generic

2021-04-09 Thread Jonathon Jongsma
From: Erik Skultety Now that we have a generic mdevctl command generator, we can unify the test infrastructure as well. Signed-off-by: Erik Skultety --- ...19_36ea_4111_8f0a_8c9a70e21366-start.argv} | 0 ...019_36ea_4111_8f0a_8c9a70e21366-stop.argv} | 0

[libvirt PATCH 01/11] nodedev: don't log error in nodeDeviceFindAddressByName()

2021-04-09 Thread Jonathon Jongsma
The calling function will log the error. Just return NULL if a device cannot be found. Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/node_device/node_device_driver.c b/src/node_device

[libvirt PATCH 2/2] api: Add 'flags' param to virNodeDeviceCreate/Undefine()

2021-04-09 Thread Jonathon Jongsma
Follow best practices and add a unsigned int flags parameter to these new APIs that have not been in a release yet. Signed-off-by: Jonathon Jongsma --- include/libvirt/libvirt-nodedev.h| 6 -- src/driver-nodedev.h | 6 -- src/libvirt-nodedev.c| 16

[libvirt PATCH 0/2] Minor fixes to new mdev apis

2021-04-09 Thread Jonathon Jongsma
A couple issues with the recently merged mdev patch series that were caught by Daniel Berrange. Jonathon Jongsma (2): nodedev: fix release version in comments for new API api: Add 'flags' param to virNodeDeviceCreate/Undefine() include/libvirt/libvirt-nodedev.h| 6 -- src/driver

[libvirt PATCH 1/2] nodedev: fix release version in comments for new API

2021-04-09 Thread Jonathon Jongsma
The comments mistakenly say 7.2.0, when they were actually merged during the 7.3 development cycle. Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_udev.c | 6 +++--- src/remote/remote_driver.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git

Re: [libvirt PATCH v6 00/30] Add support for persistent mediated devices

2021-04-07 Thread Jonathon Jongsma
On Wed, 7 Apr 2021 08:05:17 +0200 Erik Skultety wrote: > On Thu, Apr 01, 2021 at 10:18:45AM -0500, Jonathon Jongsma wrote: > > On Wed, 31 Mar 2021 16:00:48 +0200 > > Erik Skultety wrote: > > > > > On Fri, Mar 26, 2021 at 11:47:56AM -0500, Jonathon Jongsma wro

Re: [libvirt PATCH v6 00/30] Add support for persistent mediated devices

2021-04-01 Thread Jonathon Jongsma
On Wed, 31 Mar 2021 16:00:48 +0200 Erik Skultety wrote: > On Fri, Mar 26, 2021 at 11:47:56AM -0500, Jonathon Jongsma wrote: > > This patch series follows the previously-merged series which added > > support for transient mediated devices. This series expands mdev > &g

Re: [libvirt PATCH v6 16/30] api: add virNodeDeviceDefineXML()

2021-03-31 Thread Jonathon Jongsma
On Wed, 31 Mar 2021 08:31:11 +0200 Erik Skultety wrote: > On Fri, Mar 26, 2021 at 11:48:12AM -0500, Jonathon Jongsma wrote: > > With mediated devices, we can now define persistent node devices > > that can be started and stopped. In order to take advantage of > > this, we

[libvirt PATCH v6 12/30] nodedev: add helper functions to remove node devices

2021-03-26 Thread Jonathon Jongsma
lists in libvirt) to facilitate that. They will be used in coming commits. Signed-off-by: Jonathon Jongsma --- src/conf/virnodedeviceobj.c | 58 ++--- src/conf/virnodedeviceobj.h | 11 +++ src/libvirt_private.syms| 2 ++ 3 files changed, 67 insertions(+), 4

[libvirt PATCH v6 30/30] nodedev: avoid delay when defining a new mdev

2021-03-26 Thread Jonathon Jongsma
When calling virNodeDeviceDefineXML() to define a new mediated device, we call virMdevctlDefine() and then wait for the new device to appear in the driver's device list before returning. This caused long delays due to the behavior of nodeDeviceFindNewMediatedDevice(). This function checks to see

[libvirt PATCH v6 21/30] virsh: Factor out function to find node device

2021-03-26 Thread Jonathon Jongsma
Several functions accept providing a node device by name or by wwnn,wwpn pair. Extract the logic to do this into a function that can be used by both callers. Signed-off-by: Jonathon Jongsma Reviewed-by: Erik Skultety --- tools/virsh-nodedev.c | 62 +++ 1

[libvirt PATCH v6 25/30] nodedev: add element to mdev caps

2021-03-26 Thread Jonathon Jongsma
It will be useful to be able to specify a particular UUID for a mediated device when defining the node device. To accomodate that, allow this to be specified in the xml schema. This patch also parses and formats that value to the xml, but does not yet use it. Signed-off-by: Jonathon Jongsma

[libvirt PATCH v6 26/30] nodedev: add ability to specify UUID for new mdevs

2021-03-26 Thread Jonathon Jongsma
Use the new element in the mdev caps to define and start devices with a specific UUID. Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 19 --- ...19_36ea_4111_8f0a_8c9a70e21366-define.argv | 3 ++- ...019_36ea_4111_8f0a_8c9a70e21366

[libvirt PATCH v6 23/30] api: add virNodeDeviceCreate()

2021-03-26 Thread Jonathon Jongsma
This new API function provides a way to start a persistently-defined mediate device that was defined by virNodeDeviceDefineXML() (or one that was defined externally via mdevctl) Signed-off-by: Jonathon Jongsma Reviewed-by: Erik Skultety --- include/libvirt/libvirt-nodedev.h| 2

[libvirt PATCH v6 29/30] nodedev: factor out function to add mediated devices

2021-03-26 Thread Jonathon Jongsma
To accomodate re-use of this functionality in a following patch, split out the processing of an individual mdev definition into a separate function. --- src/node_device/node_device_driver.c | 103 +++ 1 file changed, 57 insertions(+), 46 deletions(-) diff --git

[libvirt PATCH v6 24/30] virsh: add "nodedev-start" command

2021-03-26 Thread Jonathon Jongsma
This virsh command maps to virNodeDeviceCreate(), which starts a node device that has been previously defined by virNodeDeviceDefineXML(). This is only supported for mediated devices. Signed-off-by: Jonathon Jongsma Reviewed-by: Erik Skultety --- tools/virsh-nodedev.c | 57

[libvirt PATCH v6 22/30] virsh: add nodedev-undefine command

2021-03-26 Thread Jonathon Jongsma
Add a virsh command that maps to virNodeDeviceUndefine(). Signed-off-by: Jonathon Jongsma Reviewed-by: Erik Skultety --- tools/virsh-nodedev.c | 59 +++ 1 file changed, 59 insertions(+) diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index

[libvirt PATCH v6 28/30] nodedev: add docs about mdev attribute order

2021-03-26 Thread Jonathon Jongsma
Mention that mdev attribute order is significant. Signed-off-by: Jonathon Jongsma --- docs/formatnode.html.in | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/formatnode.html.in b/docs/formatnode.html.in index 5c7286df8a..c58cd01395 100644 --- a/docs

[libvirt PATCH v6 17/30] virsh: Add --inactive, --all to nodedev-list

2021-03-26 Thread Jonathon Jongsma
-by: Jonathon Jongsma Reviewed-by: Erik Skultety --- tools/virsh-nodedev.c | 29 + 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index b9fe9b8be1..7ab5b264fc 100644 --- a/tools/virsh-nodedev.c +++ b/tools

[libvirt PATCH v6 20/30] api: add virNodeDeviceUndefine()

2021-03-26 Thread Jonathon Jongsma
This interface allows you to undefine a persistently defined (but inactive) mediated devices. It is implemented via 'mdevctl' Signed-off-by: Jonathon Jongsma --- include/libvirt/libvirt-nodedev.h | 2 + src/access/viraccessperm.c| 2 +- src/access

[libvirt PATCH v6 11/30] nodedev: add mdevctl devices to node device list

2021-03-26 Thread Jonathon Jongsma
one provided by the udev backend, we will lose extra information that was provided by mdevctl (e.g. attributes, etc). To avoid this, make sure to copy the extra information into the new device definition. Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 153

[libvirt PATCH v6 19/30] nodedev: refactor tests to support mdev undefine

2021-03-26 Thread Jonathon Jongsma
mdevctl 'stop' and 'undefine' commands take the same uuid parameter, so refactor the test infrastructure to share common implementation for both of these commands. The 'undefine' command will be introduced in a following patch. Signed-off-by: Jonathon Jongsma --- tests/nodedevmdevctltest.c | 48

[libvirt PATCH v6 16/30] api: add virNodeDeviceDefineXML()

2021-03-26 Thread Jonathon Jongsma
With mediated devices, we can now define persistent node devices that can be started and stopped. In order to take advantage of this, we need an API to define new node devices. Signed-off-by: Jonathon Jongsma --- include/libvirt/libvirt-nodedev.h| 4 ++ src/driver-nodedev.h

[libvirt PATCH v6 27/30] nodedev: fix hang when destroying an mdev in use

2021-03-26 Thread Jonathon Jongsma
on the fact that a vfio group can only be opened by one user at a time. If we get an EBUSY error when attempting to open the group file, we assume the device is in use and refuse to try to destroy that device. Signed-off-by: Jonathon Jongsma Reviewed-by: Erik Skultety --- src/node_device

[libvirt PATCH v6 08/30] nodedev: add ability to list defined mdevs

2021-03-26 Thread Jonathon Jongsma
This adds an internal API to query for persistent mediated devices that are defined by mdevctl. Upcoming commits will make use of this information. Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 18 + src/node_device/node_device_driver.h

[libvirt PATCH v6 14/30] nodedev: Refresh mdev devices when changes are detected

2021-03-26 Thread Jonathon Jongsma
config directory for changes to files. When a change is detected, we query mdevctl and update our device list. The mdevctl querying is handled in a throwaway thread, and these threads are synchronized with a mutex. Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_udev.c | 161

[libvirt PATCH v6 15/30] nodedev: add function to generate mdevctl define command

2021-03-26 Thread Jonathon Jongsma
Abstract out the function used to generate the commandline for 'mdevctl start' since they take the same arguments. Add tests to ensure that we're generating the command properly. Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 34 +++-- src/node_device

[libvirt PATCH v6 18/30] virsh: add nodedev-define command

2021-03-26 Thread Jonathon Jongsma
Add a virsh command that maps to virNodeDeviceDefineXML(). Signed-off-by: Jonathon Jongsma Reviewed-by: Erik Skultety --- tools/virsh-nodedev.c | 58 +++ 1 file changed, 58 insertions(+) diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index

[libvirt PATCH v6 06/30] nodedev: expose internal helper for naming devices

2021-03-26 Thread Jonathon Jongsma
Expose a helper function that can be used by udev and mdevctl to generate device names for node devices. Signed-off-by: Jonathon Jongsma Reviewed-by: Erik Skultety --- src/node_device/node_device_driver.c | 25 + src/node_device/node_device_driver.h | 6 ++ src

[libvirt PATCH v6 07/30] nodedev: add ability to parse mdevs from mdevctl

2021-03-26 Thread Jonathon Jongsma
This function will parse the list of mediated devices that are returned by mdevctl and convert it into our internal node device representation. Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 143 ++ src/node_device/node_device_driver.h

[libvirt PATCH v6 13/30] nodedev: handle mdevs that disappear from mdevctl

2021-03-26 Thread Jonathon Jongsma
hen we get such an event, we remove the device from the list if it's not active. Otherwise, we simply mark it as non-persistent. Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 67 ++-- 1 file changed, 64 insertions(+), 3 deletions(-) diff -

[libvirt PATCH v6 04/30] nodedev: Add ability to filter by active state

2021-03-26 Thread Jonathon Jongsma
Add two flag values for virConnectListAllNodeDevices() so that we can list only node devices that are active or inactive. Signed-off-by: Jonathon Jongsma Reviewed-by: Erik Skultety --- include/libvirt/libvirt-nodedev.h| 9 +++-- src/conf/node_device_conf.h | 8 src/conf

[libvirt PATCH v6 10/30] nodedev: add DEFINED/UNDEFINED lifecycle events

2021-03-26 Thread Jonathon Jongsma
Since a mediated device can be persistently defined by the mdevctl backend, we need additional lifecycle events beyond CREATED/DELETED to indicate that e.g. the device has been stopped but the device definition still exists. Signed-off-by: Jonathon Jongsma --- examples/c/misc/event-test.c

[libvirt PATCH v6 05/30] nodedev: fix docs for virConnectListAllNodeDevices()

2021-03-26 Thread Jonathon Jongsma
It doesn't make sense to list all of the flag values in the function documentation. This is unnecessary duplication, we already refer to the enum type. Also, remove reference to exclusive groups of flags, since that does not apply to this API. Signed-off-by: Jonathon Jongsma --- include

[libvirt PATCH v6 03/30] nodedev: introduce concept of 'active' node devices

2021-03-26 Thread Jonathon Jongsma
we will be able to define mediated devices that can be started or stopped, so we need to be able to indicate whether the device is active or not, similar to other resources (storage pools, domains, etc.) Signed-off-by: Jonathon Jongsma Reviewed-by: Erik Skultety --- src/conf/virnodedeviceobj.c

[libvirt PATCH v6 09/30] nodedev: add persistence to virNodeDeviceObj

2021-03-26 Thread Jonathon Jongsma
Consistent with other objects (e.g. virDomainObj), add a field to indicate whether the node device is persistent or transient. Signed-off-by: Jonathon Jongsma --- src/conf/virnodedeviceobj.c | 16 src/conf/virnodedeviceobj.h | 6 ++ src/libvirt_private.syms| 2 ++ 3

[libvirt PATCH v6 01/30] nodedev: capture and report stderror from mdevctl

2021-03-26 Thread Jonathon Jongsma
When an mdevctl command fails, there is not much information available to the user about why it failed. This is partly because we were not making use of the error message that mdevctl itself prints upon failure. Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 46

[libvirt PATCH v6 02/30] tests: remove extra trailing semicolon

2021-03-26 Thread Jonathon Jongsma
The macro should not have a trailing semicolon so that when the macro is used, the user can add a semicolon themselves. Signed-off-by: Jonathon Jongsma Reviewed-by: Erik Skultety --- tests/nodedevmdevctltest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests

[libvirt PATCH v6 00/30] Add support for persistent mediated devices

2021-03-26 Thread Jonathon Jongsma
to latest git master Jonathon Jongsma (30): nodedev: capture and report stderror from mdevctl tests: remove extra trailing semicolon nodedev: introduce concept of 'active' node devices nodedev: Add ability to filter by active state nodedev: fix docs for virConnectListAllNodeDevices

Re: [libvirt PATCH v5 00/30] Add support for persistent mediated devices

2021-03-26 Thread Jonathon Jongsma
On Fri, 26 Mar 2021 07:27:46 +0100 Erik Skultety wrote: > On Thu, Mar 25, 2021 at 11:49:49AM -0500, Jonathon Jongsma wrote: > > Just a friendly ping ;) > > I'm sorry I've been neglecting this for the past 3 weeks or so, I'll > dive right into it starting Monday next we

Re: [libvirt PATCH v5 00/30] Add support for persistent mediated devices

2021-03-25 Thread Jonathon Jongsma
Just a friendly ping ;) On Tue, 2 Mar 2021 16:30:35 -0600 Jonathon Jongsma wrote: > This patch series follows the previously-merged series which added > support for transient mediated devices. This series expands mdev > support to include persistent device definitions. Again,

[libvirt PATCH] nodedev: Don't crash when exiting before init is done

2021-03-16 Thread Jonathon Jongsma
with the cleanup. This is similar to how we handle the udev event handler thread. The separate initialization thread was added in commit 9f0ae0b1. https://bugzilla.redhat.com/show_bug.cgi?id=1933590 Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_udev.c | 7 +-- 1 file

[libvirt PATCH v5 25/30] nodedev: add element to mdev caps

2021-03-02 Thread Jonathon Jongsma
It will be useful to be able to specify a particular UUID for a mediated device when defining the node device. To accomodate that, allow this to be specified in the xml schema. This patch also parses and formats that value to the xml, but does not yet use it. Signed-off-by: Jonathon Jongsma

[libvirt PATCH v5 21/30] virsh: Factor out function to find node device

2021-03-02 Thread Jonathon Jongsma
Several functions accept providing a node device by name or by wwnn,wwpn pair. Extract the logic to do this into a function that can be used by both callers. Signed-off-by: Jonathon Jongsma Reviewed-by: Erik Skultety --- tools/virsh-nodedev.c | 62 +++ 1

[libvirt PATCH v5 18/30] virsh: add nodedev-define command

2021-03-02 Thread Jonathon Jongsma
Add a virsh command that maps to virNodeDeviceDefineXML(). Signed-off-by: Jonathon Jongsma Reviewed-by: Erik Skultety --- tools/virsh-nodedev.c | 58 +++ 1 file changed, 58 insertions(+) diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index

[libvirt PATCH v5 28/30] nodedev: add docs about mdev attribute order

2021-03-02 Thread Jonathon Jongsma
Mention that mdev attribute order is significant. Signed-off-by: Jonathon Jongsma --- docs/formatnode.html.in | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/formatnode.html.in b/docs/formatnode.html.in index 5c7286df8a..c58cd01395 100644 --- a/docs

[libvirt PATCH v5 30/30] nodedev: avoid delay when defining a new mdev

2021-03-02 Thread Jonathon Jongsma
When calling virNodeDeviceDefineXML() to define a new mediated device, we call virMdevctlDefine() and then wait for the new device to appear in the driver's device list before returning. This caused long delays due to the behavior of nodeDeviceFindNewMediatedDevice(). This function checks to see

[libvirt PATCH v5 27/30] nodedev: fix hang when destroying an mdev in use

2021-03-02 Thread Jonathon Jongsma
on the fact that a vfio group can only be opened by one user at a time. If we get an EBUSY error when attempting to open the group file, we assume the device is in use and refuse to try to destroy that device. Signed-off-by: Jonathon Jongsma Reviewed-by: Erik Skultety --- src/node_device

[libvirt PATCH v5 29/30] nodedev: factor out function to add mediated devices

2021-03-02 Thread Jonathon Jongsma
To accomodate re-use of this functionality in a following patch, split out the processing of an individual mdev definition into a separate function. --- src/node_device/node_device_driver.c | 103 +++ 1 file changed, 57 insertions(+), 46 deletions(-) diff --git

[libvirt PATCH v5 10/30] nodedev: add DEFINED/UNDEFINED lifecycle events

2021-03-02 Thread Jonathon Jongsma
Since a mediated device can be persistently defined by the mdevctl backend, we need additional lifecycle events beyond CREATED/DELETED to indicate that e.g. the device has been stopped but the device definition still exists. Signed-off-by: Jonathon Jongsma --- examples/c/misc/event-test.c

[libvirt PATCH v5 24/30] virsh: add "nodedev-start" command

2021-03-02 Thread Jonathon Jongsma
This virsh command maps to virNodeDeviceCreate(), which starts a node device that has been previously defined by virNodeDeviceDefineXML(). This is only supported for mediated devices. Signed-off-by: Jonathon Jongsma Reviewed-by: Erik Skultety --- tools/virsh-nodedev.c | 57

[libvirt PATCH v5 23/30] api: add virNodeDeviceCreate()

2021-03-02 Thread Jonathon Jongsma
This new API function provides a way to start a persistently-defined mediate device that was defined by virNodeDeviceDefineXML() (or one that was defined externally via mdevctl) Signed-off-by: Jonathon Jongsma Reviewed-by: Erik Skultety --- include/libvirt/libvirt-nodedev.h| 2

[libvirt PATCH v5 17/30] virsh: Add --inactive, --all to nodedev-list

2021-03-02 Thread Jonathon Jongsma
-by: Jonathon Jongsma Reviewed-by: Erik Skultety --- tools/virsh-nodedev.c | 29 + 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index b9fe9b8be1..7ab5b264fc 100644 --- a/tools/virsh-nodedev.c +++ b/tools

[libvirt PATCH v5 26/30] nodedev: add ability to specify UUID for new mdevs

2021-03-02 Thread Jonathon Jongsma
Use the new element in the mdev caps to define and start devices with a specific UUID. Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 19 --- ...19_36ea_4111_8f0a_8c9a70e21366-define.argv | 3 ++- ...019_36ea_4111_8f0a_8c9a70e21366

[libvirt PATCH v5 19/30] nodedev: refactor tests to support mdev undefine

2021-03-02 Thread Jonathon Jongsma
mdevctl 'stop' and 'undefine' commands take the same uuid parameter, so refactor the test infrastructure to share common implementation for both of these commands. The 'undefine' command will be introduced in a following patch. Signed-off-by: Jonathon Jongsma --- tests/nodedevmdevctltest.c | 48

[libvirt PATCH v5 22/30] virsh: add nodedev-undefine command

2021-03-02 Thread Jonathon Jongsma
Add a virsh command that maps to virNodeDeviceUndefine(). Signed-off-by: Jonathon Jongsma Reviewed-by: Erik Skultety --- tools/virsh-nodedev.c | 59 +++ 1 file changed, 59 insertions(+) diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index

[libvirt PATCH v5 16/30] api: add virNodeDeviceDefineXML()

2021-03-02 Thread Jonathon Jongsma
With mediated devices, we can now define persistent node devices that can be started and stopped. In order to take advantage of this, we need an API to define new node devices. Signed-off-by: Jonathon Jongsma --- include/libvirt/libvirt-nodedev.h| 4 ++ src/driver-nodedev.h

[libvirt PATCH v5 14/30] nodedev: Refresh mdev devices when changes are detected

2021-03-02 Thread Jonathon Jongsma
config directory for changes to files. When a change is detected, we query mdevctl and update our device list. The mdevctl querying is handled in a throwaway thread, and these threads are synchronized with a mutex. Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_udev.c | 161

[libvirt PATCH v5 15/30] nodedev: add function to generate mdevctl define command

2021-03-02 Thread Jonathon Jongsma
Abstract out the function used to generate the commandline for 'mdevctl start' since they take the same arguments. Add tests to ensure that we're generating the command properly. Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 34 +++-- src/node_device

[libvirt PATCH v5 20/30] api: add virNodeDeviceUndefine()

2021-03-02 Thread Jonathon Jongsma
This interface allows you to undefine a persistently defined (but inactive) mediated devices. It is implemented via 'mdevctl' Signed-off-by: Jonathon Jongsma --- include/libvirt/libvirt-nodedev.h | 2 + src/access/viraccessperm.c| 2 +- src/access

[libvirt PATCH v5 09/30] nodedev: add persistence to virNodeDeviceObj

2021-03-02 Thread Jonathon Jongsma
Consistent with other objects (e.g. virDomainObj), add a field to indicate whether the node device is persistent or transient. Signed-off-by: Jonathon Jongsma --- src/conf/virnodedeviceobj.c | 16 src/conf/virnodedeviceobj.h | 6 ++ src/libvirt_private.syms| 2 ++ 3

[libvirt PATCH v5 12/30] nodedev: add helper functions to remove node devices

2021-03-02 Thread Jonathon Jongsma
lists in libvirt) to facilitate that. They will be used in coming commits. Signed-off-by: Jonathon Jongsma --- src/conf/virnodedeviceobj.c | 58 ++--- src/conf/virnodedeviceobj.h | 11 +++ src/libvirt_private.syms| 2 ++ 3 files changed, 67 insertions(+), 4

[libvirt PATCH v5 13/30] nodedev: handle mdevs that disappear from mdevctl

2021-03-02 Thread Jonathon Jongsma
hen we get such an event, we remove the device from the list if it's not active. Otherwise, we simply mark it as non-persistent. Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 67 ++-- 1 file changed, 64 insertions(+), 3 deletions(-) diff -

<    1   2   3   4   5   6   7   8   9   10   >