From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AC9FC433E0 for ; Mon, 25 Jan 2021 09:10:42 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F027822DFB for ; Mon, 25 Jan 2021 09:10:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F027822DFB Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.73932.132868 (Exim 4.92) (envelope-from ) id 1l3xtC-0000X1-5o; Mon, 25 Jan 2021 09:10:26 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 73932.132868; Mon, 25 Jan 2021 09:10:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l3xtC-0000Wu-2b; Mon, 25 Jan 2021 09:10:26 +0000 Received: by outflank-mailman (input) for mailman id 73932; Mon, 25 Jan 2021 09:10:24 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l3xtA-0000Wp-8E for xen-devel@lists.xenproject.org; Mon, 25 Jan 2021 09:10:24 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 3932e87b-b94c-40d9-8606-23db11b36836; Mon, 25 Jan 2021 09:10:21 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 4F84BAB9F; Mon, 25 Jan 2021 09:10:20 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 3932e87b-b94c-40d9-8606-23db11b36836 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1611565820; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/TJgoVs/WzEQIWDeuxumMsM8gUlVDXVf4LeEwKWMXp4=; b=TiMRqMMaIarmeGog18mxpiD9k/3+53FfOJyZmWviCMFcg6QbJepNsKvIiSizZd9I2V4cra JWO8By94DXL51EoLnneKsTci4M5a7KCDrpEhzAVcRN/7r6xl0xYrfiDVJKyahDICELWZZu oQpaJmiAfZc9vSnluDDnotXoY3pkmPk= Subject: Re: [PATCH 2/6] x86/mm: p2m_add_foreign() is HVM-only To: Julien Grall Cc: "xen-devel@lists.xenproject.org" , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , George Dunlap , Andrew Cooper , Oleksandr References: <2dcbe286-4112-e4b3-dc12-9691154365b3@suse.com> <448a6ef3-2cbd-da9c-e4ef-88122d246833@gmail.com> <18c21c64-d350-482a-c778-c8478d3daf2c@suse.com> <257224ea-4ba3-302e-e198-e92c8c1036b3@suse.com> <898d609c-8652-e43d-4400-27986cc37371@gmail.com> <9523a20e-0b26-51b4-a13a-5767584389cf@xen.org> From: Jan Beulich Message-ID: <1871bc85-613a-5461-e428-d880c4fa95de@suse.com> Date: Mon, 25 Jan 2021 10:10:22 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <9523a20e-0b26-51b4-a13a-5767584389cf@xen.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit 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