From: Oleksandr <olekstysh@gmail.com>
To: Jan Beulich <jbeulich@suse.com>
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>
Subject: Re: [PATCH 2/6] x86/mm: p2m_add_foreign() is HVM-only
Date: Fri, 8 Jan 2021 19:37:59 +0200 [thread overview]
Message-ID: <c8315e16-6130-e990-3d16-d0d42b2f92c4@gmail.com> (raw)
In-Reply-To: <18c21c64-d350-482a-c778-c8478d3daf2c@suse.com>
On 08.01.21 19:01, Jan Beulich wrote:
Hi Jan
> On 08.01.2021 17:38, Oleksandr wrote:
>> On 05.01.21 10:48, Jan Beulich wrote:
>>> On 04.01.2021 17:57, Oleksandr Tyshchenko wrote:
>>>> Hello all.
>>>>
>>>> [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_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 <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
>>>>>> 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).
>>> The specific .config may matter. The specific compiler version may
>>> also matter. Things work fine for me, both for the shim config and
>>> a custom !HVM one, with gcc10.
>> ok, after updating my a little bit ancient compiler to the latest
>> possible (?) on xenial gcc-9 the build issue had gone away. Sorry for
>> the noise.
> There's no reason to be sorry - we want Xen to build with a wide
> range of compiler versions. It's just that if a build issue is
> version dependent, it is often up to the person running into it
> to determine how to address the issue (and submit a patch).
ok, the issue was observed with gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12)
5.4.0 20160609
I think (but not 100% sure), to address the build issue something like
the stub below could help:
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index 85a8df9..ed35352 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -609,9 +609,19 @@ union add_to_physmap_extra {
domid_t foreign_domid;
};
+#ifdef CONFIG_HVM
int xenmem_add_to_physmap_one(struct domain *d, unsigned int space,
union add_to_physmap_extra extra,
unsigned long idx, gfn_t gfn);
+#else
+static inline int xenmem_add_to_physmap_one(struct domain *d,
+ unsigned int space,
+ union add_to_physmap_extra
extra,
+ unsigned long idx, gfn_t gfn)
+{
+ return -EACCES;
+}
+#endif
int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap
*xatp,
unsigned int start);
--
Regards,
Oleksandr Tyshchenko
next prev parent reply other threads:[~2021-01-08 17:38 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 [this message]
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
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=c8315e16-6130-e990-3d16-d0d42b2f92c4@gmail.com \
--to=olekstysh@gmail.com \
--cc=andrew.cooper3@citrix.com \
--cc=george.dunlap@citrix.com \
--cc=jbeulich@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).