All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] libxl: set channel devid when not provided by application
@ 2018-02-26 18:28 Jim Fehlig
  2018-03-01 12:55 ` Wei Liu
  2018-03-02 10:49 ` Roger Pau Monné
  0 siblings, 2 replies; 3+ messages in thread
From: Jim Fehlig @ 2018-02-26 18:28 UTC (permalink / raw)
  To: xen-devel; +Cc: wei.liu2, Jim Fehlig, ian.jackson

Applications like libvirt may not populate a device devid field,
delegating that to libxl. If needed, the application can later
retrieve the libxl-produced devid. Indeed most devices are handled
this way in libvirt, channel devices included.

This works well when only one channel device is defined, but more
than one results in

qemu-system-i386: -chardev socket,id=libxl-channel-1,\
path=/tmp/test-org.qemu.guest_agent.00,server,nowait:
Duplicate ID 'libxl-channel-1' for chardev

Besides the odd '-1' value in the id, multiple channels have the same
id, causing qemu to fail. A simple fix is to set an uninitialized
devid (-1) to the dev_num passed to libxl__init_console_from_channel().

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
---

V2:
Set console devid to channel devid as part of initializing a console
from a channel.

 tools/libxl/libxl_console.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_console.c b/tools/libxl/libxl_console.c
index 39d8430df8..9a02a23c2a 100644
--- a/tools/libxl/libxl_console.c
+++ b/tools/libxl/libxl_console.c
@@ -401,6 +401,9 @@ int libxl__init_console_from_channel(libxl__gc *gc,
 
     /* Perform validation first, allocate second. */
 
+    if (channel->devid == -1)
+        channel->devid = dev_num;
+
     if (!channel->name) {
         LOG(ERROR, "channel %d has no name", channel->devid);
         return ERROR_INVAL;
@@ -446,7 +449,7 @@ int libxl__init_console_from_channel(libxl__gc *gc,
             abort();
     }
 
-    console->devid = dev_num;
+    console->devid = channel->devid;
     console->consback = LIBXL__CONSOLE_BACKEND_IOEMU;
     console->backend_domid = channel->backend_domid;
     console->name = libxl__strdup(NOGC, channel->name);
-- 
2.16.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH V2] libxl: set channel devid when not provided by application
  2018-02-26 18:28 [PATCH V2] libxl: set channel devid when not provided by application Jim Fehlig
@ 2018-03-01 12:55 ` Wei Liu
  2018-03-02 10:49 ` Roger Pau Monné
  1 sibling, 0 replies; 3+ messages in thread
From: Wei Liu @ 2018-03-01 12:55 UTC (permalink / raw)
  To: Jim Fehlig; +Cc: xen-devel, ian.jackson, wei.liu2

On Mon, Feb 26, 2018 at 11:28:39AM -0700, Jim Fehlig wrote:
> Applications like libvirt may not populate a device devid field,
> delegating that to libxl. If needed, the application can later
> retrieve the libxl-produced devid. Indeed most devices are handled
> this way in libvirt, channel devices included.
> 
> This works well when only one channel device is defined, but more
> than one results in
> 
> qemu-system-i386: -chardev socket,id=libxl-channel-1,\
> path=/tmp/test-org.qemu.guest_agent.00,server,nowait:
> Duplicate ID 'libxl-channel-1' for chardev
> 
> Besides the odd '-1' value in the id, multiple channels have the same
> id, causing qemu to fail. A simple fix is to set an uninitialized
> devid (-1) to the dev_num passed to libxl__init_console_from_channel().
> 
> Signed-off-by: Jim Fehlig <jfehlig@suse.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH V2] libxl: set channel devid when not provided by application
  2018-02-26 18:28 [PATCH V2] libxl: set channel devid when not provided by application Jim Fehlig
  2018-03-01 12:55 ` Wei Liu
@ 2018-03-02 10:49 ` Roger Pau Monné
  1 sibling, 0 replies; 3+ messages in thread
From: Roger Pau Monné @ 2018-03-02 10:49 UTC (permalink / raw)
  To: Jim Fehlig; +Cc: xen-devel, wei.liu2, ian.jackson

On Mon, Feb 26, 2018 at 11:28:39AM -0700, Jim Fehlig wrote:
> Applications like libvirt may not populate a device devid field,
> delegating that to libxl. If needed, the application can later
> retrieve the libxl-produced devid. Indeed most devices are handled
> this way in libvirt, channel devices included.
> 
> This works well when only one channel device is defined, but more
> than one results in
> 
> qemu-system-i386: -chardev socket,id=libxl-channel-1,\
> path=/tmp/test-org.qemu.guest_agent.00,server,nowait:
> Duplicate ID 'libxl-channel-1' for chardev
> 
> Besides the odd '-1' value in the id, multiple channels have the same
> id, causing qemu to fail. A simple fix is to set an uninitialized
> devid (-1) to the dev_num passed to libxl__init_console_from_channel().
> 
> Signed-off-by: Jim Fehlig <jfehlig@suse.com>

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-02 10:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-26 18:28 [PATCH V2] libxl: set channel devid when not provided by application Jim Fehlig
2018-03-01 12:55 ` Wei Liu
2018-03-02 10:49 ` Roger Pau Monné

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.