Skip to contentSkip to conversation

kexec: add more pages to v1 environment

PATCH In review Jan Beulich 3 participants 3 messages Jun 9, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kexec: add more pages to v1 environment

Destination pages need mappings to be added to the page tables in the v1 case (where nothing else calls machine_kexec_add_page() for them).

Further, without the tools mapping the low 1Mb (expected by at least some Linux version), we need to do so in the hypervisor in the v1 case.

xen/common/kexec.c +18 -0
@@ -1003,6 +1003,24 @@ static int kexec_do_load_v1(xen_kexec_lo
     if ( ret < 0 )
         goto error;
 
+    if ( arch == EM_386 || arch == EM_X86_64 )
+    {
+        /*
+         * Ensure 0 - 1 MiB is mapped and accessible by the image.
+         *
+         * This allows access to VGA memory and the region purgatory copies
+         * in the crash case.
+         */
+        unsigned long addr;
+
+        for ( addr = 0; addr < (1UL << 20); addr += PAGE_SIZE )
+        {
+            ret = machine_kexec_add_page(kimage, addr, addr);
+            if ( ret < 0 )
+                goto error;
+        }
+    }
+
     ret = kexec_load_slot(kimage);
     if ( ret < 0 )
         goto error;
xen/common/kimage.c +5 -0
@@ -923,6 +923,11 @@ int kimage_build_ind(struct kexec_image 
             ret = kimage_add_page(image, page_to_maddr(xen_page));
             if ( ret < 0 )
                 goto done;
+
+            ret = machine_kexec_add_page(image, dest, dest);
+            if ( ret < 0 )
+                goto done;
+
             dest += PAGE_SIZE;
             break;
         }

kexec: add more pages to v1 environment

Destination pages need mappings to be added to the page tables in the v1 case (where nothing else calls machine_kexec_add_page() for them).

Further, without the tools mapping the low 1Mb (expected by at least some Linux version), we need to do so in the hypervisor in the v1 case.

xen/common/kexec.c +18 -0
@@ -1003,6 +1003,24 @@ static int kexec_do_load_v1(xen_kexec_lo
     if ( ret < 0 )
         goto error;
 
+    if ( arch == EM_386 || arch == EM_X86_64 )
+    {
+        /*
+         * Ensure 0 - 1 MiB is mapped and accessible by the image.
+         *
+         * This allows access to VGA memory and the region purgatory copies
+         * in the crash case.
+         */
+        unsigned long addr;
+
+        for ( addr = 0; addr < (1UL << 20); addr += PAGE_SIZE )
+        {
+            ret = machine_kexec_add_page(kimage, addr, addr);
+            if ( ret < 0 )
+                goto error;
+        }
+    }
+
     ret = kexec_load_slot(kimage);
     if ( ret < 0 )
         goto error;
xen/common/kimage.c +5 -0
@@ -923,6 +923,11 @@ int kimage_build_ind(struct kexec_image 
             ret = kimage_add_page(image, page_to_maddr(xen_page));
             if ( ret < 0 )
                 goto done;
+
+            ret = machine_kexec_add_page(image, dest, dest);
+            if ( ret < 0 )
+                goto done;
+
             dest += PAGE_SIZE;
             break;
         }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Jan Beulich

Destination pages need mappings to be added to the page tables in the v1 case (where nothing else calls machine_kexec_add_page() for them).

Further, without the tools mapping the low 1Mb (expected by at least some Linux version), we need to do so in the hypervisor in the v1 case.

David

#2 lore raw
In reply to Jan Beulich
Quoted 17 lines · Jan Beulich

Destination pages need mappings to be added to the page tables in the v1 case (where nothing else calls machine_kexec_add_page() for them).

Further, without the tools mapping the low 1Mb (expected by at least some Linux version), we need to do so in the hypervisor in the v1 case.

xen/common/kexec.c +1 -0
@@ -1003,6 +1003,24 @@ static int kexec_do_load_v1(xen_kexec_lo
     if ( ret < 0 )
         goto error;
 
+    if ( arch == EM_386 || arch == EM_X86_64 )

xen/common/kexec.c static int kexec_do_load_v1(xen_kexec_lo · line 1016

Quoted 10 lines
xen/common/kexec.c +10 -0
+    {
+        /*
+         * Ensure 0 - 1 MiB is mapped and accessible by the image.
+         *
+         * This allows access to VGA memory and the region purgatory copies
+         * in the crash case.
+         */
+        unsigned long addr;
+
+        for ( addr = 0; addr < (1UL << 20); addr += PAGE_SIZE )

MB(1)

Otherwise, Reviewed-by: Andrew Cooper <[email protected]>

Quoted 29 lines
xen/common/kexec.c +7 -0
+        {
+            ret = machine_kexec_add_page(kimage, addr, addr);
+            if ( ret < 0 )
+                goto error;
+        }
+    }
+
     ret = kexec_load_slot(kimage);
     if ( ret < 0 )
         goto error;
xen/common/kimage.c +5 -0
@@ -923,6 +923,11 @@ int kimage_build_ind(struct kexec_image 
             ret = kimage_add_page(image, page_to_maddr(xen_page));
             if ( ret < 0 )
                 goto done;
+
+            ret = machine_kexec_add_page(image, dest, dest);
+            if ( ret < 0 )
+                goto done;
+
             dest += PAGE_SIZE;
             break;
         }
Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel