Skip to contentSkip to conversation

virtio: introduce `info virtio' hmp command

RFC Superseded Jan Dakinevich 3 participants 8 messages Oct 24, 2017 – Dec 15, 2017

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 cover virtio: introduce `info virtio' hmp command

Previously, it was suggested to use QAPI unions/enums to declare feature bits. Some of weak parts of my code (such `get_feature_name' callback) went away. But a lot of of dummy code with feature declaration is still here, it just migrated to json file.

So, I would be glad to get a responce if my understanging of using QAPI structures was correct, or there was another way to do that cleaner?

v5:
Use QAPI enums/unions to declare virtio feature bits

v4: http://lists.nongnu.org/archive/html/qemu-devel/2017-10/msg00393.html
v3: http://lists.nongnu.org/archive/html/qemu-devel/2017-09/msg07565.html
v2: http://lists.nongnu.org/archive/html/qemu-devel/2017-09/msg07527.html
v1: http://lists.nongnu.org/archive/html/qemu-devel/2017-09/msg07247.html

Jan Dakinevich (2):
virtio: introduce `query-virtio' QMP command
virtio: add `info virtio' HMP command

 hmp-commands-info.hx    |  14 ++
 hmp.c                   | 122 +++++++++++++
 hmp.h                   |   1 +
 hw/virtio/Makefile.objs |   3 +
 hw/virtio/virtio-qmp.c  | 223 +++++++++++++++++++++++
 hw/virtio/virtio-stub.c |   9 +
 qapi-schema.json        | 466 ++++++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 838 insertions(+)
 create mode 100644 hw/virtio/virtio-qmp.c
 create mode 100644 hw/virtio/virtio-stub.c
Signature · 1 line
2.1.4
#1 lore raw

RFC v5 1/2 virtio: introduce `query-virtio' QMP command

The command is intended for gathering virtio information such as status, feature bits, negotiation status. It is convenient and useful for debug purpose.

The commands returns generic virtio information for virtio such as common feature names and status bits names and information for all attached to current machine devices.

---
 hw/virtio/Makefile.objs |   3 +
 hw/virtio/virtio-qmp.c  | 223 +++++++++++++++++++++++
 hw/virtio/virtio-stub.c |   9 +
 qapi-schema.json        | 466 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 701 insertions(+)
 create mode 100644 hw/virtio/virtio-qmp.c
 create mode 100644 hw/virtio/virtio-stub.c
hw/virtio/Makefile.objs +3 -0
index 765d363..3524aa7 100644
@@ -3,12 +3,15 @@ common-obj-y += virtio-rng.o
 common-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o
 common-obj-y += virtio-bus.o
 common-obj-y += virtio-mmio.o
+common-obj-y += virtio-qmp.o
 
 obj-y += virtio.o virtio-balloon.o 
 obj-$(CONFIG_LINUX) += vhost.o vhost-backend.o vhost-user.o
 obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock.o
 obj-y += virtio-crypto.o
 obj-$(CONFIG_VIRTIO_PCI) += virtio-crypto-pci.o
+else
+obj-y += virtio-stub.o
 endif
 
 common-obj-$(call lnot,$(CONFIG_LINUX)) += vhost-stub.o
hw/virtio/virtio-qmp.c new file +223 -0

223 lines not on this page · raw message

hw/virtio/virtio-stub.c new file +9 -0
new file mode 100644
index 0000000..185d4bd
@@ -0,0 +1,9 @@
+#include "qemu/osdep.h"
+#include "qmp-commands.h"
+#include "qapi/qmp/qerror.h"
+
+VirtioInfoList *qmp_query_virtio(bool has_path, const char *path, Error **errp)
+{
+    error_setg(errp, QERR_UNSUPPORTED);
+    return NULL;
+}
qapi-schema.json +466 -0

469 lines not on this page · raw message

Signature · 1 line
2.1.4
#2 lore raw

Re: [Qemu-devel] [RFC v5 1/2] virtio: introduce `query-virtio' QMP command

Quoted 14 lines · Jan Dakinevich

The command is intended for gathering virtio information such as status, feature bits, negotiation status. It is convenient and useful for debug purpose.

The commands returns generic virtio information for virtio such as common feature names and status bits names and information for all attached to current machine devices.

---

+++ b/qapi-schema.json

qapi-schema.json line 3209

Quoted 10 lines
qapi-schema.json +7 -0
@@ -3200,3 +3200,469 @@
 # Since: 2.11
 ##
 { 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'} }
+
+##
+# @VirtioStatus:
+#
+# Virtio device status bits
+#
+# Since: 2.11

We've entered soft freeze, and this is a new feature, so it may be better to propose this for 2.12 rather than trying to rush it in now.

qapi-schema.json line 3220

Quoted 11 lines
qapi-schema.json +11 -0
+#
+##
+{
+    'enum': 'VirtioStatus',
+    'data': [
+        'acknowledge',
+        'driver',
+        'driver-ok',
+        'features-ok',
+        'status-reserved-4',
+        'status-reserved-5',

Are we ever going to report a '*-reserved-NNN' enum value to the end user? I hope not, in which case, we don't need to expose it in the QAPI enums. Yes, that means you have to do some mapping between named bits and enum strings (you would no longer have the property that 'status-reserved-4' is value 4, but would instead have to map that bit 6 translates to 'needs-reset' with enum value 4), but a clean public-facing interface may be worth the hassle. What's more, as newer qemu learns new bit names down the road, then expanding the enums to cover those new names is introspectible; whereas you can't rename an existing enum value while still retaining back-compat.

qapi-schema.json line 3595

Quoted 12 lines
qapi-schema.json +12 -0
+##
+# @VirtioFeatureName:
+#
+# Since: 2.11
+#
+##
+{
+    'union': 'VirtioFeatureName',
+    'data': {
+        'common': 'VirtioFeatureCommon',
+        'net': 'VirtioFeatureNet',
+        'blk': 'VirtioFeatureBlk',

Do we really need to abbreviate this one?

qapi-schema.json line 3603

Quoted 8 lines
qapi-schema.json +8 -0
+        'serial': 'VirtioFeatureSerial',
+        'balloon': 'VirtioFeatureBalloon',
+        'scsi': 'VirtioFeatureScsi',
+        'virtfs': 'VirtioFeatureVirtfs',
+        'gpu': 'VirtioFeatureGpu',
+        'other': 'VirtioFeatureOther'
+    }
+}

This is a so-called "simple union" - but we do not want any more of these in our code. In fact, Markus and I are toying with the idea of renaming it to "legacy union", and/or making the syntax more painful, because we WANT to use "flat unions" in all new code (and make their syntax easier to type).

So, a comparable flat union would be something like:

{ 'enum': 'VirtioFeatureCategory',
'data': [ 'common', 'net', 'block', 'serial', 'balloon', 'scsi',
'virtfs', 'gpu', 'other' ] }
{ 'union': 'VirtioFeatureName',
'base': { 'category': 'VirtioFeatureCategory' }, 'discriminator': 'category',
'data': { 'common': 'VirtioFeatureCommon', ... } }

except that flat unions don't permit enum types (they require a struct type). Hmm.

Quoted 11 lines
qapi-schema.json +11 -0
+
+##
+# @VirtioFeature:
+#
+# Feature bit with negotiation status
+#
+# @host: true if host exposes the feature
+#
+# @guest: true if guest acknowledges the feature
+#
+# Since: 2.11

qapi-schema.json line 3624

Quoted 10 lines
qapi-schema.json +10 -0
+#
+##
+{
+    'struct': 'VirtioFeature',
+    'data': {
+        'host': 'bool',
+        'guest': 'bool',
+        'name': 'VirtioFeatureName'
+    }
+}

With your proposal, an example on the wire might be:

"feature": { "host": true, "guest": false, "name": { "type": "common", "data": "notify-on-empty" } }

Quoted 15 lines
qapi-schema.json +15 -0
+
+##
+# @VirtioInfo:
+#
+# Information about virtio device
+#
+# @qom-path: QOM path of the device
+#
+# @status: status bitmask
+#
+# @status-names: names of checked bits in status bitmask
+#
+# @host-features: bitmask of features, exposed by device
+#
+# @guest-features: bitmask of features, acknowledged by guest

qapi-schema.json line 3649

Quoted 10 lines
qapi-schema.json +10 -0
+#
+# @features: negotiation status and names of device features
+#
+##
+{
+    'struct': 'VirtioInfo',
+    'data': {
+        'qom-path': 'str',
+        'status': 'uint8',
+        'status-names': ['VirtioStatus'],

Umm, isn't it better to just have 'status': 'VirtioStatus' (as we can only ever have a single status value, so we don't really need an array to tell us what all the other status values are named).

qapi-schema.json line 3652

Quoted 3 lines
qapi-schema.json +3 -0
+        'host-features': 'uint64',
+        'guest-features': 'uint64',
+        'features': ['VirtioFeature']

Do we really want to expose both a 64-bit number and an array of feature names, where the array repeats the information on whether host and guest support the bit?

I guess we first want to figure out WHAT we want to send over the wire. Maybe:

"info": { "qom-path": "...", "status": "driver-ok",

          "host": [ { "common": "notify-on-empty" },
                    { "common": "any-layout" },
                    { "net": "csum" } ],
          "guest": [ { "common": "notify-on-empty" },
                     { "net": "csum" } ] }

or

"info": { "qom-path": "...", "status": "driver-ok",

          "host": [ { "type": "common", "value": "notify-on-empty" },
                    { "type": "common", "value": "any-layout" },
                    { "type": "net", "value": "csum" } ],
          "guest": [ { "type": "common", "value": "notify-on-empty" },
                     { "type": "net", "value": "csum" } ] }

or

"info": { "qom-path": "...", "status": "driver-ok",

          "host": { "common": [ "notify-on-empty", "any-layout" ],
                    "net": [ "csum" ] },
          "guest": { "common": [ "notify-on-empty" ] },
                     "net": [ "csum" ] } }

(some of those forms may be easier than others to express in our current QAPI language; if we need to modify the qapi language to get our ideal form supported, then that may be worth the effort).

qapi-schema.json line 3666

Quoted 12 lines
qapi-schema.json +12 -0
+
+##
+# @query-virtio:
+#
+# Returns virtio information such as device status and features
+#
+# Since: 2.11
+#
+##
+{
+    'command': 'query-virtio',
+    'data': { '*path': 'str' },

Do we need filterable queries, or is it better to just have the command return info on all virtio devices at once and let the client filter the results as desired?

Quoted 3 lines
qapi-schema.json +2 -0
+    'returns': ['VirtioInfo']
+}
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#3 lore raw

RFC v5 2/2 virtio: add `info virtio' HMP command

In reply to Jan Dakinevich

The command prints data from `query-virtio' QMP in human-readable format.

---
 hmp-commands-info.hx |  14 ++++++
 hmp.c                | 122 +++++++++++++++++++++++++++++++++++++++++++++++++++
 hmp.h                |   1 +
 3 files changed, 137 insertions(+)
hmp-commands-info.hx +14 -0
index 54c3e5e..292280a 100644
@@ -868,6 +868,20 @@ enabled) memory in bytes.
 ETEXI
 
 STEXI
+@item info virtio
+@findex virtio
+Display guest and host fetures for all virtio devices.
+ETEXI
+
+    {
+        .name       = "virtio",
+        .args_type  = "path:s?",
+        .params     = "[path]",
+        .help       = "show virtio info",
+        .cmd        = hmp_info_virtio,
+    },
+
+STEXI
 @end table
 ETEXI
 
hmp.c +122 -0

131 lines not on this page · raw message

hmp.h +1 -0
index 3605003..3e8f30a 100644
@@ -146,5 +146,6 @@ void hmp_info_ramblock(Monitor *mon, const QDict *qdict);
 void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict);
 void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict);
 void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict);
+void hmp_info_virtio(Monitor *mon, const QDict *qdict);
 
 #endif
Signature · 1 line
2.1.4
#4 lore raw
In reply to Jan Dakinevich

I am going to reanimate works under this QMP/HMP. First of all, it could be meaningful to settle what output would provide the QMP. I would like to suggest the following description:

##
# @VirtioFeature:
##

{
    'struct': 'VirtioFeature',
    'data': {
        'name': 'str',
        'acked': 'bool'
    }
}

##
# @VirtioInfo:
##

{
    'struct': 'VirtioInfo',
    'data': {
        'qom-path': 'str',
        
        'status': 'uint8',
        'host-features': 'uint64',
        'guest-features': 'uint64',

        'status-names': ['str'],
        'common-features-names': ['VirtioFeature'],
        'device-features-names': ['VirtioFeature']
    }
}

##
# @query-virtio:
##

{
    'command': 'query-virtio',
    'data': {'*path': 'str'},
    'returns': ['VirtioInfo']
}

My final goal is to implement HMP which will print all exposed virtio features (both common and device-specific) with their acknowledgements, and virtio device configuration status. These are provided by last 3 fields in @VirtioInfo.

For these who are going make own decision on features and status bitmask, respective fields with raw values are preserved.

So, I expect following data on the wire in response to `query-virtio' command:

{
    "return": [
        {
            "qom-path": "/machine/peripheral-anon/device[0]/virtio-backend", "status": 15,
            "host-features": 6325010438,
            "guest-features": 5100273670,
            "status-names": [
                "acknowledge", 
                "driver", 
                "driver-ok", 
                "features-ok"
            ],
            "common-features-names": [
                {"name": "notify-on-empty", "acked": false},
                {"name": "any-layout", "acked": false},
                {"name": "indirect-desc", "acked": true},
                {"name": "event-idx", "acked": true},
                {"name": "bad-feature", "acked": false},
                {"name": "version-1", "acked": true}
            ],
            "device-features-names": [
                {"name": "hotplug", "acked": true},
                {"name": "change", "acked": true}
            ]
        }
    ]
}

Eric Blake, returning to your question which would probably appear again after this mail:

Quoted 11 lines

Review

Quoted 7 lines
(quoted diff) +6 -0
+##
+# @query-virtio:
...
+##
+{
+    'command': 'query-virtio',
+    'data': { '*path': 'str' },  

Do we need filterable queries, or is it better to just have the command return info on all virtio devices at once and let the client filter the results as desired?

I think it would be better to do here. I suppose, the client which uses HMP will not be happy on filtering monitor output.

Signature · 2 lines
Best regards
Jan Dakinevich
#5 lore raw
Quoted 42 lines · On Tue, 12 Dec 2017 16:54:50 +0300 Jan Dakinevich…

I am going to reanimate works under this QMP/HMP. First of all, it could be meaningful to settle what output would provide the QMP. I would like to suggest the following description:

##
# @VirtioFeature:
##

{
    'struct': 'VirtioFeature',
    'data': {
        'name': 'str',
        'acked': 'bool'
    }
}

##
# @VirtioInfo:
##

{
    'struct': 'VirtioInfo',
    'data': {
        'qom-path': 'str',
        
        'status': 'uint8',
        'host-features': 'uint64',
        'guest-features': 'uint64',

        'status-names': ['str'],
        'common-features-names': ['VirtioFeature'],
        'device-features-names': ['VirtioFeature']
    }
}

##
# @query-virtio:
##

{
    'command': 'query-virtio',
    'data': {'*path': 'str'},
    'returns': ['VirtioInfo']
}
Quoted 7 lines

My final goal is to implement HMP which will print all exposed virtio features (both common and device-specific) with their acknowledgements, and virtio device configuration status. These are provided by last 3 fields in @VirtioInfo.

For these who are going make own decision on features and status bitmask, respective fields with raw values are preserved.

Looks sensible. What will you return an for the *-features-names fields if the status field indicates that negotiation is not yet done? (This has some fun interaction with the VERSION_1 feature bit...)

Quoted 19 lines

So, I expect following data on the wire in response to `query-virtio' command:

{
    "return": [
        {
            "qom-path": "/machine/peripheral-anon/device[0]/virtio-backend", "status": 15,
            "host-features": 6325010438,
            "guest-features": 5100273670,
            "status-names": [
                "acknowledge", 
                "driver", 
                "driver-ok", 
                "features-ok"
            ],
            "common-features-names": [
                {"name": "notify-on-empty", "acked": false},
                {"name": "any-layout", "acked": false},
Quoted 8 lines
                {"name": "indirect-desc", "acked": true},
                {"name": "event-idx", "acked": true},
                {"name": "bad-feature", "acked": false},
                {"name": "version-1", "acked": true}
            ],
            "device-features-names": [
                {"name": "hotplug", "acked": true},
                {"name": "change", "acked": true}

I suggest to use the #defines as names, especially as they are also used in the spec. Makes grepping easier.

Quoted 21 lines
            ]
        }
    ]
}

Eric Blake, returning to your question which would probably appear again after this mail:

Quoted 11 lines

Review

Quoted 7 lines
(quoted diff) +6 -0
+##
+# @query-virtio:
...
+##
+{
+    'command': 'query-virtio',
+    'data': { '*path': 'str' },    

Do we need filterable queries, or is it better to just have the command return info on all virtio devices at once and let the client filter the results as desired?

Quoted 2 lines

I think it would be better to do here. I suppose, the client which uses HMP will not be happy on filtering monitor output.

I think being able to optionally specify a path is the most flexible solution.

#6 lore raw
Quoted 50 lines · On Thu, 14 Dec 2017 12:05:19 +0100 Cornelia Huck <[email protected]> wrote:
Quoted 47 lines · On Tue, 12 Dec 2017 16:54:50 +0300 Jan Dakinevich…

I am going to reanimate works under this QMP/HMP. First of all, it could be meaningful to settle what output would provide the QMP. I would like to suggest the following description:

##
# @VirtioFeature:
##

{
    'struct': 'VirtioFeature',
    'data': {
        'name': 'str',
        'acked': 'bool'
    }
}

##
# @VirtioInfo:
##

{
    'struct': 'VirtioInfo',
    'data': {
        'qom-path': 'str',
        
        'status': 'uint8',
        'host-features': 'uint64',
        'guest-features': 'uint64',

        'status-names': ['str'],
        'common-features-names': ['VirtioFeature'],
        'device-features-names': ['VirtioFeature']
    }
}

##
# @query-virtio:
##

{
    'command': 'query-virtio',
    'data': {'*path': 'str'},
    'returns': ['VirtioInfo']
}

My final goal is to implement HMP which will print all exposed virtio features (both common and device-specific) with their acknowledgements, and virtio device configuration status. These are provided by last 3 fields in @VirtioInfo.

Quoted 7 lines
Quoted 2 lines

For these who are going make own decision on features and status bitmask, respective fields with raw values are preserved.

Looks sensible. What will you return an for the *-features-names fields if the status field indicates that negotiation is not yet done? (This has some fun interaction with the VERSION_1 feature bit...)

Hmm... I was going to return current features and theirs acknowledgments regardless if they were negotiated. Thus, *-features-names would contain all exposed host features with false' in acked' field.

Quoted 28 lines
Quoted 19 lines

So, I expect following data on the wire in response to `query-virtio' command:

{
    "return": [
        {
            "qom-path":
"/machine/peripheral-anon/device[0]/virtio-backend", "status": 15,
"host-features": 6325010438, "guest-features": 5100273670,
            "status-names": [
                "acknowledge", 
                "driver", 
                "driver-ok", 
                "features-ok"
            ],
            "common-features-names": [
                {"name": "notify-on-empty", "acked": false},
                {"name": "any-layout", "acked": false},
Quoted 8 lines
                {"name": "indirect-desc", "acked": true},
                {"name": "event-idx", "acked": true},
                {"name": "bad-feature", "acked": false},
                {"name": "version-1", "acked": true}
            ],
            "device-features-names": [
                {"name": "hotplug", "acked": true},
                {"name": "change", "acked": true}
Quoted 3 lines

I suggest to use the #defines as names, especially as they are also used in the spec. Makes grepping easier.

You mean, for example "VIRTIO_RING_F_EVENT_IDX" instead of "event-idx" should be used. Right?

Quoted 26 lines
Quoted 21 lines
            ]
        }
    ]
}

Eric Blake, returning to your question which would probably appear again after this mail:

Quoted 11 lines

Review

Quoted 7 lines
(quoted diff) +6 -0
+##
+# @query-virtio:
...
+##
+{
+    'command': 'query-virtio',
+    'data': { '*path': 'str' },    

Do we need filterable queries, or is it better to just have the command return info on all virtio devices at once and let the client filter the results as desired?

Quoted 2 lines

I think it would be better to do here. I suppose, the client which uses HMP will not be happy on filtering monitor output.

I think being able to optionally specify a path is the most flexible solution.

Signature · 2 lines
Best regards
Jan Dakinevich
#7 lore raw
Quoted 61 lines · On Fri, 15 Dec 2017 00:06:06 +0300 Jan Dakinevich…
Quoted 50 lines · On Thu, 14 Dec 2017 12:05:19 +0100 Cornelia Huck <[email protected]> wrote:
Quoted 47 lines · On Tue, 12 Dec 2017 16:54:50 +0300 Jan Dakinevich…

I am going to reanimate works under this QMP/HMP. First of all, it could be meaningful to settle what output would provide the QMP. I would like to suggest the following description:

##
# @VirtioFeature:
##

{
    'struct': 'VirtioFeature',
    'data': {
        'name': 'str',
        'acked': 'bool'
    }
}

##
# @VirtioInfo:
##

{
    'struct': 'VirtioInfo',
    'data': {
        'qom-path': 'str',
        
        'status': 'uint8',
        'host-features': 'uint64',
        'guest-features': 'uint64',

        'status-names': ['str'],
        'common-features-names': ['VirtioFeature'],
        'device-features-names': ['VirtioFeature']
    }
}

##
# @query-virtio:
##

{
    'command': 'query-virtio',
    'data': {'*path': 'str'},
    'returns': ['VirtioInfo']
}

My final goal is to implement HMP which will print all exposed virtio features (both common and device-specific) with their acknowledgements, and virtio device configuration status. These are provided by last 3 fields in @VirtioInfo.

Quoted 7 lines
Quoted 2 lines

For these who are going make own decision on features and status bitmask, respective fields with raw values are preserved.

Looks sensible. What will you return an for the *-features-names fields if the status field indicates that negotiation is not yet done? (This has some fun interaction with the VERSION_1 feature bit...)

Quoted 4 lines

Hmm... I was going to return current features and theirs acknowledgments regardless if they were negotiated. Thus, *-features-names would contain all exposed host features with false' in acked' field.

acked=false is probably the most sensible approach.

Quoted 29 lines
Quoted 29 lines
Quoted 28 lines

So, I expect following data on the wire in response to `query-virtio' command:

{
    "return": [
        {
            "qom-path":
"/machine/peripheral-anon/device[0]/virtio-backend", "status": 15,
"host-features": 6325010438, "guest-features": 5100273670,
            "status-names": [
                "acknowledge", 
                "driver", 
                "driver-ok", 
                "features-ok"
            ],
            "common-features-names": [
                {"name": "notify-on-empty", "acked": false},
                {"name": "any-layout", "acked": false},
                {"name": "indirect-desc", "acked": true},
                {"name": "event-idx", "acked": true},
                {"name": "bad-feature", "acked": false},
                {"name": "version-1", "acked": true}
            ],
            "device-features-names": [
                {"name": "hotplug", "acked": true},
                {"name": "change", "acked": true}  
Quoted 6 lines
Quoted 3 lines

I suggest to use the #defines as names, especially as they are also used in the spec. Makes grepping easier.

You mean, for example "VIRTIO_RING_F_EVENT_IDX" instead of "event-idx" should be used. Right?

Right, that's what I meant.

Quoted 30 lines
Quoted 27 lines
Quoted 22 lines
            ]
        }
    ]
}

Eric Blake, returning to your question which would probably appear again after this mail:

Quoted 11 lines

Review

Quoted 7 lines
(quoted diff) +6 -0
+##
+# @query-virtio:
...
+##
+{
+    'command': 'query-virtio',
+    'data': { '*path': 'str' },      

Do we need filterable queries, or is it better to just have the command return info on all virtio devices at once and let the client filter the results as desired?

Quoted 2 lines

I think it would be better to do here. I suppose, the client which uses HMP will not be happy on filtering monitor output.

I think being able to optionally specify a path is the most flexible solution.