[Xen-devel] [PATCH RFC v1 41/74] xen/pvh: do not mark the low 1MB as IO mem

2018-01-04 Thread Wei Liu
From: Roger Pau Monne 

On PVH there's nothing special on the low 1MB

Signed-off-by: Roger Pau Monné 
Signed-off-by: Andrew Cooper 
---
 xen/arch/x86/mm.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index f73fee225e..355e6747bb 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -122,6 +122,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -288,8 +289,12 @@ void __init arch_init_memory(void)
 dom_cow = domain_create(DOMID_COW, DOMCRF_dummy, 0, NULL);
 BUG_ON(IS_ERR(dom_cow));
 
-/* First 1MB of RAM is historically marked as I/O. */
-for ( i = 0; i < 0x100; i++ )
+/*
+ * First 1MB of RAM is historically marked as I/O.  If we booted PVH,
+ * reclaim the space.  Irrespective, leave MFN 0 as special for the sake
+ * of 0 being a very common default value.
+ */
+for ( i = 0; i < (pvh_boot ? 1 : 0x100); i++ )
 share_xen_page_with_guest(mfn_to_page(_mfn(i)),
   dom_io, XENSHARE_writable);
 
-- 
2.11.0


___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH RFC v1 41/74] xen/pvh: do not mark the low 1MB as IO mem

2018-01-08 Thread Jan Beulich
>>> On 04.01.18 at 14:05,  wrote:
> @@ -288,8 +289,12 @@ void __init arch_init_memory(void)
>  dom_cow = domain_create(DOMID_COW, DOMCRF_dummy, 0, NULL);
>  BUG_ON(IS_ERR(dom_cow));
>  
> -/* First 1MB of RAM is historically marked as I/O. */
> -for ( i = 0; i < 0x100; i++ )
> +/*
> + * First 1MB of RAM is historically marked as I/O.  If we booted PVH,
> + * reclaim the space.  Irrespective, leave MFN 0 as special for the sake
> + * of 0 being a very common default value.
> + */
> +for ( i = 0; i < (pvh_boot ? 1 : 0x100); i++ )
>  share_xen_page_with_guest(mfn_to_page(_mfn(i)),
>dom_io, XENSHARE_writable);

I can see this being valid as long as there's no firmware. What
doesn't become clear from neither the description nor the
comment is whether this is a necessary change, or just an
optimization to avoid wasting these 255 pages.

Jan


___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH RFC v1 41/74] xen/pvh: do not mark the low 1MB as IO mem

2018-01-08 Thread Roger Pau Monné
On Mon, Jan 08, 2018 at 03:30:17AM -0700, Jan Beulich wrote:
> >>> On 04.01.18 at 14:05,  wrote:
> > @@ -288,8 +289,12 @@ void __init arch_init_memory(void)
> >  dom_cow = domain_create(DOMID_COW, DOMCRF_dummy, 0, NULL);
> >  BUG_ON(IS_ERR(dom_cow));
> >  
> > -/* First 1MB of RAM is historically marked as I/O. */
> > -for ( i = 0; i < 0x100; i++ )
> > +/*
> > + * First 1MB of RAM is historically marked as I/O.  If we booted PVH,
> > + * reclaim the space.  Irrespective, leave MFN 0 as special for the 
> > sake
> > + * of 0 being a very common default value.
> > + */
> > +for ( i = 0; i < (pvh_boot ? 1 : 0x100); i++ )
> >  share_xen_page_with_guest(mfn_to_page(_mfn(i)),
> >dom_io, XENSHARE_writable);
> 
> I can see this being valid as long as there's no firmware. What
> doesn't become clear from neither the description nor the
> comment is whether this is a necessary change, or just an
> optimization to avoid wasting these 255 pages.

It's just an optimization to not waste the low 1MiB. The shim will
work equally well without this.

Thanks, Roger.

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH RFC v1 41/74] xen/pvh: do not mark the low 1MB as IO mem

2018-01-08 Thread Jan Beulich
>>> On 08.01.18 at 11:37,  wrote:
> On Mon, Jan 08, 2018 at 03:30:17AM -0700, Jan Beulich wrote:
>> >>> On 04.01.18 at 14:05,  wrote:
>> > @@ -288,8 +289,12 @@ void __init arch_init_memory(void)
>> >  dom_cow = domain_create(DOMID_COW, DOMCRF_dummy, 0, NULL);
>> >  BUG_ON(IS_ERR(dom_cow));
>> >  
>> > -/* First 1MB of RAM is historically marked as I/O. */
>> > -for ( i = 0; i < 0x100; i++ )
>> > +/*
>> > + * First 1MB of RAM is historically marked as I/O.  If we booted PVH,
>> > + * reclaim the space.  Irrespective, leave MFN 0 as special for the 
>> > sake
>> > + * of 0 being a very common default value.
>> > + */
>> > +for ( i = 0; i < (pvh_boot ? 1 : 0x100); i++ )
>> >  share_xen_page_with_guest(mfn_to_page(_mfn(i)),
>> >dom_io, XENSHARE_writable);
>> 
>> I can see this being valid as long as there's no firmware. What
>> doesn't become clear from neither the description nor the
>> comment is whether this is a necessary change, or just an
>> optimization to avoid wasting these 255 pages.
> 
> It's just an optimization to not waste the low 1MiB. The shim will
> work equally well without this.

Good. Please say so in the description.

Jan


___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel