Skip to contentSkip to conversation

x86/gart: Rewrite early_gart_iommu_check() comment

PATCH In review Borislav Petkov 4 participants 6 messages Nov 1, 2018 – Nov 5, 2018 x86

lore
Share & tools
lore

Borislav Petkov

author maintainer
#0 lore raw

PATCH 1/1 x86/gart: Rewrite early_gart_iommu_check() comment

From: Borislav Petkov <[email protected]>

... to actually explain what the function is trying to do.

---
 arch/x86/kernel/aperture_64.c | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)
arch/x86/kernel/aperture_64.c +15 -10
index 2c4d5ece7456..4fb4b7f53568 100644
@@ -264,18 +264,23 @@ static int __init parse_gart_mem(char *p)
 }
 early_param("gart_fix_e820", parse_gart_mem);
 
+/*
+ * With kexec/kdump, if the first kernel doesn't shutdown the GART and the
+ * second kernel allocates a different GART region, there might be two
+ * overlapping GART regions present:
+ *
+ * - the first still used by the GART initialized in the first kernel.
+ * - (sub-)set of it used as normal RAM by the second kernel.
+ *
+ * which leads to memory corruptions and a kernel panic eventually.
+ *
+ * This can also happen if the BIOS has forgotten to mark the GART region
+ * as reserved.
+ *
+ * Try to update the e820 map to mark that new region as reserved.
+ */
 void __init early_gart_iommu_check(void)
 {
-	/*
-	 * in case it is enabled before, esp for kexec/kdump,
-	 * previous kernel already enable that. memset called
-	 * by allocate_aperture/__alloc_bootmem_nopanic cause restart.
-	 * or second kernel have different position for GART hole. and new
-	 * kernel could use hole as RAM that is still used by GART set by
-	 * first kernel
-	 * or BIOS forget to put that in reserved.
-	 * try to update e820 to make that region as reserved.
-	 */
 	u32 agp_aper_order = 0;
 	int i, fix, slot, valid_agp = 0;
 	u32 ctl;
Signature · 1 line
2.19.1
#2 lore raw
In reply to Borislav Petkov
x86/gart: Rewrite early_gart_iommu_check() comment
Commit-ID:  59d130cc9b92b92feaada94a0802fa747038d17f
Gitweb:     https://git.kernel.org/tip/59d130cc9b92b92feaada94a0802fa747038d17f
Author:     Borislav Petkov <[email protected]>
AuthorDate: Thu, 1 Nov 2018 16:24:43 +0100
Committer:  Borislav Petkov <[email protected]>
CommitDate: Mon, 5 Nov 2018 14:35:10 +0100

x86/gart: Rewrite early_gart_iommu_check() comment

... to actually explain what the function is trying to do.

---
 arch/x86/kernel/aperture_64.c | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)
arch/x86/kernel/aperture_64.c +15 -10
index 2c4d5ece7456..4fb4b7f53568 100644
@@ -264,18 +264,23 @@ static int __init parse_gart_mem(char *p)
 }
 early_param("gart_fix_e820", parse_gart_mem);
 
+/*
+ * With kexec/kdump, if the first kernel doesn't shutdown the GART and the
+ * second kernel allocates a different GART region, there might be two
+ * overlapping GART regions present:
+ *
+ * - the first still used by the GART initialized in the first kernel.
+ * - (sub-)set of it used as normal RAM by the second kernel.
+ *
+ * which leads to memory corruptions and a kernel panic eventually.
+ *
+ * This can also happen if the BIOS has forgotten to mark the GART region
+ * as reserved.
+ *
+ * Try to update the e820 map to mark that new region as reserved.
+ */
 void __init early_gart_iommu_check(void)
 {
-	/*
-	 * in case it is enabled before, esp for kexec/kdump,
-	 * previous kernel already enable that. memset called
-	 * by allocate_aperture/__alloc_bootmem_nopanic cause restart.
-	 * or second kernel have different position for GART hole. and new
-	 * kernel could use hole as RAM that is still used by GART set by
-	 * first kernel
-	 * or BIOS forget to put that in reserved.
-	 * try to update e820 to make that region as reserved.
-	 */
 	u32 agp_aper_order = 0;
 	int i, fix, slot, valid_agp = 0;
 	u32 ctl;
#3 lore raw
In reply to Borislav Petkov
Quoted 15 lines · Borislav Petkov

From: Borislav Petkov <[email protected]>

... to actually explain what the function is trying to do.

---
 arch/x86/kernel/aperture_64.c | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)
arch/x86/kernel/aperture_64.c +0 -0
index 2c4d5ece7456..4fb4b7f53568 100644

arch/x86/kernel/aperture_64.c static int __init parse_gart_mem(char *p) · line 270

Quoted 7 lines
arch/x86/kernel/aperture_64.c +4 -0
@@ -264,18 +264,23 @@ static int __init parse_gart_mem(char *p)
 }
 early_param("gart_fix_e820", parse_gart_mem);
 
+/*
+ * With kexec/kdump, if the first kernel doesn't shutdown the GART and the
+ * second kernel allocates a different GART region, there might be two
+ * overlapping GART regions present:

s/shutdown
/shut down

Thanks,

Ingo

author maintainer
#4 lore raw
Quoted 2 lines · Ingo Molnar

s/shutdown
/shut down

Fixed.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.
#5 lore raw
In reply to Borislav Petkov
x86/gart: Rewrite early_gart_iommu_check() comment
Commit-ID:  63ecd3b13d5cf07959a2315ec62a7c62e20df114
Gitweb:     https://git.kernel.org/tip/63ecd3b13d5cf07959a2315ec62a7c62e20df114
Author:     Borislav Petkov <[email protected]>
AuthorDate: Thu, 1 Nov 2018 16:24:43 +0100
Committer:  Borislav Petkov <[email protected]>
CommitDate: Mon, 5 Nov 2018 21:18:31 +0100

x86/gart: Rewrite early_gart_iommu_check() comment

... to actually explain what the function is trying to do.

---
 arch/x86/kernel/aperture_64.c | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)
arch/x86/kernel/aperture_64.c +15 -10
index 2c4d5ece7456..58176b56354e 100644
@@ -264,18 +264,23 @@ static int __init parse_gart_mem(char *p)
 }
 early_param("gart_fix_e820", parse_gart_mem);
 
+/*
+ * With kexec/kdump, if the first kernel doesn't shut down the GART and the
+ * second kernel allocates a different GART region, there might be two
+ * overlapping GART regions present:
+ *
+ * - the first still used by the GART initialized in the first kernel.
+ * - (sub-)set of it used as normal RAM by the second kernel.
+ *
+ * which leads to memory corruptions and a kernel panic eventually.
+ *
+ * This can also happen if the BIOS has forgotten to mark the GART region
+ * as reserved.
+ *
+ * Try to update the e820 map to mark that new region as reserved.
+ */
 void __init early_gart_iommu_check(void)
 {
-	/*
-	 * in case it is enabled before, esp for kexec/kdump,
-	 * previous kernel already enable that. memset called
-	 * by allocate_aperture/__alloc_bootmem_nopanic cause restart.
-	 * or second kernel have different position for GART hole. and new
-	 * kernel could use hole as RAM that is still used by GART set by
-	 * first kernel
-	 * or BIOS forget to put that in reserved.
-	 * try to update e820 to make that region as reserved.
-	 */
 	u32 agp_aper_order = 0;
 	int i, fix, slot, valid_agp = 0;
 	u32 ctl;