All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: "Roger Pau Monné" <roger.pau@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>,
	Julien Grall <julien.grall@arm.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH for-4.10 3/5] tools/dombuilder: Switch to using gfn terminology for console and xenstore rings
Date: Fri, 6 Oct 2017 11:03:39 +0100	[thread overview]
Message-ID: <cb51510b-a0e5-3497-8fcb-b99f828a7704@citrix.com> (raw)
In-Reply-To: <20171006095722.c2mg4k56hdm6o3fm@MacBook-Pro-de-Roger.local>

On 06/10/17 10:57, Roger Pau Monné wrote:
> On Thu, Oct 05, 2017 at 06:23:41PM +0000, Andrew Cooper wrote:
>>  
>> -    xc_dom_printf(xch, "%s: called, pfn=0x%"PRI_xen_pfn, __FUNCTION__,
>> -                  scratch_gpfn);
>> +    xc_dom_printf(xch, "%s: called, scratch gfn=0x%"PRI_xen_pfn, __FUNCTION__,
>> +                  scratch_gfn);
>>  
>>  
>>      rc = do_memory_op(xch, XENMEM_add_to_physmap, &xatp, sizeof(xatp));
>> @@ -357,7 +357,7 @@ int xc_dom_gnttab_hvm_seed(xc_interface *xch, domid_t domid,
>>      }
>>  
>>      rc = xc_dom_gnttab_seed(xch, domid,
>> -                            console_gpfn, xenstore_gpfn,
>> +                            console_gfn, xenstore_gfn,
>>                              console_domid, xenstore_domid);
>>      if (rc != 0)
>>      {
>> @@ -385,12 +385,11 @@ int xc_dom_gnttab_init(struct xc_dom_image *dom)
>>  {
>>      if ( xc_dom_translated(dom) ) {
>>          return xc_dom_gnttab_hvm_seed(dom->xch, dom->guest_domid,
>> -                                      dom->console_pfn, dom->xenstore_pfn,
>> +                                      dom->console_gfn, dom->xenstore_gfn,
>>                                        dom->console_domid, dom->xenstore_domid);
>>      } else {
>>          return xc_dom_gnttab_seed(dom->xch, dom->guest_domid,
>> -                                  xc_dom_p2m(dom, dom->console_pfn),
>> -                                  xc_dom_p2m(dom, dom->xenstore_pfn),
>> +                                  dom->console_gfn, dom->xenstore_gfn,
>>                                    dom->console_domid, dom->xenstore_domid);
> return xc_dom_translated(dom) ? xc_dom_gnttab_hvm_seed : xc_dom_gnttab_seed
>                                 (dom->xch, dom->guest_domid, dom->console_gfn,
>                                  dom->xenstore_gfn, dom->console_domid,
>                                  dom->xenstore_domid);
>
> Not sure about the best indentation here. Or that could even be hidden
> inside of xc_dom_gnttab_seed, so that xc_dom_gnttab_hvm_seed can be
> removed.

These seed functions are also needed in isolation from the migration
code, so I can't make them local.  I considered what you suggest here,
but I'm not sure that it helps the readability.

>
>>      }
>>  }
>> diff --git a/tools/libxc/xc_dom_compat_linux.c b/tools/libxc/xc_dom_compat_linux.c
>> index c922c61..6d27ec2 100644
>> --- a/tools/libxc/xc_dom_compat_linux.c
>> +++ b/tools/libxc/xc_dom_compat_linux.c
>> @@ -78,8 +78,8 @@ int xc_linux_build(xc_interface *xch, uint32_t domid,
>>      if ( (rc = xc_dom_gnttab_init(dom)) != 0)
>>          goto out;
>>  
>> -    *console_mfn = xc_dom_p2m(dom, dom->console_pfn);
>> -    *store_mfn = xc_dom_p2m(dom, dom->xenstore_pfn);
>> +    *console_mfn = dom->console_gfn;
>> +    *store_mfn = dom->xenstore_gfn;
>>  
>>   out:
>>      xc_dom_release(dom);
>> diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c
>> index 0c80b59..aa0ced1 100644
>> --- a/tools/libxc/xc_dom_x86.c
>> +++ b/tools/libxc/xc_dom_x86.c
>> @@ -536,21 +536,23 @@ static int alloc_p2m_list_x86_64(struct xc_dom_image *dom)
>>  
>>  static int alloc_magic_pages_pv(struct xc_dom_image *dom)
>>  {
>> +    xen_pfn_t pfn;
>> +
>>      dom->start_info_pfn = xc_dom_alloc_page(dom, "start info");
>>      if ( dom->start_info_pfn == INVALID_PFN )
>>          return -1;
>>  
>> -    dom->xenstore_pfn = xc_dom_alloc_page(dom, "xenstore");
>> -    if ( dom->xenstore_pfn == INVALID_PFN )
>> +    pfn = xc_dom_alloc_page(dom, "xenstore");
>> +    if ( pfn == INVALID_PFN )
>>          return -1;
>> -    xc_clear_domain_page(dom->xch, dom->guest_domid,
>> -                         xc_dom_p2m(dom, dom->xenstore_pfn));
>> +    dom->xenstore_gfn = xc_dom_p2m(dom, pfn);
>> +    xc_clear_domain_page(dom->xch, dom->guest_domid, dom->xenstore_gfn);
>>  
>> -    dom->console_pfn = xc_dom_alloc_page(dom, "console");
>> -    if ( dom->console_pfn == INVALID_PFN )
>> +    pfn = xc_dom_alloc_page(dom, "console");
>> +    if ( pfn == INVALID_PFN )
>>          return -1;
>> -    xc_clear_domain_page(dom->xch, dom->guest_domid,
>> -                         xc_dom_p2m(dom, dom->console_pfn));
>> +    dom->console_gfn = xc_dom_p2m(dom, pfn);
>> +    xc_clear_domain_page(dom->xch, dom->guest_domid, dom->console_gfn);
>>  
>>      dom->alloc_bootstack = 1;
>>  
>> @@ -612,14 +614,19 @@ static int alloc_magic_pages_hvm(struct xc_dom_image *dom)
>>                                 X86_HVM_NR_SPECIAL_PAGES) )
>>              goto error_out;
>>  
>> -    xc_hvm_param_set(xch, domid, HVM_PARAM_STORE_PFN,
>> -                     special_pfn(SPECIALPAGE_XENSTORE));
>> +    dom->xenstore_gfn = special_pfn(SPECIALPAGE_XENSTORE);
> A pre-patch to s/special_pfn/special_gfn/ would be nice :) for
> coherency.

Sorting out all terminology is a far larger problem than I have time for
atm.  For HVM guests, pfn == gfn, so I chose not to dive down that
rabbit hole right now.

>
>> diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
>> index ef834e6..0389a06 100644
>> --- a/tools/libxl/libxl_dom.c
>> +++ b/tools/libxl/libxl_dom.c
>> @@ -851,14 +851,9 @@ int libxl__build_pv(libxl__gc *gc, uint32_t domid,
>>      if (ret != 0)
>>          goto out;
>>  
>> -    if (xc_dom_translated(dom)) {
>> -        state->console_mfn = dom->console_pfn;
>> -        state->store_mfn = dom->xenstore_pfn;
>> -        state->vuart_gfn = dom->vuart_gfn;
> This chunk should go with patch 1, it's a PVHv1 leftover also.

Sadly, no its not :(

ARM uses libxl__build_pv(), not libxl__build_hvm()

~Andrew

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

  reply	other threads:[~2017-10-06 10:03 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-05 18:23 [PATCH for-4.10 0/5] tools/dombuilder: Fixes and improvements to grant handling Andrew Cooper
2017-10-05 18:23 ` [PATCH for-4.10 1/5] tools/dombuilder: Drop more PVH v1 leftovers Andrew Cooper
2017-10-06  9:26   ` Roger Pau Monné
2017-10-06  9:33     ` Wei Liu
2017-10-06  9:40       ` Roger Pau Monné
2017-10-06 10:06         ` Wei Liu
2017-10-06  9:33   ` Wei Liu
2017-10-05 18:23 ` [PATCH for-4.10 2/5] tools/dombuilder: Remove clear_page() from xc_dom_boot.c Andrew Cooper
2017-10-06  9:35   ` Roger Pau Monné
2017-10-06  9:51     ` Andrew Cooper
2017-10-06 17:28   ` Wei Liu
2017-10-05 18:23 ` [PATCH for-4.10 3/5] tools/dombuilder: Switch to using gfn terminology for console and xenstore rings Andrew Cooper
2017-10-06  9:57   ` Roger Pau Monné
2017-10-06 10:03     ` Andrew Cooper [this message]
2017-10-06 10:36       ` Roger Pau Monné
2017-10-06 14:48         ` Julien Grall
2017-10-06 17:35           ` Roger Pau Monné
2017-10-06 17:34   ` Wei Liu
2017-10-05 18:23 ` [PATCH for-4.10 4/5] tools/dombuilder: Fix asymetry when setting up " Andrew Cooper
2017-10-06 17:36   ` Wei Liu
2017-10-05 18:23 ` [PATCH for-4.10 4/5] tools/dombuilder: Fix asymmetry " Andrew Cooper
2017-10-06 10:17   ` Roger Pau Monné
2017-10-06 10:27     ` Andrew Cooper
2017-10-05 18:23 ` [PATCH for-4.10 5/5] tools/dombuilder: Prevent failures of xc_dom_gnttab_init() Andrew Cooper
2017-10-06 10:30   ` Roger Pau Monné
2017-10-06 18:04     ` Andrew Cooper
2017-10-09 15:33       ` Wei Liu
2017-10-06 17:39   ` Wei Liu
2017-10-06 18:22     ` Andrew Cooper
2017-10-09 11:03 ` [PATCH for-4.10 0/5] tools/dombuilder: Fixes and improvements to grant handling Julien Grall

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=cb51510b-a0e5-3497-8fcb-b99f828a7704@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=julien.grall@arm.com \
    --cc=roger.pau@citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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.