svn commit: r215818 - in head/sys/i386: include/xen xen

Colin Percival cperciva at FreeBSD.org
Thu Nov 25 15:05:22 UTC 2010


Author: cperciva
Date: Thu Nov 25 15:05:21 2010
New Revision: 215818
URL: http://svn.freebsd.org/changeset/base/215818

Log:
  Rename HYPERVISOR_multicall (which performs the multicall hypercall) to
  _HYPERVISOR_multicall, and create a new HYPERVISOR_multicall function which
  invokes _HYPERVISOR_multicall and checks that the individual hypercalls all
  succeeded.

Modified:
  head/sys/i386/include/xen/hypercall.h
  head/sys/i386/xen/xen_machdep.c

Modified: head/sys/i386/include/xen/hypercall.h
==============================================================================
--- head/sys/i386/include/xen/hypercall.h	Thu Nov 25 13:39:55 2010	(r215817)
+++ head/sys/i386/include/xen/hypercall.h	Thu Nov 25 15:05:21 2010	(r215818)
@@ -234,8 +234,9 @@ HYPERVISOR_memory_op(
 	return _hypercall2(int, memory_op, cmd, arg);
 }
 
+int HYPERVISOR_multicall(multicall_entry_t *, int);
 static inline int
-HYPERVISOR_multicall(
+_HYPERVISOR_multicall(
 	void *call_list, int nr_calls)
 {
 	return _hypercall2(int, multicall, call_list, nr_calls);

Modified: head/sys/i386/xen/xen_machdep.c
==============================================================================
--- head/sys/i386/xen/xen_machdep.c	Thu Nov 25 13:39:55 2010	(r215817)
+++ head/sys/i386/xen/xen_machdep.c	Thu Nov 25 15:05:21 2010	(r215818)
@@ -1177,6 +1177,27 @@ trap_info_t trap_table[] = {
 	{  0, 0,           0, 0 }
 };
 
+/* Perform a multicall and check that individual calls succeeded. */
+int
+HYPERVISOR_multicall(struct multicall_entry * call_list, int nr_calls)
+{
+	int ret = 0;
+	int i;
+
+	/* Perform the multicall. */
+	PANIC_IF(_HYPERVISOR_multicall(call_list, nr_calls));
+
+	/* Check the results of individual hypercalls. */
+	for (i = 0; i < nr_calls; i++)
+		if (unlikely(call_list[i].result < 0))
+			ret++;
+	if (unlikely(ret > 0))
+		panic("%d multicall(s) failed: cpu %d\n",
+		    ret, smp_processor_id());
+
+	/* If we didn't panic already, everything succeeded. */
+	return (0);
+}
 
 /********** CODE WORTH KEEPING ABOVE HERE *****************/ 
 


More information about the svn-src-head mailing list