Skip to contentSkip to conversation

xen: setup pv irq ops vector earlier

PATCH In review Juergen Gross 3 participants 11 messages Jul 2, 2018 – Jul 11, 2018 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

Juergen Gross

author maintainer
#0 lore raw

PATCH 1/1 xen: setup pv irq ops vector earlier

Setting pv_irq_ops for Xen PV domains should be done as early as possible in order to support e.g. very early printk() usage.

Remove the no longer necessary conditional in xen_init_irq_ops() from PVH V1 times to make clear this is a PV only function.

---
 arch/x86/xen/enlighten_pv.c | 3 +--
 arch/x86/xen/irq.c          | 4 +---
 2 files changed, 2 insertions(+), 5 deletions(-)
arch/x86/xen/enlighten_pv.c +1 -2
index 8d4e2e1ae60b..0f4cd9e5bed4 100644
@@ -1213,6 +1213,7 @@ asmlinkage __visible void __init xen_start_kernel(void)
 	pv_info = xen_info;
 	pv_init_ops.patch = paravirt_patch_default;
 	pv_cpu_ops = xen_cpu_ops;
+	xen_init_irq_ops();
 
 	x86_platform.get_nmi_reason = xen_get_nmi_reason;
 
@@ -1249,8 +1250,6 @@ asmlinkage __visible void __init xen_start_kernel(void)
 	get_cpu_cap(&boot_cpu_data);
 	x86_configure_nx();
 
-	xen_init_irq_ops();
-
 	/* Let's presume PV guests always boot on vCPU with id 0. */
 	per_cpu(xen_vcpu_id, 0) = 0;
 
arch/x86/xen/irq.c +1 -3
index 74179852e46c..7515a19fd324 100644
@@ -128,8 +128,6 @@ static const struct pv_irq_ops xen_irq_ops __initconst = {
 
 void __init xen_init_irq_ops(void)
 {
-	/* For PVH we use default pv_irq_ops settings. */
-	if (!xen_feature(XENFEAT_hvm_callback_vector))
-		pv_irq_ops = xen_irq_ops;
+	pv_irq_ops = xen_irq_ops;
 	x86_init.irqs.intr_init = xen_init_IRQ;
 }
Signature · 1 line
2.13.7
#1 lore raw

arch/x86/xen/enlighten_pv.c asmlinkage __visible void __init xen_start_kernel(void) · line 1216

Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 02.07.18 at 12:00, <[email protected]> wrote:
arch/x86/xen/enlighten_pv.c +1 -0
@@ -1213,6 +1213,7 @@ asmlinkage __visible void __init xen_start_kernel(void)
 	pv_info = xen_info;
 	pv_init_ops.patch = paravirt_patch_default;
 	pv_cpu_ops = xen_cpu_ops;
+	xen_init_irq_ops();

Isn't this still too late? xen_setup_machphys_mapping(), for example, has a WARN_ON(), which implies multiple printk()s.

Jan

#2 lore raw
In reply to Juergen Gross

arch/x86/xen/enlighten_pv.c asmlinkage __visible void __init xen_start_kernel(void) · line 1216

Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 02.07.18 at 12:00, <[email protected]> wrote:
arch/x86/xen/enlighten_pv.c +1 -0
@@ -1213,6 +1213,7 @@ asmlinkage __visible void __init xen_start_kernel(void)
 	pv_info = xen_info;
 	pv_init_ops.patch = paravirt_patch_default;
 	pv_cpu_ops = xen_cpu_ops;
+	xen_init_irq_ops();

Isn't this still too late? xen_setup_machphys_mapping(), for example, has a WARN_ON(), which implies multiple printk()s.

Jan

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

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

author maintainer
#4 lore raw
Quoted 11 lines · Jan Beulich

arch/x86/xen/enlighten_pv.c asmlinkage __visible void __init xen_start_kernel(void) · line 1216

Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 02.07.18 at 12:00, <[email protected]> wrote:
arch/x86/xen/enlighten_pv.c +1 -0
@@ -1213,6 +1213,7 @@ asmlinkage __visible void __init xen_start_kernel(void)
 	pv_info = xen_info;
 	pv_init_ops.patch = paravirt_patch_default;
 	pv_cpu_ops = xen_cpu_ops;
+	xen_init_irq_ops();

Isn't this still too late? xen_setup_machphys_mapping(), for example, has a WARN_ON(), which implies multiple printk()s.

Seems as if it would be a good idea to move calling xen_setup_machphys_mapping() into xen_init_mmu_ops(). There is really no need to do it earlier.

Juergen

author maintainer
#5 lore raw
In reply to a message not in the archive
Quoted 11 lines · Jan Beulich

arch/x86/xen/enlighten_pv.c asmlinkage __visible void __init xen_start_kernel(void) · line 1216

Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 02.07.18 at 12:00, <[email protected]> wrote:
arch/x86/xen/enlighten_pv.c +1 -0
@@ -1213,6 +1213,7 @@ asmlinkage __visible void __init xen_start_kernel(void)
 	pv_info = xen_info;
 	pv_init_ops.patch = paravirt_patch_default;
 	pv_cpu_ops = xen_cpu_ops;
+	xen_init_irq_ops();

Isn't this still too late? xen_setup_machphys_mapping(), for example, has a WARN_ON(), which implies multiple printk()s.

Seems as if it would be a good idea to move calling xen_setup_machphys_mapping() into xen_init_mmu_ops(). There is really no need to do it earlier.

Juergen

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

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

Setting pv_irq_ops for Xen PV domains should be done as early as possible in order to support e.g. very early printk() usage.

Will printk() work as result of this move? We still, for example, haven't set up console.

This will (probably) allow us not to crash (due to STI and such) but I am not sure "support" is the right term here.

-boris

Quoted 37 lines

Remove the no longer necessary conditional in xen_init_irq_ops() from PVH V1 times to make clear this is a PV only function.

---
 arch/x86/xen/enlighten_pv.c | 3 +--
 arch/x86/xen/irq.c          | 4 +---
 2 files changed, 2 insertions(+), 5 deletions(-)
arch/x86/xen/enlighten_pv.c +1 -2
index 8d4e2e1ae60b..0f4cd9e5bed4 100644
@@ -1213,6 +1213,7 @@ asmlinkage __visible void __init xen_start_kernel(void)
 	pv_info = xen_info;
 	pv_init_ops.patch = paravirt_patch_default;
 	pv_cpu_ops = xen_cpu_ops;
+	xen_init_irq_ops();
 
 	x86_platform.get_nmi_reason = xen_get_nmi_reason;
 
@@ -1249,8 +1250,6 @@ asmlinkage __visible void __init xen_start_kernel(void)
 	get_cpu_cap(&boot_cpu_data);
 	x86_configure_nx();
 
-	xen_init_irq_ops();
-
 	/* Let's presume PV guests always boot on vCPU with id 0. */
 	per_cpu(xen_vcpu_id, 0) = 0;
 
arch/x86/xen/irq.c +0 -0
index 74179852e46c..7515a19fd324 100644

arch/x86/xen/irq.c static const struct pv_irq_ops xen_irq_ops __initconst = { · line 133

Quoted 9 lines
arch/x86/xen/irq.c +1 -3
@@ -128,8 +128,6 @@ static const struct pv_irq_ops xen_irq_ops __initconst = {
 
 void __init xen_init_irq_ops(void)
 {
-	/* For PVH we use default pv_irq_ops settings. */
-	if (!xen_feature(XENFEAT_hvm_callback_vector))
-		pv_irq_ops = xen_irq_ops;
+	pv_irq_ops = xen_irq_ops;
 	x86_init.irqs.intr_init = xen_init_IRQ;
 }

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

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

Setting pv_irq_ops for Xen PV domains should be done as early as possible in order to support e.g. very early printk() usage.

Will printk() work as result of this move? We still, for example, haven't set up console.

This will (probably) allow us not to crash (due to STI and such) but I am not sure "support" is the right term here.

-boris

Quoted 46 lines

Remove the no longer necessary conditional in xen_init_irq_ops() from PVH V1 times to make clear this is a PV only function.

---
 arch/x86/xen/enlighten_pv.c | 3 +--
 arch/x86/xen/irq.c          | 4 +---
 2 files changed, 2 insertions(+), 5 deletions(-)
arch/x86/xen/enlighten_pv.c +1 -2
index 8d4e2e1ae60b..0f4cd9e5bed4 100644
@@ -1213,6 +1213,7 @@ asmlinkage __visible void __init xen_start_kernel(void)
 	pv_info = xen_info;
 	pv_init_ops.patch = paravirt_patch_default;
 	pv_cpu_ops = xen_cpu_ops;
+	xen_init_irq_ops();
 
 	x86_platform.get_nmi_reason = xen_get_nmi_reason;
 
@@ -1249,8 +1250,6 @@ asmlinkage __visible void __init xen_start_kernel(void)
 	get_cpu_cap(&boot_cpu_data);
 	x86_configure_nx();
 
-	xen_init_irq_ops();
-
 	/* Let's presume PV guests always boot on vCPU with id 0. */
 	per_cpu(xen_vcpu_id, 0) = 0;
 
arch/x86/xen/irq.c +1 -3
index 74179852e46c..7515a19fd324 100644
@@ -128,8 +128,6 @@ static const struct pv_irq_ops xen_irq_ops __initconst = {
 
 void __init xen_init_irq_ops(void)
 {
-	/* For PVH we use default pv_irq_ops settings. */
-	if (!xen_feature(XENFEAT_hvm_callback_vector))
-		pv_irq_ops = xen_irq_ops;
+	pv_irq_ops = xen_irq_ops;
 	x86_init.irqs.intr_init = xen_init_IRQ;
 }
author maintainer
#8 lore raw
Quoted 6 lines · Boris Ostrovsky
Quoted 2 lines · Juergen Gross

Setting pv_irq_ops for Xen PV domains should be done as early as possible in order to support e.g. very early printk() usage.

Will printk() work as result of this move? We still, for example, haven't set up console.

It will print to the kernel print buffer, so the output will be available later.

Quoted 2 lines

This will (probably) allow us not to crash (due to STI and such) but I am not sure "support" is the right term here.

Not crashing is big plus IMO. :-)

Juergen

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

author maintainer
#9 lore raw
In reply to Boris Ostrovsky
Quoted 6 lines · Boris Ostrovsky
Quoted 2 lines · Juergen Gross

Setting pv_irq_ops for Xen PV domains should be done as early as possible in order to support e.g. very early printk() usage.

Will printk() work as result of this move? We still, for example, haven't set up console.

It will print to the kernel print buffer, so the output will be available later.

Quoted 2 lines

This will (probably) allow us not to crash (due to STI and such) but I am not sure "support" is the right term here.

Not crashing is big plus IMO. :-)

Juergen

#10 lore raw
Quoted 8 lines · Juergen Gross
Quoted 5 lines · Boris Ostrovsky
Quoted 2 lines · Juergen Gross

Setting pv_irq_ops for Xen PV domains should be done as early as possible in order to support e.g. very early printk() usage.

Will printk() work as result of this move? We still, for example, haven't set up console.

It will print to the kernel print buffer, so the output will be available later.

Right, haven't thought about it.

Quoted 4 lines
Quoted 3 lines

This will (probably) allow us not to crash (due to STI and such) but I am not sure "support" is the right term here.

Not crashing is big plus IMO. :-)

Actually, no, this is not sufficient.

You need to move xen_vcpu_info_reset(0) up as well. Otherwise you will not be able to dereference the percpu xen_vcpu in xen_save_fl().

-boris

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

#11 lore raw
In reply to Juergen Gross
Quoted 8 lines · Juergen Gross
Quoted 5 lines · Boris Ostrovsky
Quoted 2 lines · Juergen Gross

Setting pv_irq_ops for Xen PV domains should be done as early as possible in order to support e.g. very early printk() usage.

Will printk() work as result of this move? We still, for example, haven't set up console.

It will print to the kernel print buffer, so the output will be available later.

Right, haven't thought about it.

Quoted 4 lines
Quoted 3 lines

This will (probably) allow us not to crash (due to STI and such) but I am not sure "support" is the right term here.

Not crashing is big plus IMO. :-)

Actually, no, this is not sufficient.

You need to move xen_vcpu_info_reset(0) up as well. Otherwise you will not be able to dereference the percpu xen_vcpu in xen_save_fl().

-boris