All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Julien Grall <julien@xen.org>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>,
	"George Dunlap" <george.dunlap@citrix.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	Oleksandr <olekstysh@gmail.com>
Subject: Re: [PATCH 2/6] x86/mm: p2m_add_foreign() is HVM-only
Date: Mon, 25 Jan 2021 10:10:22 +0100	[thread overview]
Message-ID: <1871bc85-613a-5461-e428-d880c4fa95de@suse.com> (raw)
In-Reply-To: <9523a20e-0b26-51b4-a13a-5767584389cf@xen.org>

On 23.01.2021 14:22, Julien Grall wrote:
> On 13/01/2021 15:06, Oleksandr wrote:
>> On 12.01.21 13:58, Jan Beulich wrote:
>>> On 11.01.2021 09:23, Oleksandr wrote:
>>>> On 11.01.21 09:41, Jan Beulich wrote:
>>>>> If you could also provide your exact .config, I could see whether I
>>>>> can repro here with some of the gcc5 versions I have laying around.
>>>> Please see attached
>>> Builds perfectly fine with 5.4.0 here.
>>
>> Thank you for testing.
>>
>>
>> I wonder whether I indeed missed something. I have switched to 5.4.0 
>> again (from 9.3.0) and rechecked, a build issue was still present.
>> I even downloaded 5.4.0 sources and built them to try to build Xen, and 
>> got the same effect.  What I noticed is that for non-debug builds the 
>> build issue wasn't present.
>> Then I decided to build today's staging 
>> (414be7b66349e7dca42bc1fd47c2b2f5b2d27432 xen/memory: Fix compat 
>> XENMEM_acquire_resource for size requests) instead of 9-day's old one when
>> I had initially reported about that build issue 
>> (7ba2ab495be54f608cb47440e1497b2795bd301a x86/p2m: Fix 
>> paging_gva_to_gfn() for nested virt). Today's staging builds perfectly 
>> fine with 5.4.0.
>> It seems that commit in the middle 
>> (994f6478a48a60e3b407c7defc2d36a80f880b04 xsm/dummy: harden against 
>> speculative abuse) indirectly fixes that weird build issue with 5.4.0...
> 
> The gitlab CI reported a similar issue today (see [1]) when building 
> with randconfig ([2]). This is happening on Debian sid with GCC 9.3.
> 
> Note that the default compiler on sid is GCC 10.2.1. So you will have to 
> install the package gcc-9 and then use CC=gcc-9 make <...>.
> 
> 
>  From a local repro, I get the following message:
> 
> ld: ld: prelink.o: in function `xenmem_add_to_physmap_batch':
> /root/xen/xen/common/memory.c:942: undefined reference to 
> `xenmem_add_to_physmap_one'
> /root/xen/xen/common/memory.c:942:(.text+0x22145): relocation truncated 
> to fit: R_X86_64_PLT32 against undefined symbol `xenmem_add_to_physmap_one'
> prelink-efi.o: in function `xenmem_add_to_physmap_batch':
> /root/xen/xen/common/memory.c:942: undefined reference to 
> `xenmem_add_to_physmap_one'
> make[2]: *** [Makefile:215: /root/xen/xen/xen.efi] Error 1
> make[2]: *** Waiting for unfinished jobs....
> ld: /root/xen/xen/.xen-syms.0: hidden symbol `xenmem_add_to_physmap_one' 
> isn't defined
> ld: final link failed: bad value
> 
> 
> This points to the call in xenmem_add_to_physmap_batch(). I have played 
> a bit with the .config options. I was able to get it built as soon as I 
> disabled CONFIG_COVERAGE=y.
> 
> So maybe the optimizer is not clever enough on GCC 9 when building with 
> coverage enabled?
> 
> With the diff below applied (borrowed from 
> xenmem_add_to_physmap_batch()), I can build without tweaking the .config 
> [1]:
> 
> diff --git a/xen/common/memory.c b/xen/common/memory.c
> index ccb4d49fc6..5cfd36a53d 100644
> --- a/xen/common/memory.c
> +++ b/xen/common/memory.c
> @@ -903,6 +903,12 @@ static int xenmem_add_to_physmap_batch(struct 
> domain *d,
>   {
>       union add_to_physmap_extra extra = {};
> 
> +    if ( !paging_mode_translate(d) )
> +    {
> +        ASSERT_UNREACHABLE();
> +        return -EACCES;
> +    }
> +
>       if ( unlikely(xatpb->size < extent) )
>           return -EILSEQ;

Interesting. So despite the function being static and
xatp_permission_check() already doing this check, the function
doesn't get squashed. Looking at my gcov build this might be
due to xatp_permission_check() not getting inlined in this
case, but I will need to try one with HVM=n to be certain. In
any event, I wouldn't mind the above as a workaround to the
issue, as long as its description makes clear this is a
workaround only.

Thanks for investigating!

Jan


  reply	other threads:[~2021-01-25  9:10 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15 16:24 [PATCH 0/6] x86/p2m: restrict more code to build just for HVM Jan Beulich
2020-12-15 16:25 ` [PATCH 1/6] x86/p2m: tidy p2m_add_foreign() a little Jan Beulich
2020-12-17 19:03   ` Andrew Cooper
2020-12-18  8:39     ` Jan Beulich
2020-12-15 16:26 ` [PATCH 2/6] x86/mm: p2m_add_foreign() is HVM-only Jan Beulich
2020-12-17 19:18   ` Andrew Cooper
2020-12-18  8:48     ` Jan Beulich
2020-12-21  8:10     ` Jan Beulich
2020-12-22 10:40       ` Andrew Cooper
2021-01-04 16:57         ` Oleksandr Tyshchenko
2021-01-05  8:48           ` Jan Beulich
2021-01-08 16:38             ` Oleksandr
2021-01-08 17:01               ` Jan Beulich
2021-01-08 17:37                 ` Oleksandr
2021-01-11  7:41                   ` Jan Beulich
2021-01-11  8:23                     ` Oleksandr
2021-01-12 11:58                       ` Jan Beulich
2021-01-13 15:06                         ` Oleksandr
2021-01-23 13:22                           ` Julien Grall
2021-01-25  9:10                             ` Jan Beulich [this message]
2021-01-25 10:33                             ` Jan Beulich
2020-12-15 16:26 ` [PATCH 3/6] x86/p2m: set_{foreign,mmio}_p2m_entry() are HVM-only Jan Beulich
2020-12-17 19:54   ` Andrew Cooper
2020-12-18  8:58     ` Jan Beulich
2020-12-15 16:26 ` [PATCH 4/6] x86/p2m: {,un}map_mmio_regions() " Jan Beulich
2020-12-15 16:27 ` [PATCH 5/6] x86/mm: the gva_to_gfn() hook is HVM-only Jan Beulich
2020-12-22 17:02   ` Jan Beulich
2020-12-15 16:28 ` [PATCH 6/6] x86/p2m: set_shared_p2m_entry() is MEM_SHARING-only Jan Beulich
2020-12-15 17:05   ` Tamas K Lengyel

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=1871bc85-613a-5461-e428-d880c4fa95de@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=julien@xen.org \
    --cc=olekstysh@gmail.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@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.