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=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 47F9BC433DB for ; Mon, 4 Jan 2021 16:58:21 +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 F25C12072C for ; Mon, 4 Jan 2021 16:58:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F25C12072C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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.61391.107985 (Exim 4.92) (envelope-from ) id 1kwTBH-0007LD-5U; Mon, 04 Jan 2021 16:58:07 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 61391.107985; Mon, 04 Jan 2021 16:58:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kwTBH-0007L6-2P; Mon, 04 Jan 2021 16:58:07 +0000 Received: by outflank-mailman (input) for mailman id 61391; Mon, 04 Jan 2021 16:58:05 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kwTBF-0007L1-4d for xen-devel@lists.xenproject.org; Mon, 04 Jan 2021 16:58:05 +0000 Received: from mail-wr1-x435.google.com (unknown [2a00:1450:4864:20::435]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 18e455b4-2a34-41a9-ac5e-f31d7c1d3afd; Mon, 04 Jan 2021 16:58:03 +0000 (UTC) Received: by mail-wr1-x435.google.com with SMTP id q18so32928163wrn.1 for ; Mon, 04 Jan 2021 08:58:03 -0800 (PST) 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: 18e455b4-2a34-41a9-ac5e-f31d7c1d3afd DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AISa4LI6Am9s0B0I2KO/fhKUg7R+vgA9tphxnedbjEA=; b=pt8GkoCxgHoaF2EJrKS0BbN6btxqnvVKwp43ZhtyPdTzGm1Wlg6rMKatTI7lCK7IT/ 3E1ffWjDAN9z2zE4Zuoo0nHmTZmLTfwzemSsMKlqIb0CgDA71MmLmqdjrv/pYvFGkxWx IYaNulprWQxqwHZvlR127Ntw+b7Kf902gX8NHAQbWgrzEh8b3hSHPXw6APlK7CBQ+Ubn CgbyKnyOHiAuHlo6NNJcP8GWqkt9ZRjCVFoOwG0waF3We+ykSPRqreTBAwnssz9dW2Sy GhuWLP7jH+TDhSndc2BnYinFYdpdObb9PtBp9VMmB9RCYQV/cpTZt5isBYX5h6dpTkyu vy/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AISa4LI6Am9s0B0I2KO/fhKUg7R+vgA9tphxnedbjEA=; b=GuMAio0P8FZn8sk6s2MblWmnti9XJaANSYWA5F0UIHW8BI7Rf5RwtPvOiO3AJm4JS1 THpauvePUmQj9F7Kx2+tqiDxojsyoW+LIJ33dHaRXgujysa5NlJGd/rlAB4KR2T8VK7K X8lzBcs0S3ovb9j7t6hGkojd0BKCQKWgITga1mqoczW9m/Ie2z4QazMqlVwilmfv9YoI MSFI2GyG63mvXkcaHxnHSdCqIbztzTBvzL0DE0bNI8OQ3Cp3l2xVHX0A/vfvDqv8o4Zn EEOASC0bf+nXi7r3kz/DpvWyfTKTKBnEf7AEtyR+y7IvV9kQ4AsIJjGJg86DT3THKJDi qF1g== X-Gm-Message-State: AOAM533yR0RryYoH7I5vRxZ/SfFHOA5wUAnTuibIu7fj4IPkwTP6Vfiv ahz2abwV12nN9cio6Qe5rTkARInC73a7x0AuL6M= X-Google-Smtp-Source: ABdhPJw3d6ifTiiSTCC3ZanFBDWD0DuxYzWnnnz6hk9u+pwO0Rqtg6XZvU2/TIyv8/4jQYFfN1Ba6AD0sPsBlv4UByo= X-Received: by 2002:a5d:5147:: with SMTP id u7mr82447818wrt.114.1609779482689; Mon, 04 Jan 2021 08:58:02 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Oleksandr Tyshchenko Date: Mon, 4 Jan 2021 18:57:51 +0200 Message-ID: Subject: Re: [PATCH 2/6] x86/mm: p2m_add_foreign() is HVM-only To: Jan Beulich , Andrew Cooper Cc: "xen-devel@lists.xenproject.org" , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= , George Dunlap Content-Type: multipart/alternative; boundary="0000000000003b82df05b815fea0" --0000000000003b82df05b815fea0 Content-Type: text/plain; charset="UTF-8" Hello all. [Sorry for the possible format issues] On Tue, Dec 22, 2020 at 12:41 PM Andrew Cooper wrote: > On 21/12/2020 08:10, Jan Beulich wrote: > > On 17.12.2020 20:18, Andrew Cooper wrote: > >> On 15/12/2020 16:26, Jan Beulich wrote: > >>> This is together with its only caller, xenmem_add_to_physmap_one(). > >> I can't parse this sentence. Perhaps "... as is it's only caller," as a > >> follow-on from the subject sentence. > >> > >>> Move > >>> the latter next to p2m_add_foreign(), allowing this one to become > static > >>> at the same time. > >>> > >>> Signed-off-by: Jan Beulich > >> Acked-by: Andrew Cooper > > So I had to ask Andrew to revert this (I was already at home when > > noticing the breakage), as it turned out to break the shim build. > > The problem is that xenmem_add_to_physmap() is non-static and > > hence can't be eliminated altogether by the compiler when !HVM. > > We could make the function conditionally static > > "#if !defined(CONFIG_X86) && !defined(CONFIG_HVM)", but this > > looks uglier to me than this extra hunk: > > > > --- unstable.orig/xen/common/memory.c > > +++ unstable/xen/common/memory.c > > @@ -788,7 +788,11 @@ int xenmem_add_to_physmap(struct domain > > union add_to_physmap_extra extra = {}; > > struct page_info *pages[16]; > > > > - ASSERT(paging_mode_translate(d)); > > + if ( !paging_mode_translate(d) ) > > + { > > + ASSERT_UNREACHABLE(); > > + return -EACCES; > > + } > > > > if ( xatp->space == XENMAPSPACE_gmfn_foreign ) > > extra.foreign_domid = DOMID_INVALID; > > > > Andrew, please let me know whether your ack stands with this (or > > said alternative) added, or whether you'd prefer me to re-post. > > Yeah, this is probably neater than the ifdefary. My ack stands. > > ~Andrew > I might miss something or did incorrect tests, but ... ... trying to build current staging (7ba2ab495be54f608cb47440e1497b2795bd301a) for x86 (with # CONFIG_HVM is not set) I got the following: /media/b/build/build/tmp/work/x86_64-xt-linux/domd-image-weston/1.0-r0/repo/build/tmp/work/aarch64-poky-linux/xen/4.14.0+gitAUTOINC+2c6e5a8ceb-r0/git/xen/common/memory.c:941: undefined reference to `xenmem_add_to_physmap_one' /media/b/build/build/tmp/work/x86_64-xt-linux/domd-image-weston/1.0-r0/repo/build/tmp/work/aarch64-poky-linux/xen/4.14.0+gitAUTOINC+2c6e5a8ceb-r0/git/xen/common/memory.c:941:(.text+0x1e391): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `xenmem_add_to_physmap_one' ld: /media/b/build/build/tmp/work/x86_64-xt-linux/domd-image-weston/1.0-r0/repo/build/tmp/work/aarch64-poky-linux/xen/4.14.0+gitAUTOINC+2c6e5a8ceb-r0/git/xen/.xen-syms.0: hidden symbol `xenmem_add_to_physmap_one' isn't defined ld: final link failed: Bad value It is worth mentioning that I do not use pvshim_defconfig (I disable HVM support via menuconfig manually before building). -- Regards, Oleksandr Tyshchenko --0000000000003b82df05b815fea0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Hello all.

<= /div>
[Sorry for the possible format issues]

On Tue, Dec 22, 2020 at 12:= 41 PM Andrew Cooper <andrew.cooper3@citrix.com> wrote:
On 21/12/2020 08:10, Jan Beulich wrote= :
> On 17.12.2020 20:18, Andrew Cooper wrote:
>> On 15/12/2020 16:26, Jan Beulich wrote:
>>> This is together with its only caller, xenmem_add_to_physmap_o= ne().
>> I can't parse this sentence.=C2=A0 Perhaps "... as is it&= #39;s only caller," as a
>> follow-on from the subject sentence.
>>
>>>=C2=A0 Move
>>> the latter next to p2m_add_foreign(), allowing this one to bec= ome static
>>> at the same time.
>>>
>>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
> So I had to ask Andrew to revert this (I was already at home when
> noticing the breakage), as it turned out to break the shim build.
> The problem is that xenmem_add_to_physmap() is non-static and
> hence can't be eliminated altogether by the compiler when !HVM. > We could make the function conditionally static
> "#if !defined(CONFIG_X86) && !defined(CONFIG_HVM)", = but this
> looks uglier to me than this extra hunk:
>
> --- unstable.orig/xen/common/memory.c
> +++ unstable/xen/common/memory.c
> @@ -788,7 +788,11 @@ int xenmem_add_to_physmap(struct domain
>=C2=A0 =C2=A0 =C2=A0 union add_to_physmap_extra extra =3D {};
>=C2=A0 =C2=A0 =C2=A0 struct page_info *pages[16];
>=C2=A0
> -=C2=A0 =C2=A0 ASSERT(paging_mode_translate(d));
> +=C2=A0 =C2=A0 if ( !paging_mode_translate(d) )
> +=C2=A0 =C2=A0 {
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 ASSERT_UNREACHABLE();
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 return -EACCES;
> +=C2=A0 =C2=A0 }
>=C2=A0
>=C2=A0 =C2=A0 =C2=A0 if ( xatp->space =3D=3D XENMAPSPACE_gmfn_foreig= n )
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 extra.foreign_domid =3D DOMID_INVALI= D;
>
> Andrew, please let me know whether your ack stands with this (or
> said alternative) added, or whether you'd prefer me to re-post.
Yeah, this is probably neater than the ifdefary.=C2=A0 My ack stands.

~Andrew

I might miss something or did i= ncorrect=C2=A0tests, but ...=C2=A0
... trying to build current st= aging (7ba2ab495be54f608cb47440e1497b2795bd301a) for x86 (with # CONFIG_HVM= is not set) I got the following:=C2=A0

= /media/b/build/build/tmp/work/x86_64-xt-linux/domd-image-weston/1.0-r0/repo= /build/tmp/work/aarch64-poky-linux/xen/4.14.0+gitAUTOINC+2c6e5a8ceb-r0/git/= xen/common/memory.c:941: undefined reference to `xenmem_add_to_physmap_one&= #39;
/media/b/build/build/tmp/work/x86_64-xt-linux/domd-image-weston/1.0= -r0/repo/build/tmp/work/aarch64-poky-linux/xen/4.14.0+gitAUTOINC+2c6e5a8ceb= -r0/git/xen/common/memory.c:941:(.text+0x1e391): relocation truncated to fi= t: R_X86_64_PC32 against undefined symbol `xenmem_add_to_physmap_one'ld: /media/b/build/build/tmp/work/x86_64-xt-linux/domd-image-weston/1.0-r= 0/repo/build/tmp/work/aarch64-poky-linux/xen/4.14.0+gitAUTOINC+2c6e5a8ceb-r= 0/git/xen/.xen-syms.0: hidden symbol `xenmem_add_to_physmap_one' isn= 9;t defined
ld: final link failed: Bad value

It is worth mentioning that I do not use=C2=A0pvshim_defconfig (I disable= HVM support via menuconfig manually before building).

--
Reg= ards,

Ol= eksandr Tyshchenko
<= /div> --0000000000003b82df05b815fea0--