Skip to contentSkip to conversation

xen_hvm_callback_vector

DISCUSSION Jeremy Fitzhardinge 3 participants 8 messages Aug 27, 2010 – Aug 30, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Should entry_64.S's xen_hvm_callback_vector be calling
xen_evtchn_do_upcall or xen_hvm_evtchn_do_upcall? If not the hvm version, when does that get used?

J

#1 lore raw
Quoted 3 lines · Jeremy Fitzhardinge

Should entry_64.S's xen_hvm_callback_vector be calling xen_evtchn_do_upcall or xen_hvm_evtchn_do_upcall? If not the hvm version, when does that get used?

xen_evtchn_do_upcall is used for the callback vector interrupt injection (and regular PV obviously).

xen_hvm_evtchn_do_upcall is used by the old-style PCI IRQ injection route in platform-pci.c if the callback vector is not available.

So entry_64.S should be using xen_evtchn_do_upcall.

Also, I think smp_xen_hvm_callback_vector is simply a redundant duplicate of xen_evtchn_do_upcall which could be removed.

Ian.

#2 lore raw
Quoted 10 lines · Ian Campbell

xen_evtchn_do_upcall is used for the callback vector interrupt injection (and regular PV obviously).

xen_hvm_evtchn_do_upcall is used by the old-style PCI IRQ injection route in platform-pci.c if the callback vector is not available.

So entry_64.S should be using xen_evtchn_do_upcall.

Also, I think smp_xen_hvm_callback_vector is simply a redundant duplicate of xen_evtchn_do_upcall which could be removed.

smp_xen_hvm_callback_vector is just missing, so I think it should be using BUILD_INTERRUPT3 with the third arg being xen_evtchn_do_upcall.

J

#3 lore raw
Quoted 7 lines · Jeremy Fitzhardinge
Quoted 6 lines · Ian Campbell

xen_evtchn_do_upcall is used for the callback vector interrupt injection (and regular PV obviously).

xen_hvm_evtchn_do_upcall is used by the old-style PCI IRQ injection route in platform-pci.c if the callback vector is not available.

Quoted 6 lines
Quoted 4 lines

So entry_64.S should be using xen_evtchn_do_upcall.

Also, I think smp_xen_hvm_callback_vector is simply a redundant duplicate of xen_evtchn_do_upcall which could be removed.

smp_xen_hvm_callback_vector is just missing,

It's in drivers/xen/events.c, in the stable-2.6.32.x branch at least.

Quoted 2 lines

so I think it should be
using BUILD_INTERRUPT3 with the third arg being xen_evtchn_do_upcall.

I agree.

Ian.

#4 lore raw
In reply to Jeremy Fitzhardinge
Quoted 11 lines · Jeremy Fitzhardinge
Quoted 10 lines · Ian Campbell

xen_evtchn_do_upcall is used for the callback vector interrupt injection (and regular PV obviously).

xen_hvm_evtchn_do_upcall is used by the old-style PCI IRQ injection route in platform-pci.c if the callback vector is not available.

So entry_64.S should be using xen_evtchn_do_upcall.

Also, I think smp_xen_hvm_callback_vector is simply a redundant duplicate of xen_evtchn_do_upcall which could be removed.

That's true, in fact I removed it in my tree.
It should be removed in the upstream version too, I just forgot to send an update to Jeremy for the stable tree.

In my tree in entry_64 I have

apicinterrupt XEN_HVM_EVTCHN_CALLBACK \
xen_hvm_callback_vector xen_evtchn_do_upcall

where xen_evtchn_do_upcall is the same callback that PV guests use and smp_xen_hvm_callback_vector has been removed from drivers/xen/events.c too.

Quoted 3 lines

smp_xen_hvm_callback_vector is just missing, so I think it should be using BUILD_INTERRUPT3 with the third arg being xen_evtchn_do_upcall.

BUILD_INTERRUPT3 is an x86_32 only MACRO, that's why I am using apicinterrupt instead.

#5 lore raw
Quoted 4 lines · Stefano Stabellini
Quoted 2 lines

smp_xen_hvm_callback_vector is just missing, so I think it should be using BUILD_INTERRUPT3 with the third arg being xen_evtchn_do_upcall.

BUILD_INTERRUPT3 is an x86_32 only MACRO, that's why I am using apicinterrupt instead.

My original problem was that my 32-bit builds were failing because smp_xen_hvm_callback_vector was missing. I wonder if its the collision of two sets of patches.

J

#6 lore raw
Quoted 9 lines · Jeremy Fitzhardinge
Quoted 4 lines · Stefano Stabellini
Quoted 2 lines

smp_xen_hvm_callback_vector is just missing, so I think it should be using BUILD_INTERRUPT3 with the third arg being xen_evtchn_do_upcall.

BUILD_INTERRUPT3 is an x86_32 only MACRO, that's why I am using apicinterrupt instead.

My original problem was that my 32-bit builds were failing because smp_xen_hvm_callback_vector was missing. I wonder if its the collision of two sets of patches.

I think you are just missing a patch like this one:

---

arch/x86/kernel/entry_64.S +1 -1
index 1bf0911..a626344 100644
@@ -1365,7 +1365,7 @@ ENTRY(xen_failsafe_callback)
 END(xen_failsafe_callback)
 
 apicinterrupt XEN_HVM_EVTCHN_CALLBACK \
-	xen_hvm_callback_vector smp_xen_hvm_callback_vector
+	xen_hvm_callback_vector xen_evtchn_do_upcall
 
 #endif /* CONFIG_XEN */
 
drivers/xen/events.c +0 -15
index b4a00bf..743e08f 100644
@@ -1414,21 +1414,6 @@ int xen_set_callback_via(uint64_t via)
 }
 EXPORT_SYMBOL_GPL(xen_set_callback_via);
 
-void smp_xen_hvm_callback_vector(struct pt_regs *regs)
-{
-	struct pt_regs *old_regs = set_irq_regs(regs);
-
-	exit_idle();
-
-	irq_enter();
-
-	__xen_evtchn_do_upcall(regs);
-
-	irq_exit();
-
-	set_irq_regs(old_regs);
-}
-
 /* Vector callbacks are better than PCI interrupts to receive event
  * channel notifications because we can receive vector callbacks on any
  * vcpu and we don't need PCI support or APIC interactions. */
#7 lore raw
Quoted 4 lines · Stefano Stabellini
Quoted 3 lines · Jeremy Fitzhardinge
Quoted 2 lines · Stefano Stabellini
Quoted 2 lines

smp_xen_hvm_callback_vector is just missing, so I think it should be using BUILD_INTERRUPT3 with the third arg being xen_evtchn_do_upcall.

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

BUILD_INTERRUPT3 is an x86_32 only MACRO, that's why I am using apicinterrupt instead.

My original problem was that my 32-bit builds were failing because smp_xen_hvm_callback_vector was missing. I wonder if its the collision of two sets of patches.

I think you are just missing a patch like this one:

sorry I missed a very import chunk of the patch, appending again:

arch/x86/kernel/entry_32.S +2 -1
index 21feb03..7764118 100644
@@ -1088,7 +1088,8 @@ ENTRY(xen_failsafe_callback)
 .previous
 ENDPROC(xen_failsafe_callback)
 
-BUILD_INTERRUPT(xen_hvm_callback_vector, XEN_HVM_EVTCHN_CALLBACK)
+BUILD_INTERRUPT3(xen_hvm_callback_vector, XEN_HVM_EVTCHN_CALLBACK,
+		xen_evtchn_do_upcall)
 
 #endif	/* CONFIG_XEN */
 
arch/x86/kernel/entry_64.S +1 -1
index 1bf0911..a626344 100644
@@ -1365,7 +1365,7 @@ ENTRY(xen_failsafe_callback)
 END(xen_failsafe_callback)
 
 apicinterrupt XEN_HVM_EVTCHN_CALLBACK \
-	xen_hvm_callback_vector smp_xen_hvm_callback_vector
+	xen_hvm_callback_vector xen_evtchn_do_upcall
 
 #endif /* CONFIG_XEN */
 
drivers/xen/events.c +0 -15
index b4a00bf..743e08f 100644
@@ -1414,21 +1414,6 @@ int xen_set_callback_via(uint64_t via)
 }
 EXPORT_SYMBOL_GPL(xen_set_callback_via);
 
-void smp_xen_hvm_callback_vector(struct pt_regs *regs)
-{
-	struct pt_regs *old_regs = set_irq_regs(regs);
-
-	exit_idle();
-
-	irq_enter();
-
-	__xen_evtchn_do_upcall(regs);
-
-	irq_exit();
-
-	set_irq_regs(old_regs);
-}
-
 /* Vector callbacks are better than PCI interrupts to receive event
  * channel notifications because we can receive vector callbacks on any
  * vcpu and we don't need PCI support or APIC interactions. */