Skip to contentSkip to conversation

xen,kdump: handle pv domain in paddr_vmcoreinfo_note()

PATCH Superseded Juergen Gross 3 participants 9 messages Mar 30, 2017 – Mar 31, 2017 1 message not in the archive

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Juergen Gross

author maintainer
#0 lore raw

PATCH 1/1 xen,kdump: handle pv domain in paddr_vmcoreinfo_note()

For kdump to work correctly it needs the physical address of vmcoreinfo_note. When running as dom0 this means the virtual address has to be translated to the related machine address.

paddr_vmcoreinfo_note() is meant to do the translation via __pa() only, but being attributed "weak" it can be replaced easily in Xen case.

---
This patch needs to be rebased on top of Vitaly's series to split pv- and hvm-code. I'll do this as soon as his series is in the Xen tree in its final form.

---
 arch/x86/xen/mmu.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/x86/xen/mmu.c +13 -0
index 37cb5aa..0e2b8d7 100644
@@ -49,6 +49,9 @@
 #include <linux/memblock.h>
 #include <linux/seq_file.h>
 #include <linux/crash_dump.h>
+#ifdef CONFIG_KEXEC_CORE
+#include <linux/kexec.h>
+#endif
 
 #include <trace/events/xen.h>
 
@@ -2903,3 +2906,13 @@ int xen_unmap_domain_gfn_range(struct vm_area_struct *vma,
 	return -EINVAL;
 }
 EXPORT_SYMBOL_GPL(xen_unmap_domain_gfn_range);
+
+#ifdef CONFIG_KEXEC_CORE
+phys_addr_t paddr_vmcoreinfo_note(void)
+{
+	if (xen_pv_domain())
+		return virt_to_machine(&vmcoreinfo_note).maddr;
+	else
+		return __pa((unsigned long)(char *)&vmcoreinfo_note);
+}
+#endif /* CONFIG_KEXEC_CORE */
Signature · 1 line
2.10.2
#1 lore raw

Re: [PATCH] xen, kdump: handle pv domain in paddr_vmcoreinfo_note()

Quoted 32 lines · Juergen Gross

For kdump to work correctly it needs the physical address of vmcoreinfo_note. When running as dom0 this means the virtual address has to be translated to the related machine address.

paddr_vmcoreinfo_note() is meant to do the translation via __pa() only, but being attributed "weak" it can be replaced easily in Xen case.

---
This patch needs to be rebased on top of Vitaly's series to split pv- and hvm-code. I'll do this as soon as his series is in the Xen tree in its final form.

---
 arch/x86/xen/mmu.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/x86/xen/mmu.c +3 -0
index 37cb5aa..0e2b8d7 100644
@@ -49,6 +49,9 @@
 #include <linux/memblock.h>
 #include <linux/seq_file.h>
 #include <linux/crash_dump.h>
+#ifdef CONFIG_KEXEC_CORE
+#include <linux/kexec.h>
+#endif
 
 #include <trace/events/xen.h>
 
@@ -2903,3 +2906,13 @@ int xen_unmap_domain_gfn_range(struct vm_area_struct *vma,
 	return -EINVAL;

arch/x86/xen/mmu.c int xen_unmap_domain_gfn_range(struct vm_area_struct *vma, · line 2916

Quoted 10 lines
arch/x86/xen/mmu.c +8 -0
 }
 EXPORT_SYMBOL_GPL(xen_unmap_domain_gfn_range);
+
+#ifdef CONFIG_KEXEC_CORE
+phys_addr_t paddr_vmcoreinfo_note(void)
+{
+	if (xen_pv_domain())
+		return virt_to_machine(&vmcoreinfo_note).maddr;
+	else
+		return __pa((unsigned long)(char *)&vmcoreinfo_note);

Why not __pa_symbol(), just like in the weak version?

-boris

arch/x86/xen/mmu.c int xen_unmap_domain_gfn_range(struct vm_area_struct *vma, · line 2918

Quoted 2 lines
arch/x86/xen/mmu.c +2 -0
+}
+#endif /* CONFIG_KEXEC_CORE */

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

#2 lore raw
In reply to Juergen Gross
Quoted 32 lines · Juergen Gross

For kdump to work correctly it needs the physical address of vmcoreinfo_note. When running as dom0 this means the virtual address has to be translated to the related machine address.

paddr_vmcoreinfo_note() is meant to do the translation via __pa() only, but being attributed "weak" it can be replaced easily in Xen case.

---
This patch needs to be rebased on top of Vitaly's series to split pv- and hvm-code. I'll do this as soon as his series is in the Xen tree in its final form.

---
 arch/x86/xen/mmu.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/x86/xen/mmu.c +3 -0
index 37cb5aa..0e2b8d7 100644
@@ -49,6 +49,9 @@
 #include <linux/memblock.h>
 #include <linux/seq_file.h>
 #include <linux/crash_dump.h>
+#ifdef CONFIG_KEXEC_CORE
+#include <linux/kexec.h>
+#endif
 
 #include <trace/events/xen.h>
 
@@ -2903,3 +2906,13 @@ int xen_unmap_domain_gfn_range(struct vm_area_struct *vma,
 	return -EINVAL;

arch/x86/xen/mmu.c int xen_unmap_domain_gfn_range(struct vm_area_struct *vma, · line 2916

Quoted 10 lines
arch/x86/xen/mmu.c +8 -0
 }
 EXPORT_SYMBOL_GPL(xen_unmap_domain_gfn_range);
+
+#ifdef CONFIG_KEXEC_CORE
+phys_addr_t paddr_vmcoreinfo_note(void)
+{
+	if (xen_pv_domain())
+		return virt_to_machine(&vmcoreinfo_note).maddr;
+	else
+		return __pa((unsigned long)(char *)&vmcoreinfo_note);

Why not __pa_symbol(), just like in the weak version?

-boris

Quoted 2 lines
arch/x86/xen/mmu.c +2 -0
+}
+#endif /* CONFIG_KEXEC_CORE */
author maintainer
#3 lore raw
Quoted 31 lines · Boris Ostrovsky
Quoted 30 lines · Juergen Gross

For kdump to work correctly it needs the physical address of vmcoreinfo_note. When running as dom0 this means the virtual address has to be translated to the related machine address.

paddr_vmcoreinfo_note() is meant to do the translation via __pa() only, but being attributed "weak" it can be replaced easily in Xen case.

---
This patch needs to be rebased on top of Vitaly's series to split pv- and hvm-code. I'll do this as soon as his series is in the Xen tree in its final form.

---
 arch/x86/xen/mmu.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/x86/xen/mmu.c +3 -0
index 37cb5aa..0e2b8d7 100644
@@ -49,6 +49,9 @@
 #include <linux/memblock.h>
 #include <linux/seq_file.h>
 #include <linux/crash_dump.h>
+#ifdef CONFIG_KEXEC_CORE
+#include <linux/kexec.h>
+#endif
 
 #include <trace/events/xen.h>
 
Quoted 14 lines

arch/x86/xen/mmu.c int xen_unmap_domain_gfn_range(struct vm_area_struct *vma, · line 2916

Quoted 12 lines
arch/x86/xen/mmu.c +8 -0
@@ -2903,3 +2906,13 @@ int xen_unmap_domain_gfn_range(struct vm_area_struct *vma,
 	return -EINVAL;
 }
 EXPORT_SYMBOL_GPL(xen_unmap_domain_gfn_range);
+
+#ifdef CONFIG_KEXEC_CORE
+phys_addr_t paddr_vmcoreinfo_note(void)
+{
+	if (xen_pv_domain())
+		return virt_to_machine(&vmcoreinfo_note).maddr;
+	else
+		return __pa((unsigned long)(char *)&vmcoreinfo_note);

Why not __pa_symbol(), just like in the weak version?

Hmm, you are right. This patch originated from a 4.4 based one.

Juergen

author maintainer
#4 lore raw

Re: [PATCH] xen, kdump: handle pv domain in paddr_vmcoreinfo_note()

In reply to Boris Ostrovsky
Quoted 31 lines · Boris Ostrovsky
Quoted 30 lines · Juergen Gross

For kdump to work correctly it needs the physical address of vmcoreinfo_note. When running as dom0 this means the virtual address has to be translated to the related machine address.

paddr_vmcoreinfo_note() is meant to do the translation via __pa() only, but being attributed "weak" it can be replaced easily in Xen case.

---
This patch needs to be rebased on top of Vitaly's series to split pv- and hvm-code. I'll do this as soon as his series is in the Xen tree in its final form.

---
 arch/x86/xen/mmu.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/x86/xen/mmu.c +3 -0
index 37cb5aa..0e2b8d7 100644
@@ -49,6 +49,9 @@
 #include <linux/memblock.h>
 #include <linux/seq_file.h>
 #include <linux/crash_dump.h>
+#ifdef CONFIG_KEXEC_CORE
+#include <linux/kexec.h>
+#endif
 
 #include <trace/events/xen.h>
 
Quoted 14 lines

arch/x86/xen/mmu.c int xen_unmap_domain_gfn_range(struct vm_area_struct *vma, · line 2916

Quoted 12 lines
arch/x86/xen/mmu.c +8 -0
@@ -2903,3 +2906,13 @@ int xen_unmap_domain_gfn_range(struct vm_area_struct *vma,
 	return -EINVAL;
 }
 EXPORT_SYMBOL_GPL(xen_unmap_domain_gfn_range);
+
+#ifdef CONFIG_KEXEC_CORE
+phys_addr_t paddr_vmcoreinfo_note(void)
+{
+	if (xen_pv_domain())
+		return virt_to_machine(&vmcoreinfo_note).maddr;
+	else
+		return __pa((unsigned long)(char *)&vmcoreinfo_note);

Why not __pa_symbol(), just like in the weak version?

Hmm, you are right. This patch originated from a 4.4 based one.

Juergen

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

#5 lore raw

Re: [Xen-devel] [PATCH] xen, kdump: handle pv domain in paddr_vmcoreinfo_note()

In reply to Juergen Gross

arch/x86/xen/mmu.c int xen_unmap_domain_gfn_range(struct vm_area_struct *vma, · line 2916

Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 30.03.17 at 16:18, <[email protected]> wrote:
arch/x86/xen/mmu.c +8 -0
@@ -2903,3 +2906,13 @@ int xen_unmap_domain_gfn_range(struct vm_area_struct *vma,
 	return -EINVAL;
 }
 EXPORT_SYMBOL_GPL(xen_unmap_domain_gfn_range);
+
+#ifdef CONFIG_KEXEC_CORE
+phys_addr_t paddr_vmcoreinfo_note(void)
+{
+	if (xen_pv_domain())
+		return virt_to_machine(&vmcoreinfo_note).maddr;
+	else
+		return __pa((unsigned long)(char *)&vmcoreinfo_note);

I don't think you need the double cast here.

This being placed in x86 code is correct only as long as the assumption is correct that no other architecture will allow for PV guests. And this being placed in Xen code is correct only as long as the assumption is true that no other hypervisors will allow for PV guests.

Jan

#6 lore raw

Re: [PATCH] xen, kdump: handle pv domain in paddr_vmcoreinfo_note()

In reply to Juergen Gross

arch/x86/xen/mmu.c int xen_unmap_domain_gfn_range(struct vm_area_struct *vma, · line 2916

Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 30.03.17 at 16:18, <[email protected]> wrote:
arch/x86/xen/mmu.c +8 -0
@@ -2903,3 +2906,13 @@ int xen_unmap_domain_gfn_range(struct vm_area_struct *vma,
 	return -EINVAL;
 }
 EXPORT_SYMBOL_GPL(xen_unmap_domain_gfn_range);
+
+#ifdef CONFIG_KEXEC_CORE
+phys_addr_t paddr_vmcoreinfo_note(void)
+{
+	if (xen_pv_domain())
+		return virt_to_machine(&vmcoreinfo_note).maddr;
+	else
+		return __pa((unsigned long)(char *)&vmcoreinfo_note);

I don't think you need the double cast here.

This being placed in x86 code is correct only as long as the assumption is correct that no other architecture will allow for PV guests. And this being placed in Xen code is correct only as long as the assumption is true that no other hypervisors will allow for PV guests.

Jan

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

A message that is not in the archive (sent off-list or not yet received): [email protected]

author maintainer
#8 lore raw

Re: [PATCH] xen, kdump: handle pv domain in paddr_vmcoreinfo_note()

Quoted 16 lines · Jan Beulich

arch/x86/xen/mmu.c int xen_unmap_domain_gfn_range(struct vm_area_struct *vma, · line 2916

Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 30.03.17 at 16:18, <[email protected]> wrote:
arch/x86/xen/mmu.c +8 -0
@@ -2903,3 +2906,13 @@ int xen_unmap_domain_gfn_range(struct vm_area_struct *vma,
 	return -EINVAL;
 }
 EXPORT_SYMBOL_GPL(xen_unmap_domain_gfn_range);
+
+#ifdef CONFIG_KEXEC_CORE
+phys_addr_t paddr_vmcoreinfo_note(void)
+{
+	if (xen_pv_domain())
+		return virt_to_machine(&vmcoreinfo_note).maddr;
+	else
+		return __pa((unsigned long)(char *)&vmcoreinfo_note);

I don't think you need the double cast here.

Quoted 5 lines

This being placed in x86 code is correct only as long as the assumption is correct that no other architecture will allow for PV guests. And this being placed in Xen code is correct only as long as the assumption is true that no other hypervisors will allow for PV guests.

With virt_to_machine() defined in arch/x86/include/asm/xen/page.h I think changing any of those assumptions will require major work.

Juergen

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

author maintainer
#9 lore raw

Re: [Xen-devel] [PATCH] xen, kdump: handle pv domain in paddr_vmcoreinfo_note()

In reply to a message not in the archive
Quoted 16 lines · Jan Beulich

arch/x86/xen/mmu.c int xen_unmap_domain_gfn_range(struct vm_area_struct *vma, · line 2916

Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 30.03.17 at 16:18, <[email protected]> wrote:
arch/x86/xen/mmu.c +8 -0
@@ -2903,3 +2906,13 @@ int xen_unmap_domain_gfn_range(struct vm_area_struct *vma,
 	return -EINVAL;
 }
 EXPORT_SYMBOL_GPL(xen_unmap_domain_gfn_range);
+
+#ifdef CONFIG_KEXEC_CORE
+phys_addr_t paddr_vmcoreinfo_note(void)
+{
+	if (xen_pv_domain())
+		return virt_to_machine(&vmcoreinfo_note).maddr;
+	else
+		return __pa((unsigned long)(char *)&vmcoreinfo_note);

I don't think you need the double cast here.

Quoted 5 lines

This being placed in x86 code is correct only as long as the assumption is correct that no other architecture will allow for PV guests. And this being placed in Xen code is correct only as long as the assumption is true that no other hypervisors will allow for PV guests.

With virt_to_machine() defined in arch/x86/include/asm/xen/page.h I think changing any of those assumptions will require major work.

Juergen