All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Cc: Keir Fraser <keir@xen.org>
Subject: Re: [PATCH] x86: partially revert use of 2M mappings for hypervisor image
Date: Mon, 14 Mar 2016 15:23:31 +0000	[thread overview]
Message-ID: <56E6D773.3030302@citrix.com> (raw)
In-Reply-To: <56E6E2F202000078000DC1A9@prv-mh.provo.novell.com>

On 14/03/16 15:12, Jan Beulich wrote:
> As explained by Andrew in
> http://lists.xenproject.org/archives/html/xen-devel/2016-03/msg01380.html 
> that change makes the uncompressed xen.gz image too large for certain
> boot environments. As a result this change makes some of the effects of
> commits cf393624ee ("x86: use 2M superpages for text/data/bss
> mappings") and 53aa3dde17 ("x86: unilaterally remove .init mappings")
> conditional, restoring alternative previous code where necessary. This
> is so that xen.efi can still benefit from the new mechanisms, as it is
> unaffected by said limitations.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> ---
> The first, neater attempt (making the __2M_* symbols weak) failed:
> - older gcc doesn't access the weak symbols through .got
> - GOTPCREL relocations get treated just like PCREL ones by ld when
>   linking xen.efi
>
> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c
> @@ -497,6 +497,17 @@ static void __init kexec_reserve_area(st
>  #endif
>  }
>  
> +static inline bool_t using_2M_mapping(void)
> +{
> +    return !l1_table_offset((unsigned long)__2M_text_end) &&
> +           !l1_table_offset((unsigned long)__2M_rodata_start) &&
> +           !l1_table_offset((unsigned long)__2M_rodata_end) &&
> +           !l1_table_offset((unsigned long)__2M_init_start) &&
> +           !l1_table_offset((unsigned long)__2M_init_end) &&
> +           !l1_table_offset((unsigned long)__2M_rwdata_start) &&
> +           !l1_table_offset((unsigned long)__2M_rwdata_end);

I would recommend

#ifdef EFI
return 1;
#else
return 0;
#endif

The compiler is unable to collapse that expression into a constant,
because it can only be evaluated at link time.

> +}
> +
>  static void noinline init_done(void)
>  {
>      void *va;
> @@ -509,10 +520,19 @@ static void noinline init_done(void)
>      for ( va = __init_begin; va < _p(__init_end); va += PAGE_SIZE )
>          clear_page(va);
>  
> -    /* Destroy Xen's mappings, and reuse the pages. */
> -    destroy_xen_mappings((unsigned long)&__2M_init_start,
> -                         (unsigned long)&__2M_init_end);
> -    init_xenheap_pages(__pa(__2M_init_start), __pa(__2M_init_end));
> +    if ( using_2M_mapping() )
> +    {
> +        /* Destroy Xen's mappings, and reuse the pages. */

I would be tempted to leave this comment back outside using_2M_mapping()
which reduces the size of this hunk.

> +        destroy_xen_mappings((unsigned long)&__2M_init_start,
> +                             (unsigned long)&__2M_init_end);
> +        init_xenheap_pages(__pa(__2M_init_start), __pa(__2M_init_end));
> +    }
> +    else
> +    {
> +        destroy_xen_mappings((unsigned long)&__init_begin,
> +                             (unsigned long)&__init_end);
> +        init_xenheap_pages(__pa(__init_begin), __pa(__init_end));
> +    }
>  
>      printk("Freed %ldkB init memory.\n", (long)(__init_end-__init_begin)>>10);
>  
> @@ -922,6 +942,8 @@ void __init noreturn __start_xen(unsigne
>               * Undo the temporary-hooking of the l1_identmap.  __2M_text_start
>               * is contained in this PTE.
>               */
> +            BUG_ON(l2_table_offset((unsigned long)_erodata) ==
> +                   l2_table_offset((unsigned long)_stext));

Is this intentional to stay, or the remnants of debugging?

Irrespective of some of these minor tweaks, Reviewed-by: Andrew Cooper
<andrew.cooper3@citrix.com>

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

  reply	other threads:[~2016-03-14 15:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-14 15:12 [PATCH] x86: partially revert use of 2M mappings for hypervisor image Jan Beulich
2016-03-14 15:23 ` Andrew Cooper [this message]
2016-03-14 15:41   ` Jan Beulich
2016-03-14 16:10     ` Andrew Cooper

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=56E6D773.3030302@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=keir@xen.org \
    --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.