Skip to contentSkip to conversation

xen-internal API to allow xenstore stubdom to be registered to handle VIRQ_DOM_EXC

PATCH In review Alex Zeffertt 1 participant 1 message Mar 23, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 14/24 xen-internal API to allow xenstore stubdom to be registered to handle VIRQ_DOM_EXC

I sent these to Keir in an earlier state. He semeed to agree with the general approach. Here was my explanation:

Xenstored needs to know when domains are dead/dying.

When xenstored ran in dom0, this was the process:
1) Hypervisor sends VIRQ_DOM_EXC to dom0.
2) xenstored gets the domain info on each of its known domains to figure out who is dead/dying.

Those were two separate items that no longer worked when moving xenstored into a dedicated domain:
1) The xenstore domain does not receive the event if it is sent to dom0.
2) Getting domain info is restricted to fully privileged domains.

I've created a new hypercall so that dom0 can delegate the handling of VIRQ_DOM_EXC to the xenstore domain. I've also added an exception allowing the handler of VIRQ_DOM_EXC to query for domain info.

01_xen_virq_handler_api         Adds VIRQ handler functions [1].
02_xen_use_virq_handler_api     Converts most users to the above.
03_xen_virq_handler_hypercall   New hypercall to set VIRQ handler.
04_xen_virq_handler_dom_exc     Whitelist VIRQ_DOM_EXC for handling,

permissions exception.

[1] There's a new table of global VIRQ handlers: indexed by VIRQ number, values are domain struct pointers. When you want to send a global VIRQ with this mechanism, you only give the VIRQ number (not a domain). If the corresponding domain struct pointer is not NULL, the event is sent to that domain. Otherwise, it's sent to dom0. These handlers can't be modified arbitrarily: changing the handler to the explicit dom0 pointer allows that handler to be modified in the future.

---

xen/common/domain.c +2 -0
diff -r 62da7b4ee641 xen/common/domain.c
@@ -560,6 +560,8 @@
 
     arch_domain_destroy(d);
 
+    clear_global_virq_handler(d);
+
     rangeset_domain_destroy(d);
 
     sched_destroy_domain(d);
xen/common/event_channel.c +88 -0

100 lines not on this page · raw message

xen/include/xen/event.h +30 -0
diff -r 62da7b4ee641 xen/include/xen/event.h
@@ -29,6 +29,36 @@
  *  @virq:     Virtual IRQ number (VIRQ_*)
  */
 void send_guest_global_virq(struct domain *d, int virq);
+
+/* TODO: check comment formatting style: */
+
+/*
+ * send_handler_global_virq: Notify handler via a global VIRQ.
+ *  @virq:     Virtual IRQ number (VIRQ_*), must be global
+ * The event will be sent to the explicitly set handler (see
+ * set_global_virq_handler), or dom0. 
+ */
+void send_handler_global_virq(int virq);
+
+/*
+ * sent_global_virq_handler: Set a global VIRQ handler.
+ *  @d:        Domain to which future virtual IRQ's should be sent
+ *  @virq:     Virtual IRQ number (VIRQ_*), must be global
+ */
+int set_global_virq_handler(struct domain *d, int virq);
+
+/*
+ * clear_global_virq_handler: Remove this handler from all global VIRQs.
+ *  @d:        Domain to no longer handle global virtual IRQs
+ */
+void clear_global_virq_handler(struct domain *d);
+
+/*
+ * is_global_virq_handler: Query if domain is the handler for this global VIRQ.
+ *  @d:        Domain which may be the handler
+ *  @virq:     Virtual IRQ number (VIRQ_*), must be global
+ */
+int is_global_virq_handler(struct domain *d, int virq);
 
 /*
  * send_guest_pirq:

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