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

Re: [PATCH v3 4/9] x86/PVH: provide VGA console info to Dom0


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Thu, 23 Sep 2021 15:22:50 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=LgSDTGtxKVdLSomQ6SlUTGGVV+6O9JYMKbeZi8zhrW0=; b=RfcTW63cbWeS9sWqH7r3SoU+c+9MZrKnEaoSONWIXazoShWmAJHPzBmiA81e7v7xkAeFiQrefMnOu9yan2Ry3nfLc6cwsafIWftIX4LsO4ZmGfXIYdtuKn7M8D1HNJhZHoytN6+OWVxnqItPoC0CoNU4kI4wKWHijaVrHWntmh/eO4P41Xo4hR5WOtqgXQJIdKf79RC5QK9qYcpKTv5xHVojTWkYcZEtR/59ZLxSpyKAw0DCib16BEZQqy8PVDjl1mzM0otXf8lH5q1LSdUrAPIRNHL+LyL5LqDrO9k2blmZfBiANz4sYD/D6Th/O+b4jdEhQvseSzs7GaDdZjDpOw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lLDK+QxI29Pbk35K+/+aKBR7QnZaQ6kLMI3Tv/lIlwL8DJZP954VRqfURMciK40ZKPsCHTDVzHtzpRhSHSXhhiRqpi3kmgSCu0y7QG1PXRwH7yzfv6rlQVzCYbGgUYjEzJ8wn3GyJ+Xu1FWvM10lQytNLtVU1yO40Qpy6eLwyO5pdwoGsF5P4mxJYkN6HntSEtow4aDhZ+VWdySvutC+kU7bqfbw8SFZNkgatRMictiFMWp4Gf8U1bo7Rjv2/Z3cnOLA5lqi7uLUBBMi+ucZ+R4Er5EiJSRO0EbI0E0uFSvXPz7jTrEEoRdyuyQX19tggWvNdtT61QFS7bXq5aTYMA==
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Thu, 23 Sep 2021 13:23:09 +0000
  • Ironport-data: A9a23:bkYDZ6AVrXNzLRVW//fkw5YqxClBgxIJ4kV8jS/XYbTApDp012YGy zQWWz3VO66Ka2L0fIoiPoW38UNQvZHWz9FqQQY4rX1jcSlH+JHPbTi7wuYcHM8wwunrFh8PA xA2M4GYRCwMo/u1Si6FatANl1ElvU2zbue6WLOs1hxZH1c+EX9w00k7wobVv6Yz6TSHK1LV0 T/Ni5W31G+Ng1aY5UpNtspvADs21BjDkGtwUm4WPJinj3eH/5UhN7oNJLnZEpfNatI88thW5 Qr05OrREmvxp3/BAz4++1rxWhVirrX6ZWBihpfKMkQLb9crSiEai84G2PQghUh/pGqMwM570 uV0hb+qQjoSBIjDmuQMekwNe81+FfUuFL7vJHG+tYqYzlHccmuqyPJrZK00FdRGoKAtWzgIr KFGbmBWBvyAr7veLLaTUO5ji95lNMD2FIgepmth3XfSCvNOrZXrHv6SvoMAhWpYasZmQfrBN s8ITBhUNi+DTh91EWU2DLYEpbL97pX4W2IB8w/EzUYt2EDMyCRh3b6rN8DaEvSaSMMQkkuGq 2bu+2XiHgpcJNGZ0SCC8H+nmqnIhyyTcIAYGaC89/VqqEaO3WFVAxoTPWZXutHg1BT4AYgGb RVJpGx+9sDe6XBHUPHSABjnvnSejicseMBbLtYAzQ6Pyrv9tlPx6nc/chZNb9kvtckTTDMs1 0OUk96BOQGDoIF5WlrGqezJ923a1Tw9aDZYPH5ZEVJtD8zL/dlr5i8jWOqPB0JcYjfdIjj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VxA0XXT9jyaortT GtqX232oyT99WAjjPM3W7a6Jpb3PPn19t4HcSJzuwYMC/lhAqEbJloH5eCoDc2iuey70tCqq iBnz4Qe+BIr1/BdGC8phXgnyHmzTYV8nfnjWSVhHPyyPaJDA4SOo5kv8Z0YxHZ400vsJVXy6 RQxV+UsJJREFfpgDn9z8KgbWArqmOE5V4Z1cIDhX1WVoUTLJVLq5YEwU9TGJAcWArn9YEcFv V0Bs203ocWTbqjVQGagoBT+q3oYpxqdS32BnTq+/blnQS+pUoJjHfxn6ck7zA9HJFUcegM2w 2LCNUvqFniJvVmGZ6VP91xM/dfPFa9Ny4kAFjiUmgPK5t3Tk4li6SHq4ndt9vaMqDh8vMJ6e P8uRVjxDcPR34=
  • Ironport-sdr: 70kYRKc/smLy3vXyZ/IOBPrcLt+tjNzLVTFOQ86dj6MgPOgQRAd0cy0PN6J26l5431DaCh4LXI mxhkRXyva3nxiEMjSFb85ZLbpJjkHBixUjyoy2fSlpJvKuUgC+va6PbPwbTrGEmsYFfzRian2B c56mm+jgRC7k6Plmw/uEfLhWIkCyYEbQtebDq1XvZ7+WeUEKLCT9uW0OziHPoK1CcU8UfQOOt3 gh9QvN014dD+IppNpRPBi4GygAHwah/EVNriDzxq0OkAI5bDfXNgsMyReea45FiLO63HpwmNyb fzJdwB+lM9zEJ1VAD+Zx8wtW
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu, Sep 23, 2021 at 11:46:48AM +0200, Jan Beulich wrote:
> On 22.09.2021 17:01, Roger Pau Monné wrote:
> > On Tue, Sep 21, 2021 at 09:18:05AM +0200, Jan Beulich wrote:
> >> --- a/xen/include/public/arch-x86/hvm/start_info.h
> >> +++ b/xen/include/public/arch-x86/hvm/start_info.h
> >> @@ -33,7 +33,7 @@
> >>   *    | magic          | Contains the magic value 
> >> XEN_HVM_START_MAGIC_VALUE
> >>   *    |                | ("xEn3" with the 0x80 bit of the "E" set).
> >>   *  4 +----------------+
> >> - *    | version        | Version of this structure. Current version is 1. 
> >> New
> >> + *    | version        | Version of this structure. Current version is 2. 
> >> New
> >>   *    |                | versions are guaranteed to be 
> >> backwards-compatible.
> >>   *  8 +----------------+
> >>   *    | flags          | SIF_xxx flags.
> >> @@ -55,7 +55,15 @@
> >>   *    |                | if there is no memory map being provided. Only
> >>   *    |                | present in version 1 and newer of the structure.
> >>   * 52 +----------------+
> >> - *    | reserved       | Version 1 and newer only.
> >> + *    | vga_info.offset| Offset of struct dom0_vga_console_info from base 
> >> of
> > 
> > I'm not sure we are supposed to reference external structures like
> > that. We took a lot of care to not depend on other headers, and to
> > make this as agnostic as possible (IIRC KVM is also capable of using
> > the PVH entry point natively, and hence depends on this header).
> 
> But KVM wouldn't be using a Dom0-only part of the interface, would
> it? (I'm aware of the possible re-using of the entry point.)

I think naming it as dom0-only is part of the problem. In principle I
don't see why you couldn't use such structure to report VGA console
information when inside of a VM that has such device.

> > IF we want to add support for dom0_vga_console_info I think we need to
> > at least provide a binary layout for it, like all the other pieces
> > that are part of the HVM start info.
> 
> Which then means we can't sensibly re-use the existing structure,
> as that doesn't have as strict rules as the hvm_start_info one.
> Which in turn means Linux can't re-use the code converting
> dom0_vga_console_info, resulting in two places needing updating
> whenever information gets add to (then) both structures (what
> information they carry will, after all, want to remain in sync).

Indeed. I don't think there's a way for us to cut corners here. As
said above, I don't think we should explicitly limit the usage of this
information to Xen dom0, and hence should be a first class addition to
the start info contents.

> >> + *    |                | struct hvm_start_info. Optional and only present 
> >> in
> >> + *    |                | version 2 and newer of the structure when
> >> + *    |                | SIF_INITDOMAIN is set; zero if absent.
> > 
> > We have usually used an absolute physical address to reference other
> > data, and I think we should likely keep in that way for coherency.
> 
> Hmm. (See below.)
> 
> >> + * 54 +----------------+
> >> + *    | vga_info.size  | Size of present parts of struct 
> >> dom0_vga_console_info.
> >> + *    |                | Optional and only present in version 2 and newer 
> >> of
> >> + *    |                | the structure when SIF_INITDOMAIN is set; zero if
> >> + *    |                | absent.
> >>   * 56 +----------------+
> >>   *
> >>   * The layout of each entry in the module structure is the following:
> >> @@ -139,7 +147,15 @@ struct hvm_start_info {
> >>      uint32_t memmap_entries;    /* Number of entries in the memmap table. 
> >>    */
> >>                                  /* Value will be zero if there is no 
> >> memory  */
> >>                                  /* map being provided.                    
> >>    */
> >> -    uint32_t reserved;          /* Must be zero.                          
> >>    */
> > 
> > This 'Must be zero' comment troubles me a bit, I'm not convinced we
> > can just place data here (ie: it would no longer be 0). It's even
> > worse because the must be zero comment is only present in the C
> > representation of the struct, the layout above just denotes the field
> > is reserved (which would imply it's fine to use for other means in
> > v2).
> 
> I thought the textual description was meant to be the ABI spec. The C
> comment should therefore be viewed as if missing "in version 1" or
> "presently".
> 
> Taking into account also Andrew's reply, I have to admit that I'm
> inclined to request that one of the two of you fix this obvious
> shortcoming in both Xen and Linux. I'm not really willing to be the one
> to introduce a 2nd layout for the same set of data just for the purpose
> of "playing nice" in an area where that, affecting Dom0 only, doesn't
> seem to matter all this much. My goal was rather to keep the impact on
> hvm_start_info as low as possible (and in particular avoid changing its
> size, as strictly speaking Linux'es consumer implementation is buggy:
> It would always copy as much data as it knows _may_ be present, not as
> little data as may have been _actually_ provided; whoever implemented
> this did only consider one half of the compatibility requirements,
> quite likely simply because in the design this aspect was also missed,
> or else the structure would have had a length field right from its
> introduction).

The isn't a strict need to have several different layouts on the
consumer, as you could easily use offsetof to copy up to the boundary
you know it's populated given a version number. But yes, a size field
would be useful to prevent the consumer from having to know the
version boundaries.

I can try to take a stab at implementing this at a later point, I
certainly don't want to force you into implementing something you
believe it's not the correct solution.

Thanks, Roger.



 


Rackspace

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