All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: Ian Jackson <ian.jackson@citrix.com>
Cc: "Simon Gaiser" <simon@invisiblethingslab.com>,
	xen-devel@lists.xenproject.org,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Wei Liu" <wei.liu2@citrix.com>,
	"Eric Shelton" <eshelton@pobox.com>
Subject: Re: [RFC PATCH v2 03/17] libxl: Handle Linux stubdomain specific QEMU options.
Date: Tue, 16 Oct 2018 19:51:55 +0200	[thread overview]
Message-ID: <20181016175155.GC1563@mail-itl> (raw)
In-Reply-To: <23494.7417.911789.655502@mariner.uk.xensource.com>


[-- Attachment #1.1: Type: text/plain, Size: 5442 bytes --]

On Tue, Oct 16, 2018 at 06:16:41PM +0100, Ian Jackson wrote:
> Marek Marczykowski-Górecki writes ("[RFC PATCH v2 03/17] libxl: Handle Linux stubdomain specific QEMU options."):
> > From: Eric Shelton <eshelton@pobox.com>
> > 
> > This patch creates an appropriate command line for the QEMU instance
> > running in a Linux-based stubdomain.
> ...
> > -static const char *libxl_tapif_script(libxl__gc *gc)
> > +static const char *libxl_tapif_script(libxl__gc *gc,
> > +                                      const libxl_domain_build_info *info)
> >  {
> >  #if defined(__linux__) || defined(__FreeBSD__)
> > +    if (info->stubdomain_version == LIBXL_STUBDOMAIN_VERSION_LINUX)
> > +        return libxl__sprintf(gc, "/etc/qemu-ifup");
> > +    return libxl__strdup(gc, "no");
> > +#else
> > +    return GCSPRINTF("%s/qemu-ifup", libxl__xen_script_dir_path());
> > +#endif
> > +}
> > +
> > +static const char *libxl_tapif_downscript(libxl__gc *gc,
> > +                                          const libxl_domain_build_info *info)
> > +{
> > +#if defined(__linux__) || defined(__FreeBSD__)
> > +    if (info->stubdomain_version == LIBXL_STUBDOMAIN_VERSION_LINUX)
> > +        return libxl__sprintf(gc, "/etc/qemu-ifdown");
> 
> We should never have permitted this #ifdefery.  The resulting diff
> here is almost incomprehensible due to the 3 levels of improper
> nesting: diff, ifdef, and code.
> 
> Also we do not currently support any dom0's other than Linux and
> FreeBSD anyway!  So the #ifdef is entirely redundant.  This wasn't 
> noticed when 2b2ef0c54459722943db6166da28e098af12a9e6
>   "libxl: don't use a qemu-ifup script on FreeBSD"
> was prepared and accepted.
> 
> AFAICT this part of this patch is separating out the down and up
> versions of libxl_tapif_script.  The resulting two functions are quite
> similar though.
> 
> I suggest the following series of small changes:
>    1. Drop the #if and all the code in the #else
>    2. Add a libxl__device_action parameter to libxl_tapif_script
>    3. Make your new code check for linux stubdom and if so
>        pass    "qemu" + (action == add) ? "up" :
>                         (action == remove) ? "down" : (abort(),0)
>        or some such
> 
> What do you think ?

Given updated stubdomain doesn't need qemu-ifup/ifdown at all, this
whole chunk can be dropped.

> > @@ -1099,10 +1118,31 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
> >                  return ERROR_INVAL;
> >              }
> >              if (b_info->u.hvm.serial) {
> > -                flexarray_vappend(dm_args,
> > -                                  "-serial", b_info->u.hvm.serial, NULL);
> > -            } else if (b_info->u.hvm.serial_list) {
> > +                if (is_stubdom) {
> > +                    flexarray_vappend(dm_args,
> > +                                      "-serial",
> > +                                      GCSPRINTF("/dev/hvc%d",
> > +                                                STUBDOM_CONSOLE_SERIAL),
> > +                                      NULL);
> > +                } else {
> > +                    flexarray_vappend(dm_args,
> > +                                      "-serial", b_info->u.hvm.serial, NULL);
> > +                }
> > +            } else if (b_info->u.hvm.serial_list &&
> > +                    b_info->u.hvm.serial_list[0]) {
> >                  char **p;
> > +                if (is_stubdom) {
> > +                    if (b_info->u.hvm.serial_list[1]) {
> 
> This can't possibly be right.  The 2nd if is in the else of a
> condition which will always catch all of its cases.

Oh, indeed.

> Also,
> 
> > +                    flexarray_vappend(dm_args,
> > +                                      "-serial",
> > +                                      GCSPRINTF("/dev/hvc%d",
> > +                                                STUBDOM_CONSOLE_SERIAL),
> 
> it repeats some of the code.
> 
> > @@ -1503,7 +1543,9 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
> >               * If qemu isn't doing the interpreting, the parameter is
> >               * always raw
> >               */
> > -            if (disks[i].backend == LIBXL_DISK_BACKEND_QDISK)
> > +            if (libxl_defbool_val(b_info->device_model_stubdomain))
> > +                format = "host_device";
> 
> So I infer that you have created in qemu a "block device format"
> called "host_device" which is actually a pv frontend ?  Or are we
> using Linux's blkfront here ?  In which case why not "raw" ?

"format" is actually passed to "driver" option for -drive. And according
to qemu documentation, "raw" should be used only for regular file, not
block devices. And since qemu 3.0, "raw" driver rejects block devices[1].

> > +            } else if (libxl_defbool_val(b_info->device_model_stubdomain)) {
> > +                target_path = GCSPRINTF("/dev/xvd%c", 'a' + disk);
> 
> Needs an error check in case disk is too large.

Ok.

> Thanks,
> Ian.

[1] https://qemu.weilnetz.de/doc/qemu-doc.html#g_t_002ddrive-file_003djson_003a_007b_002e_002e_002e_007b_0027driver_0027_003a_0027file_0027_007d_007d-_0028since-3_002e0_0029

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

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

  reply	other threads:[~2018-10-16 17:52 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-07  2:16 [RFC PATCH v2 00/17] Add support for qemu-xen runnning in a Linux-based stubdomain Marek Marczykowski-Górecki
2018-08-07  2:16 ` [RFC PATCH v2 01/17] libxl: fix qemu-trad cmdline for no sdl/vnc case Marek Marczykowski-Górecki
2018-08-09  9:19   ` Wei Liu
2018-10-16 16:55   ` Ian Jackson
2018-08-07  2:16 ` [RFC PATCH v2 02/17] libxl: Add "stubdomain_version" to domain_build_info Marek Marczykowski-Górecki
2018-08-09  9:25   ` Wei Liu
2018-09-03 22:25     ` Marek Marczykowski-Górecki
2018-10-16 16:43       ` Ian Jackson
2018-10-16 17:36         ` Marek Marczykowski-Górecki
2018-08-07  2:16 ` [RFC PATCH v2 03/17] libxl: Handle Linux stubdomain specific QEMU options Marek Marczykowski-Górecki
2018-08-09  9:31   ` Wei Liu
2018-08-09 16:23   ` Jason Andryuk
2018-10-16 17:16   ` Ian Jackson
2018-10-16 17:51     ` Marek Marczykowski-Górecki [this message]
2018-10-19  9:32     ` Roger Pau Monné
2018-08-07  2:16 ` [RFC PATCH v2 04/17] libxl: Build the domain with a Linux based stubdomain Marek Marczykowski-Górecki
2018-08-07  2:16 ` [RFC PATCH v2 05/17] libxl: use xenstore for pci hotplug qemu-in-linux-stubdom commands Marek Marczykowski-Górecki
2018-08-07  2:16 ` [RFC PATCH v2 06/17] libxl: create vkb device only for guests with graphics output Marek Marczykowski-Górecki
2018-11-01 17:05   ` Ian Jackson
2018-11-01 20:24     ` Stefano Stabellini
2018-08-07  2:16 ` [RFC PATCH v2 07/17] libxl: add save/restore support for qemu-xen in stubdomain Marek Marczykowski-Górecki
2018-11-01 17:11   ` Ian Jackson
2018-11-01 17:16     ` Marek Marczykowski-Górecki
2018-11-01 17:41       ` Ian Jackson
2018-08-07  2:16 ` [RFC PATCH v2 08/17] xl: add stubdomain related options to xl config parser Marek Marczykowski-Górecki
2018-08-07  2:16 ` [RFC PATCH v2 09/17] libxl: use \x1b to separate qemu arguments for linux stubdomain Marek Marczykowski-Górecki
2018-08-07  2:16 ` [RFC PATCH v2 10/17] xenconsoled: install xenstore watch for all supported consoles Marek Marczykowski-Górecki
2018-09-19 17:43   ` Wei Liu
2018-08-07  2:16 ` [RFC PATCH v2 11/17] xenconsoled: add support for consoles using 'state' xenstore entry Marek Marczykowski-Górecki
2018-11-01 17:21   ` Ian Jackson
2019-01-09 12:21     ` Marek Marczykowski-Górecki
2018-08-07  2:16 ` [RFC PATCH v2 12/17] xenconsoled: make console_type->use_gnttab less confusing Marek Marczykowski-Górecki
2018-11-01 17:25   ` Ian Jackson
2018-08-07  2:16 ` [RFC PATCH v2 13/17] xenconsoled: add support for up to 3 secondary consoles Marek Marczykowski-Górecki
2018-11-01 17:31   ` Ian Jackson
2018-11-01 18:25     ` Marek Marczykowski-Górecki
2018-11-01 20:27     ` Stefano Stabellini
2018-11-02 17:50       ` [RFC PATCH v2 13/17] xenconsoled: add support for up to 3 secondary consoles [and 1 more messages] Ian Jackson
2018-08-07  2:16 ` [RFC PATCH v2 14/17] xenconsoled: deduplicate error handling Marek Marczykowski-Górecki
2018-11-01 17:31   ` Ian Jackson
2018-08-07  2:16 ` [RFC PATCH v2 15/17] xenconsoled: add support for non-pty output Marek Marczykowski-Górecki
2018-11-01 17:35   ` Ian Jackson
2018-11-01 17:54     ` Marek Marczykowski-Górecki
2018-08-07  2:16 ` [RFC PATCH v2 16/17] libxl: access QMP socket via console for qemu-in-stubdomain Marek Marczykowski-Górecki
2018-11-01 17:38   ` Ian Jackson
2018-08-07  2:16 ` [RFC PATCH v2 17/17] libxl: use xenconsoled even for multiple stubdomain's consoles Marek Marczykowski-Górecki
2018-10-16 16:53 ` [RFC PATCH v2 00/17] Add support for qemu-xen runnning in a Linux-based stubdomain Ian Jackson
2018-10-16 17:32   ` Marek Marczykowski-Górecki
2018-10-16 17:52     ` Ian Jackson
2018-10-16 20:46       ` Marek Marczykowski-Górecki
2018-10-17 10:17         ` Ian Jackson
2018-10-17 15:16         ` Ian Jackson
2018-10-17 16:05           ` Marek Marczykowski-Górecki
2018-11-01 16:57             ` Ian Jackson
2018-11-01 17:32               ` Marek Marczykowski-Górecki
2018-11-01 17:48                 ` Ian Jackson
2018-11-01 18:04                   ` Marek Marczykowski-Górecki
2018-11-02 16:53                     ` Ian Jackson
2018-11-02 17:01                       ` [PATCH 0/8] libvchan: Minor improvements Ian Jackson
2018-11-02 17:01                         ` [PATCH 1/8] tools/libvchan: Initialise xs_transaction_t to XBT_NULL, not NULL Ian Jackson
2018-11-06  9:40                           ` Wei Liu
2018-11-02 17:01                         ` [PATCH 2/8] tools/xenstore: Document that xs_close(0) is OK Ian Jackson
2018-11-06  9:41                           ` Wei Liu
2018-11-28 11:41                             ` Wei Liu
2018-11-02 17:01                         ` [PATCH 3/8] tools/libvchan: init_xs_srv: Simplify error handling (1) Ian Jackson
2018-11-06  9:47                           ` Wei Liu
2018-11-02 17:01                         ` [PATCH 4/8] tools/libvchan: init_xs_srv: Simplify error handling (2) Ian Jackson
2018-11-06  9:48                           ` Wei Liu
2018-11-06 11:42                             ` Ian Jackson
2018-11-02 17:01                         ` [PATCH 5/8] tools/libvchan: init_xs_srv: Turn xs retry from goto into for (; ; ) Ian Jackson
2018-11-06  9:48                           ` Wei Liu
2018-11-02 17:01                         ` [PATCH 6/8] tools/libvchan: Add xentoollog to direct dependencies Ian Jackson
2018-11-06  9:48                           ` Wei Liu
2018-11-02 17:01                         ` [PATCH 7/8] tools/libvchan: libxenvchan_*_init: Promise an errno Ian Jackson
2018-11-06  9:49                           ` Wei Liu
2018-11-02 17:01                         ` [PATCH 8/8] tools/libvchan: libxenvchan_client_init: use ENOENT for no server Ian Jackson
2018-11-06 10:00                           ` Wei Liu
2018-11-06 11:45                             ` Ian Jackson
2018-11-06 12:15                               ` Marek Marczykowski-Górecki
2018-11-06 15:57                                 ` Ian Jackson
2018-11-15 17:41                 ` [RFC PATCH v2 00/17] Add support for qemu-xen runnning in a Linux-based stubdomain Anthony PERARD
2018-11-15 18:57                   ` Marek Marczykowski-Górecki
2018-11-16 10:39                     ` Anthony PERARD
2018-11-18 17:25                       ` Marek Marczykowski-Górecki
2018-11-19 12:03                         ` Anthony PERARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181016175155.GC1563@mail-itl \
    --to=marmarek@invisiblethingslab.com \
    --cc=eshelton@pobox.com \
    --cc=ian.jackson@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=simon@invisiblethingslab.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.