[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tools: use libxenlight for writing xenstore-stubdom console nodes


  • To: Juergen Gross <jgross@xxxxxxxx>
  • From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Date: Tue, 21 Mar 2023 15:02:36 +0000
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 21 Mar 2023 15:03:10 +0000
  • Ironport-data: A9a23:K7a9lqBJwhq4bBVW/yfjw5YqxClBgxIJ4kV8jS/XYbTApGslhDYBn GdKWzzUaf+PNGugKot0Pd6wp0MA6MPUyYAwQQY4rX1jcSlH+JHPbTi7wuUcHAvJd5GeExg3h yk6QoOdRCzhZiaE/n9BCpC48T8nk/nOHuGmYAL9EngZbRd+Tys8gg5Ulec8g4p56fC0GArIs t7pyyHlEAbNNwVcbyRFu8pvlDs15K6p4GhC5wRkDRx2lAS2e0c9Xcp3yZ6ZdxMUcqEMdsamS uDKyq2O/2+x13/B3fv8z94X2mVTKlLjFVDmZkh+AsBOsTAbzsAG6Y4pNeJ0VKtio27hc+ada jl6ncfYpQ8BZsUgkQmGOvVSO3kW0aZuoNcrLZUj2CA6IoKvn3bEmp1T4E8K0YIw5r9+EVBU9 84hczkqfz3Su8nsmei5c7w57igjBJGD0II3v3hhyXfSDOo8QICFSKLPjTNa9G5u3IYUR6+YP pdHL2M1N3wsYDUWUrsTIJs4gOevgGi5azBCoUiZjaE2/3LS3Ep6172F3N/9I4TTHZUFwBvEz o7A1zj9PiwCaPnC9T+i1n+OhdPKpSDQXbtHQdVU8dY12QbOlwT/EiY+Sl+TsfS/zEmkVLp3I lQZ4CM0oYAu9UagSZ/2WBjQiHyLpBkHQPJLDvY3rgqKz8L88wufQ2QJUDNFQNgnr9MtAywn0 EeTmNHkDiApt6eaIU9x7Z/N82n0Y3JMazZfO2ldF1BtD8TfTJ8bkkvGXud5EpyM1dTSCByh/ xvQ9XI8vuBG5SIU7JlX7Wwrkhr1+MeYFVBotlyMNo62xlgnPdD4PuRE/XCetK8dd9jBEzFtq VBew6CjAPYy4YZhfcBnaMEEB/mX6vmMK1UwanY/TsB6p1xBF5NOFL28AQ2Sx28zaK7ogRezP CfuVfp5vfe/xkeCY65teJ6WAM8316XmHtmNfqmKMYsVOccpKlTfrHsGiausM4bFyhBErE3CE c3DLZbE4Ykm5VRPk2PtGrZ1PU4DzSEi32LDLa3GI+Cc+ePGPha9EO5dWHPXN7BR0U9xiFiMm zqpH5DRkEs3vSyXSnS/zLP/2nhTdyFmXsCq8JwPHgNBSyI/cFwc5zbq6etJU+RYc259zY8kI lnVtpdk9WfC
  • Ironport-hdrordr: A9a23:ESoW3a+25k79lxOFmnpuk+AbI+orL9Y04lQ7vn2ZLiYlC/Bw9v re+sjzsCWetN9/YhAdcLy7WJVoIkmskqKdg7NhX4tKNTOO0AGVxedZnOjfKhLbalXDH4VmuZ uIHZISNDXUZWIK9reBkXTIb6de/DGlmJrY9Ns39B9WPH9XgtlbnmNE4tDyKCNLrEUqP/UE/e Gnl696TwjJQwVmUiyMbkN1LNQqkLXw5eDbXSI=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Mar 15, 2023 at 04:42:26PM +0100, Juergen Gross wrote:
> @@ -1982,6 +1987,13 @@ int libxl_console_get_tty(libxl_ctx *ctx, uint32_t 
> domid, int cons_num,
>   */
>  int libxl_primary_console_get_tty(libxl_ctx *ctx, uint32_t domid_vm, char 
> **path);
>  
> +/* libxl_console_add_xenstore writes the Xenstore entries for a domain's
> + * primary console based on domid, event channel port and the guest frame
> + * number of the PV console's ring page.
> + */
> +int libxl_console_add_xenstore(libxl_ctx *ctx, uint32_t domid, uint32_t 
> backend,
> +                               int evtch, uint64_t gfn);

Could you make this function async, by adding "const libxl_asyncop_how
*ao_how" parameter in last position?

You can follow libxl_domain_pause() example has to write an async
function that is actually synchronous (AO_CREATE, libxl__ao_complete,
AO_INPROGRESS, AO_CREATE_FAIL).

Adding the async capability now means that we won't need to change the
API if the function actually need to be async one day.

> +
>  /* May be called with info_r == NULL to check for domain's existence.
>   * Returns ERROR_DOMAIN_NOTFOUND if domain does not exist (used to return
>   * ERROR_INVAL for this scenario). */
> diff --git a/tools/libs/light/libxl_console.c 
> b/tools/libs/light/libxl_console.c
> index d8b2bc5465..ce3de100cc 100644
> --- a/tools/libs/light/libxl_console.c
> +++ b/tools/libs/light/libxl_console.c
> @@ -346,6 +346,26 @@ out:
>      return rc;
>  }
>  
> +int libxl_console_add_xenstore(libxl_ctx *ctx, uint32_t domid, uint32_t 
> backend,
> +                               int evtch, uint64_t gfn)
> +{
> +    GC_INIT(ctx);
> +    int rc;
> +    libxl__device_console console = { .backend_domid = backend,
> +                                      .output = "pty",
> +                                      .consback = 
> LIBXL__CONSOLE_BACKEND_XENCONSOLED,
> +                                    };
> +    libxl__domain_build_state state = { .console_port = evtch,

`console_port` is "uint32_t", shouldn't `evtchn` be the same type, or at
least also be unsigned?

> +                                        .console_mfn = gfn,

I wonder if we should check if `gfn` fit in `console_mfn`, as it could
be smaller when building the toolstack on 32bit platform.


Thanks,

-- 
Anthony PERARD



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.