# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1200996592 0
# Node ID 17a1a39df56523f3825fe37588059687e79cdc6d
# Parent 7070d34f251c3e0c411022a5d365aea9804114a7
xen: check hypercall return status
Not doing so is almost always a mistake, potentially resulting in
debugging of problems being much more difficult.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
arch/i386/kernel/cpu/mtrr/main-xen.c | 3 -
arch/i386/kernel/fixup.c | 8 +--
arch/i386/kernel/io_apic-xen.c | 4 -
arch/i386/kernel/ioport-xen.c | 3 -
arch/i386/kernel/process-xen.c | 10 ++--
arch/i386/kernel/quirks-xen.c | 2
arch/i386/kernel/setup-xen.c | 9 ++-
arch/i386/kernel/time-xen.c | 42 ++++++++++++++----
arch/i386/kernel/traps-xen.c | 6 ++
arch/i386/oprofile/xenoprof.c | 4 -
arch/x86_64/kernel/io_apic-xen.c | 2
arch/x86_64/kernel/ioport-xen.c | 5 +-
arch/x86_64/kernel/process-xen.c | 17 ++++---
arch/x86_64/kernel/setup-xen.c | 6 +-
arch/x86_64/kernel/setup64-xen.c | 4 +
arch/x86_64/kernel/traps-xen.c | 4 -
arch/x86_64/mm/init-xen.c | 10 ++--
drivers/xen/core/evtchn.c | 12 +++--
drivers/xen/core/machine_kexec.c | 4 -
drivers/xen/core/machine_reboot.c | 10 ++--
drivers/xen/netback/netback.c | 26 +++++++----
drivers/xen/netfront/netfront.c | 11 +++-
drivers/xen/xenoprof/xenoprofile.c | 12 +++--
include/asm-i386/mach-xen/asm/desc.h | 4 +
include/asm-i386/mach-xen/asm/hypercall.h | 62 ++++++++++++++-------------
include/asm-i386/mach-xen/asm/hypervisor.h | 23 ++++------
include/asm-i386/mach-xen/asm/processor.h | 10 ++--
include/asm-x86_64/mach-xen/asm/desc.h | 4 +
include/asm-x86_64/mach-xen/asm/hypercall.h | 64 ++++++++++++++--------------
include/asm-x86_64/mach-xen/asm/processor.h | 6 +-
include/xen/evtchn.h | 2
include/xen/hypercall.h | 7 ++-
32 files changed, 234 insertions(+), 162 deletions(-)
diff -r 7070d34f251c -r 17a1a39df565 arch/i386/kernel/cpu/mtrr/main-xen.c
--- a/arch/i386/kernel/cpu/mtrr/main-xen.c Mon Jan 21 11:43:31 2008 +0000
+++ b/arch/i386/kernel/cpu/mtrr/main-xen.c Tue Jan 22 10:09:52 2008 +0000
@@ -18,7 +18,8 @@ void generic_get_mtrr(unsigned int reg,
op.cmd = XENPF_read_memtype;
op.u.read_memtype.reg = reg;
- (void)HYPERVISOR_platform_op(&op);
+ if (unlikely(HYPERVISOR_platform_op(&op)))
+ memset(&op.u.read_memtype, 0, sizeof(op.u.read_memtype));
*size = op.u.read_memtype.nr_mfns;
*base = op.u.read_memtype.mfn;
diff -r 7070d34f251c -r 17a1a39df565 arch/i386/kernel/fixup.c
--- a/arch/i386/kernel/fixup.c Mon Jan 21 11:43:31 2008 +0000
+++ b/arch/i386/kernel/fixup.c Tue Jan 22 10:09:52 2008 +0000
@@ -46,8 +46,8 @@ fastcall void do_fixup_4gb_segment(struc
if (current->tgid == 1)
return;
- HYPERVISOR_vm_assist(
- VMASST_CMD_disable, VMASST_TYPE_4gb_segments_notify);
+ VOID(HYPERVISOR_vm_assist(VMASST_CMD_disable,
+ VMASST_TYPE_4gb_segments_notify));
if (test_and_set_bit(0, &printed))
return;
@@ -81,8 +81,8 @@ fastcall void do_fixup_4gb_segment(struc
static int __init fixup_init(void)
{
- HYPERVISOR_vm_assist(
- VMASST_CMD_enable, VMASST_TYPE_4gb_segments_notify);
+ WARN_ON(HYPERVISOR_vm_assist(VMASST_CMD_enable,
+ VMASST_TYPE_4gb_segments_notify));
return 0;
}
__initcall(fixup_init);
diff -r 7070d34f251c -r 17a1a39df565 arch/i386/kernel/io_apic-xen.c
--- a/arch/i386/kernel/io_apic-xen.c Mon Jan 21 11:43:31 2008 +0000
+++ b/arch/i386/kernel/io_apic-xen.c Tue Jan 22 10:09:52 2008 +0000
@@ -75,7 +75,7 @@ static inline void xen_io_apic_write(uns
apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr;
apic_op.reg = reg;
apic_op.value = value;
- HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, &apic_op);
+ WARN_ON(HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, &apic_op));
}
#define io_apic_read(a,r) xen_io_apic_read(a,r)
@@ -2506,7 +2506,7 @@ static int __init io_apic_bug_finalize(v
struct xen_platform_op op = { .cmd = XENPF_platform_quirk };
op.u.platform_quirk.quirk_id = sis_apic_bug ?
QUIRK_IOAPIC_BAD_REGSEL : QUIRK_IOAPIC_GOOD_REGSEL;
- HYPERVISOR_platform_op(&op);
+ VOID(HYPERVISOR_platform_op(&op));
}
return 0;
}
diff -r 7070d34f251c -r 17a1a39df565 arch/i386/kernel/ioport-xen.c
--- a/arch/i386/kernel/ioport-xen.c Mon Jan 21 11:43:31 2008 +0000
+++ b/arch/i386/kernel/ioport-xen.c Tue Jan 22 10:09:52 2008 +0000
@@ -83,7 +83,8 @@ asmlinkage long sys_ioperm(unsigned long
set_xen_guest_handle(set_iobitmap.bitmap, (char *)bitmap);
set_iobitmap.nr_ports = IO_BITMAP_BITS;
- HYPERVISOR_physdev_op(PHYSDEVOP_set_iobitmap, &set_iobitmap);
+ WARN_ON(HYPERVISOR_physdev_op(PHYSDEVOP_set_iobitmap,
+ &set_iobitmap));
}
set_bitmap(t->io_bitmap_ptr, from, num, !turn_on);
diff -r 7070d34f251c -r 17a1a39df565 arch/i386/kernel/process-xen.c
--- a/arch/i386/kernel/process-xen.c Mon Jan 21 11:43:31 2008 +0000
+++ b/arch/i386/kernel/process-xen.c Tue Jan 22 10:09:52 2008 +0000
@@ -137,8 +137,7 @@ static inline void play_dead(void)
idle_task_exit();
local_irq_disable();
cpu_clear(smp_processor_id(), cpu_initialized);
- preempt_enable_no_resched();
- HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL);
+ xen_halt();
cpu_bringup();
}
#else
@@ -309,7 +308,8 @@ void exit_thread(void)
struct thread_struct *t = &tsk->thread;
struct physdev_set_iobitmap set_iobitmap;
memset(&set_iobitmap, 0, sizeof(set_iobitmap));
- HYPERVISOR_physdev_op(PHYSDEVOP_set_iobitmap, &set_iobitmap);
+ WARN_ON(HYPERVISOR_physdev_op(PHYSDEVOP_set_iobitmap,
+ &set_iobitmap));
kfree(t->io_bitmap_ptr);
t->io_bitmap_ptr = NULL;
clear_thread_flag(TIF_IO_BITMAP);
@@ -616,7 +616,9 @@ struct task_struct fastcall * __switch_t
mcl++;
}
- (void)HYPERVISOR_multicall(_mcl, mcl - _mcl);
+ BUG_ON(mcl > _mcl + ARRAY_SIZE(_mcl));
+ if (unlikely(HYPERVISOR_multicall_check(_mcl, mcl - _mcl, NULL)))
+ BUG();
/*
* Restore %fs and %gs if needed.
diff -r 7070d34f251c -r 17a1a39df565 arch/i386/kernel/quirks-xen.c
--- a/arch/i386/kernel/quirks-xen.c Mon Jan 21 11:43:31 2008 +0000
+++ b/arch/i386/kernel/quirks-xen.c Tue Jan 22 10:09:52 2008 +0000
@@ -34,7 +34,7 @@ static void __devinit quirk_intel_irqbal
printk(KERN_INFO "Disabling irq balancing and affinity\n");
op.cmd = XENPF_platform_quirk;
op.u.platform_quirk.quirk_id = QUIRK_NOIRQBALANCING;
- (void)HYPERVISOR_platform_op(&op);
+ WARN_ON(HYPERVISOR_platform_op(&op));
}
/* put back the original value for config space*/
diff -r 7070d34f251c -r 17a1a39df565 arch/i386/kernel/setup-xen.c
--- a/arch/i386/kernel/setup-xen.c Mon Jan 21 11:43:31 2008 +0000
+++ b/arch/i386/kernel/setup-xen.c Tue Jan 22 10:09:52 2008 +0000
@@ -1621,9 +1621,10 @@ void __init setup_arch(char **cmdline_p)
/* Register a call for panic conditions. */
atomic_notifier_chain_register(&panic_notifier_list, &xen_panic_block);
- HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments);
- HYPERVISOR_vm_assist(VMASST_CMD_enable,
- VMASST_TYPE_writable_pagetables);
+ WARN_ON(HYPERVISOR_vm_assist(VMASST_CMD_enable,
+ VMASST_TYPE_4gb_segments));
+ WARN_ON(HYPERVISOR_vm_assist(VMASST_CMD_enable,
+ VMASST_TYPE_writable_pagetables));
memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
early_cpu_init();
@@ -1827,7 +1828,7 @@ void __init setup_arch(char **cmdline_p)
efi_map_memmap();
set_iopl.iopl = 1;
- HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl);
+ WARN_ON(HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl));
#ifdef CONFIG_ACPI
if (!is_initial_xendomain()) {
diff -r 7070d34f251c -r 17a1a39df565 arch/i386/kernel/time-xen.c
--- a/arch/i386/kernel/time-xen.c Mon Jan 21 11:43:31 2008 +0000
+++ b/arch/i386/kernel/time-xen.c Tue Jan 22 10:09:52 2008 +0000
@@ -519,7 +519,7 @@ static void sync_xen_wallclock(unsigned
op.u.settime.secs = sec;
op.u.settime.nsecs = nsec;
op.u.settime.system_time = processed_system_time;
- HYPERVISOR_platform_op(&op);
+ WARN_ON(HYPERVISOR_platform_op(&op));
update_wallclock();
@@ -914,8 +914,16 @@ void __init time_init(void)
}
#endif
- HYPERVISOR_vcpu_op(VCPUOP_set_periodic_timer, 0,
- &xen_set_periodic_tick);
+ switch (HYPERVISOR_vcpu_op(VCPUOP_set_periodic_timer, 0,
+ &xen_set_periodic_tick)) {
+ case 0:
+#if CONFIG_XEN_COMPAT <= 0x030004
+ case -ENOSYS:
+#endif
+ break;
+ default:
+ BUG();
+ }
get_time_values_from_xen(0);
@@ -1026,7 +1034,7 @@ void halt(void)
void halt(void)
{
if (irqs_disabled())
- HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL);
+ VOID(HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL));
}
EXPORT_SYMBOL(halt);
@@ -1038,8 +1046,16 @@ void time_resume(void)
init_cpu_khz();
for_each_online_cpu(cpu) {
- HYPERVISOR_vcpu_op(VCPUOP_set_periodic_timer, cpu,
- &xen_set_periodic_tick);
+ switch (HYPERVISOR_vcpu_op(VCPUOP_set_periodic_timer, cpu,
+ &xen_set_periodic_tick)) {
+ case 0:
+#if CONFIG_XEN_COMPAT <= 0x030004
+ case -ENOSYS:
+#endif
+ break;
+ default:
+ BUG();
+ }
get_time_values_from_xen(cpu);
per_cpu(processed_system_time, cpu) =
per_cpu(shadow_time, 0).system_timestamp;
@@ -1060,8 +1076,16 @@ int __cpuinit local_setup_timer(unsigned
BUG_ON(cpu == 0);
- HYPERVISOR_vcpu_op(VCPUOP_set_periodic_timer, cpu,
- &xen_set_periodic_tick);
+ switch (HYPERVISOR_vcpu_op(VCPUOP_set_periodic_timer, cpu,
+ &xen_set_periodic_tick)) {
+ case 0:
+#if CONFIG_XEN_COMPAT <= 0x030004
+ case -ENOSYS:
+#endif
+ break;
+ default:
+ BUG();
+ }
do {
seq = read_seqbegin(&xtime_lock);
@@ -1109,7 +1133,7 @@ static int time_cpufreq_notifier(struct
op.u.change_freq.flags = 0;
op.u.change_freq.cpu = freq->cpu;
op.u.change_freq.freq = (u64)freq->new * 1000;
- HYPERVISOR_platform_op(&op);
+ WARN_ON(HYPERVISOR_platform_op(&op));
return 0;
}
diff -r 7070d34f251c -r 17a1a39df565 arch/i386/kernel/traps-xen.c
--- a/arch/i386/kernel/traps-xen.c Mon Jan 21 11:43:31 2008 +0000
+++ b/arch/i386/kernel/traps-xen.c Tue Jan 22 10:09:52 2008 +0000
@@ -1121,7 +1121,11 @@ static trap_info_t trap_table[] = {
void __init trap_init(void)
{
- HYPERVISOR_set_trap_table(trap_table);
+ int ret;
+
+ ret = HYPERVISOR_set_trap_table(trap_table);
+ if (ret)
+ printk("HYPERVISOR_set_trap_table failed: error %d\n", ret);
if (cpu_has_fxsr) {
/*
diff -r 7070d34f251c -r 17a1a39df565 arch/i386/oprofile/xenoprof.c
--- a/arch/i386/oprofile/xenoprof.c Mon Jan 21 11:43:31 2008 +0000
+++ b/arch/i386/oprofile/xenoprof.c Tue Jan 22 10:09:52 2008 +0000
@@ -52,8 +52,8 @@ void xenoprof_arch_counter(void)
counter.kernel = (uint32_t)counter_config[i].kernel;
counter.user = (uint32_t)counter_config[i].user;
counter.unit_mask = (uint64_t)counter_config[i].unit_mask;
- HYPERVISOR_xenoprof_op(XENOPROF_counter,
- &counter);
+ WARN_ON(HYPERVISOR_xenoprof_op(XENOPROF_counter,
+ &counter));
}
}
diff -r 7070d34f251c -r 17a1a39df565 arch/x86_64/kernel/io_apic-xen.c
--- a/arch/x86_64/kernel/io_apic-xen.c Mon Jan 21 11:43:31 2008 +0000
+++ b/arch/x86_64/kernel/io_apic-xen.c Tue Jan 22 10:09:52 2008 +0000
@@ -123,7 +123,7 @@ static inline void xen_io_apic_write(uns
apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr;
apic_op.reg = reg;
apic_op.value = value;
- HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, &apic_op);
+ WARN_ON(HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, &apic_op));
}
#define io_apic_read(a,r) xen_io_apic_read(a,r)
diff -r 7070d34f251c -r 17a1a39df565 arch/x86_64/kernel/ioport-xen.c
--- a/arch/x86_64/kernel/ioport-xen.c Mon Jan 21 11:43:31 2008 +0000
+++ b/arch/x86_64/kernel/ioport-xen.c Tue Jan 22 10:09:52 2008 +0000
@@ -61,7 +61,8 @@ asmlinkage long sys_ioperm(unsigned long
set_xen_guest_handle(set_iobitmap.bitmap, (char *)bitmap);
set_iobitmap.nr_ports = IO_BITMAP_BITS;
- HYPERVISOR_physdev_op(PHYSDEVOP_set_iobitmap, &set_iobitmap);
+ WARN_ON(HYPERVISOR_physdev_op(PHYSDEVOP_set_iobitmap,
+ &set_iobitmap));
}
set_bitmap(t->io_bitmap_ptr, from, num, !turn_on);
@@ -93,7 +94,7 @@ asmlinkage long sys_iopl(unsigned int ne
/* Force the change at ring 0. */
set_iopl.iopl = (new_iopl == 0) ? 1 : new_iopl;
- HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl);
+ WARN_ON(HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl));
return 0;
}
diff -r 7070d34f251c -r 17a1a39df565 arch/x86_64/kernel/process-xen.c
--- a/arch/x86_64/kernel/process-xen.c Mon Jan 21 11:43:31 2008 +0000
+++ b/arch/x86_64/kernel/process-xen.c Tue Jan 22 10:09:52 2008 +0000
@@ -151,8 +151,7 @@ static inline void play_dead(void)
idle_task_exit();
local_irq_disable();
cpu_clear(smp_processor_id(), cpu_initialized);
- preempt_enable_no_resched();
- HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL);
+ xen_halt();
cpu_bringup();
}
#else
@@ -318,7 +317,8 @@ void exit_thread(void)
put_cpu();
#endif
#ifdef CONFIG_XEN
- HYPERVISOR_physdev_op(PHYSDEVOP_set_iobitmap, &iobmp_op);
+ WARN_ON(HYPERVISOR_physdev_op(PHYSDEVOP_set_iobitmap,
+ &iobmp_op));
#endif
t->io_bitmap_max = 0;
}
@@ -326,7 +326,7 @@ void exit_thread(void)
void load_gs_index(unsigned gs)
{
- HYPERVISOR_set_segment_base(SEGBASE_GS_USER_SEL, gs);
+ WARN_ON(HYPERVISOR_set_segment_base(SEGBASE_GS_USER_SEL, gs));
}
void flush_thread(void)
@@ -550,7 +550,10 @@ __switch_to(struct task_struct *prev_p,
mcl++;
}
- (void)HYPERVISOR_multicall(_mcl, mcl - _mcl);
+ BUG_ON(mcl > _mcl + ARRAY_SIZE(_mcl));
+ if (unlikely(HYPERVISOR_multicall_check(_mcl, mcl - _mcl, NULL)))
+ BUG();
+
/*
* Switch DS and ES.
* This won't pick up thread selector changes, but I guess that is ok.
@@ -568,13 +571,13 @@ __switch_to(struct task_struct *prev_p,
loadsegment(fs, next->fsindex);
if (next->fs)
- HYPERVISOR_set_segment_base(SEGBASE_FS, next->fs);
+ WARN_ON(HYPERVISOR_set_segment_base(SEGBASE_FS, next->fs));
if (unlikely(next->gsindex))
load_gs_index(next->gsindex);
if (next->gs)
- HYPERVISOR_set_segment_base(SEGBASE_GS_USER, next->gs);
+ WARN_ON(HYPERVISOR_set_segment_base(SEGBASE_GS_USER, next->gs));
/*
* Switch the PDA context.
diff -r 7070d34f251c -r 17a1a39df565 arch/x86_64/kernel/setup-xen.c
--- a/arch/x86_64/kernel/setup-xen.c Mon Jan 21 11:43:31 2008 +0000
+++ b/arch/x86_64/kernel/setup-xen.c Tue Jan 22 10:09:52 2008 +0000
@@ -607,8 +607,8 @@ void __init setup_arch(char **cmdline_p)
copy_edid();
- HYPERVISOR_vm_assist(VMASST_CMD_enable,
- VMASST_TYPE_writable_pagetables);
+ WARN_ON(HYPERVISOR_vm_assist(VMASST_CMD_enable,
+ VMASST_TYPE_writable_pagetables));
ARCH_SETUP
#else
@@ -940,7 +940,7 @@ void __init setup_arch(char **cmdline_p)
struct physdev_set_iopl set_iopl;
set_iopl.iopl = 1;
- HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl);
+ WARN_ON(HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl));
if (is_initial_xendomain()) {
#ifdef CONFIG_VT
diff -r 7070d34f251c -r 17a1a39df565 arch/x86_64/kernel/setup64-xen.c
--- a/arch/x86_64/kernel/setup64-xen.c Mon Jan 21 11:43:31 2008 +0000
+++ b/arch/x86_64/kernel/setup64-xen.c Tue Jan 22 10:09:52 2008 +0000
@@ -171,7 +171,9 @@ void pda_init(int cpu)
#ifndef CONFIG_XEN
wrmsrl(MSR_GS_BASE, pda);
#else
- HYPERVISOR_set_segment_base(SEGBASE_GS_KERNEL, (unsigned long)pda);
+ if (HYPERVISOR_set_segment_base(SEGBASE_GS_KERNEL,
+ (unsigned long)pda))
+ BUG();
#endif
pda->cpunumber = cpu;
pda->irqcount = -1;
diff -r 7070d34f251c -r 17a1a39df565 arch/x86_64/kernel/traps-xen.c
--- a/arch/x86_64/kernel/traps-xen.c Mon Jan 21 11:43:31 2008 +0000
+++ b/arch/x86_64/kernel/traps-xen.c Tue Jan 22 10:09:52 2008 +0000
@@ -1120,10 +1120,8 @@ void __init trap_init(void)
int ret;
ret = HYPERVISOR_set_trap_table(trap_table);
-
if (ret)
- printk("HYPERVISOR_set_trap_table faild: error %d\n",
- ret);
+ printk("HYPERVISOR_set_trap_table failed: error %d\n", ret);
/*
* Should be a barrier for any external CPU state.
diff -r 7070d34f251c -r 17a1a39df565 arch/x86_64/mm/init-xen.c
--- a/arch/x86_64/mm/init-xen.c Mon Jan 21 11:43:31 2008 +0000
+++ b/arch/x86_64/mm/init-xen.c Tue Jan 22 10:09:52 2008 +0000
@@ -593,7 +593,8 @@ static void __init extend_init_mapping(u
/* Kill mapping of low 1MB. */
while (va < (unsigned long)&_text) {
- HYPERVISOR_update_va_mapping(va, __pte_ma(0), 0);
+ if (HYPERVISOR_update_va_mapping(va, __pte_ma(0), 0))
+ BUG();
va += PAGE_SIZE;
}
@@ -626,7 +627,8 @@ static void __init extend_init_mapping(u
pmd = (pmd_t *)&page[pmd_index(va)];
if (pmd_none(*pmd))
break;
- HYPERVISOR_update_va_mapping(va, __pte_ma(0), 0);
+ if (HYPERVISOR_update_va_mapping(va, __pte_ma(0), 0))
+ BUG();
va += PAGE_SIZE;
}
}
@@ -679,8 +681,8 @@ static void xen_finish_init_mapping(void
start = PAGE_ALIGN((unsigned long)_end);
end = __START_KERNEL_map + (table_end << PAGE_SHIFT);
for (; start < end; start += PAGE_SIZE)
- WARN_ON(HYPERVISOR_update_va_mapping(
- start, __pte_ma(0), 0));
+ if (HYPERVISOR_update_va_mapping(start, __pte_ma(0), 0))
+ BUG();
/* Allocate pte's for initial fixmaps from 'start_pfn' allocator. */
table_end = ~0UL;
diff -r 7070d34f251c -r 17a1a39df565 drivers/xen/core/evtchn.c
--- a/drivers/xen/core/evtchn.c Mon Jan 21 11:43:31 2008 +0000
+++ b/drivers/xen/core/evtchn.c Tue Jan 22 10:09:52 2008 +0000
@@ -215,7 +215,7 @@ static inline void exit_idle(void) {}
*/
void force_evtchn_callback(void)
{
- (void)HYPERVISOR_xen_version(0, NULL);
+ VOID(HYPERVISOR_xen_version(0, NULL));
}
/* Not a GPL symbol: used in ubiquitous macros, so too restrictive. */
EXPORT_SYMBOL(force_evtchn_callback);
@@ -749,14 +749,15 @@ static inline void pirq_unmask_notify(in
{
struct physdev_eoi eoi = { .irq = pirq };
if (unlikely(test_bit(pirq, pirq_needs_eoi)))
- (void)HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi);
+ VOID(HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi));
}
static inline void pirq_query_unmask(int pirq)
{
struct physdev_irq_status_query irq_status;
irq_status.irq = pirq;
- (void)HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status);
+ if (HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status))
+ irq_status.flags = 0;
clear_bit(pirq, pirq_needs_eoi);
if (irq_status.flags & XENIRQSTAT_needs_eoi)
set_bit(pirq, pirq_needs_eoi);
@@ -874,7 +875,8 @@ int irq_ignore_unhandled(unsigned int ir
if (!is_running_on_xen())
return 0;
- (void)HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status);
+ if (HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status))
+ return 0;
return !!(irq_status.flags & XENIRQSTAT_shared);
}
@@ -911,7 +913,7 @@ void unmask_evtchn(int port)
/* Slow path (hypercall) if this is a non-local port. */
if (unlikely(cpu != cpu_from_evtchn(port))) {
struct evtchn_unmask unmask = { .port = port };
- (void)HYPERVISOR_event_channel_op(EVTCHNOP_unmask, &unmask);
+ VOID(HYPERVISOR_event_channel_op(EVTCHNOP_unmask, &unmask));
return;
}
diff -r 7070d34f251c -r 17a1a39df565 drivers/xen/core/machine_kexec.c
--- a/drivers/xen/core/machine_kexec.c Mon Jan 21 11:43:31 2008 +0000
+++ b/drivers/xen/core/machine_kexec.c Tue Jan 22 10:09:52 2008 +0000
@@ -151,7 +151,7 @@ void xen_machine_kexec_unload(struct kim
memset(&xkl, 0, sizeof(xkl));
xkl.type = image->type;
- HYPERVISOR_kexec_op(KEXEC_CMD_kexec_unload, &xkl);
+ WARN_ON(HYPERVISOR_kexec_op(KEXEC_CMD_kexec_unload, &xkl));
}
/*
@@ -168,7 +168,7 @@ NORET_TYPE void machine_kexec(struct kim
memset(&xke, 0, sizeof(xke));
xke.type = image->type;
- HYPERVISOR_kexec_op(KEXEC_CMD_kexec, &xke);
+ VOID(HYPERVISOR_kexec_op(KEXEC_CMD_kexec, &xke));
panic("KEXEC_CMD_kexec hypercall should not return\n");
}
diff -r 7070d34f251c -r 17a1a39df565 drivers/xen/core/machine_reboot.c
--- a/drivers/xen/core/machine_reboot.c Mon Jan 21 11:43:31 2008 +0000
+++ b/drivers/xen/core/machine_reboot.c Tue Jan 22 10:09:52 2008 +0000
@@ -60,8 +60,8 @@ static void pre_suspend(void)
static void pre_suspend(void)
{
HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page;
- HYPERVISOR_update_va_mapping(fix_to_virt(FIX_SHARED_INFO),
- __pte_ma(0), 0);
+ WARN_ON(HYPERVISOR_update_va_mapping(fix_to_virt(FIX_SHARED_INFO),
+ __pte_ma(0), 0));
xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn);
xen_start_info->console.domU.mfn =
@@ -88,8 +88,10 @@ static void post_suspend(int suspend_can
}
shinfo_mfn = xen_start_info->shared_info >> PAGE_SHIFT;
- HYPERVISOR_update_va_mapping(fix_to_virt(FIX_SHARED_INFO),
- pfn_pte_ma(shinfo_mfn, PAGE_KERNEL), 0);
+ if (HYPERVISOR_update_va_mapping(fix_to_virt(FIX_SHARED_INFO),
+ pfn_pte_ma(shinfo_mfn, PAGE_KERNEL),
+ 0))
+ BUG();
HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO);
memset(empty_zero_page, 0, PAGE_SIZE);
diff -r 7070d34f251c -r 17a1a39df565 drivers/xen/netback/netback.c
--- a/drivers/xen/netback/netback.c Mon Jan 21 11:43:31 2008 +0000
+++ b/drivers/xen/netback/netback.c Tue Jan 22 10:09:52 2008 +0000
@@ -142,14 +142,16 @@ static int check_mfn(int nr)
.extent_order = 0,
.domid = DOMID_SELF
};
+ int rc;
if (likely(alloc_index >= nr))
return 0;
set_xen_guest_handle(reservation.extent_start, mfn_list + alloc_index);
reservation.nr_extents = MAX_MFN_ALLOC - alloc_index;
- alloc_index += HYPERVISOR_memory_op(XENMEM_increase_reservation,
- &reservation);
+ rc = HYPERVISOR_memory_op(XENMEM_increase_reservation, &reservation);
+ if (likely(rc > 0))
+ alloc_index += rc;
return alloc_index >= nr ? 0 : -ENOMEM;
}
@@ -345,7 +347,7 @@ int xen_network_done(void)
struct netrx_pending_operations {
unsigned trans_prod, trans_cons;
- unsigned mmu_prod, mmu_cons;
+ unsigned mmu_prod, mmu_mcl;
unsigned mcl_prod, mcl_cons;
unsigned copy_prod, copy_cons;
unsigned meta_prod, meta_cons;
@@ -601,8 +603,12 @@ static void net_rx_action(unsigned long
break;
}
- if (npo.mcl_prod &&
- !xen_feature(XENFEAT_auto_translated_physmap)) {
+ BUG_ON(npo.meta_prod > ARRAY_SIZE(meta));
+
+ npo.mmu_mcl = npo.mcl_prod;
+ if (npo.mcl_prod) {
+ BUG_ON(!xen_feature(XENFEAT_auto_translated_physmap));
+ BUG_ON(npo.mmu_prod > ARRAY_SIZE(rx_mmu));
mcl = npo.mcl + npo.mcl_prod++;
BUG_ON(mcl[-1].op != __HYPERVISOR_update_va_mapping);
@@ -616,6 +622,7 @@ static void net_rx_action(unsigned long
}
if (npo.trans_prod) {
+ BUG_ON(npo.trans_prod > ARRAY_SIZE(grant_trans_op));
mcl = npo.mcl + npo.mcl_prod++;
mcl->op = __HYPERVISOR_grant_table_op;
mcl->args[0] = GNTTABOP_transfer;
@@ -624,6 +631,7 @@ static void net_rx_action(unsigned long
}
if (npo.copy_prod) {
+ BUG_ON(npo.copy_prod > ARRAY_SIZE(grant_copy_op));
mcl = npo.mcl + npo.mcl_prod++;
mcl->op = __HYPERVISOR_grant_table_op;
mcl->args[0] = GNTTABOP_copy;
@@ -635,14 +643,12 @@ static void net_rx_action(unsigned long
if (!npo.mcl_prod)
return;
- BUG_ON(npo.copy_prod > NET_RX_RING_SIZE);
- BUG_ON(npo.mmu_prod > NET_RX_RING_SIZE);
- BUG_ON(npo.trans_prod > NET_RX_RING_SIZE);
- BUG_ON(npo.mcl_prod > NET_RX_RING_SIZE+3);
- BUG_ON(npo.meta_prod > NET_RX_RING_SIZE);
+ BUG_ON(npo.mcl_prod > ARRAY_SIZE(rx_mcl));
ret = HYPERVISOR_multicall(npo.mcl, npo.mcl_prod);
BUG_ON(ret != 0);
+ /* The mmu_machphys_update() must not fail. */
+ BUG_ON(npo.mmu_mcl && npo.mcl[npo.mmu_mcl].result != 0);
while ((skb = __skb_dequeue(&rxq)) != NULL) {
nr_frags = *(int *)skb->cb;
diff -r 7070d34f251c -r 17a1a39df565 drivers/xen/netfront/netfront.c
--- a/drivers/xen/netfront/netfront.c Mon Jan 21 11:43:31 2008 +0000
+++ b/drivers/xen/netfront/netfront.c Tue Jan 22 10:09:52 2008 +0000
@@ -840,11 +840,14 @@ no_skb:
/* Zap PTEs and give away pages in one big
* multicall. */
- (void)HYPERVISOR_multicall(np->rx_mcl, i+1);
+ if (unlikely(HYPERVISOR_multicall(np->rx_mcl, i+1)))
+ BUG();
/* Check return status of HYPERVISOR_memory_op(). */
if (unlikely(np->rx_mcl[i].result != i))
panic("Unable to reduce memory reservation\n");
+ while (i--)
+ BUG_ON(np->rx_mcl[i].result);
} else {
if (HYPERVISOR_memory_op(XENMEM_decrease_reservation,
&reservation) != i)
@@ -1447,8 +1450,10 @@ err:
mcl->args[1] = pages_flipped;
mcl->args[2] = 0;
mcl->args[3] = DOMID_SELF;
- (void)HYPERVISOR_multicall(np->rx_mcl,
- pages_flipped + 1);
+ err = HYPERVISOR_multicall_check(np->rx_mcl,
+ pages_flipped + 1,
+ NULL);
+ BUG_ON(err);
}
}
diff -r 7070d34f251c -r 17a1a39df565 drivers/xen/xenoprof/xenoprofile.c
--- a/drivers/xen/xenoprof/xenoprofile.c Mon Jan 21 11:43:31 2008 +0000
+++ b/drivers/xen/xenoprof/xenoprofile.c Tue Jan 22 10:09:52 2008 +0000
@@ -346,10 +346,11 @@ static void xenoprof_shutdown(void)
{
xenoprof_enabled = 0;
- HYPERVISOR_xenoprof_op(XENOPROF_disable_virq, NULL);
+ WARN_ON(HYPERVISOR_xenoprof_op(XENOPROF_disable_virq, NULL));
if (xenoprof_is_primary) {
- HYPERVISOR_xenoprof_op(XENOPROF_release_counters, NULL);
+ WARN_ON(HYPERVISOR_xenoprof_op(XENOPROF_release_counters,
+ NULL));
active_defined = 0;
}
@@ -376,7 +377,7 @@ static void xenoprof_stop(void)
static void xenoprof_stop(void)
{
if (xenoprof_is_primary)
- HYPERVISOR_xenoprof_op(XENOPROF_stop, NULL);
+ WARN_ON(HYPERVISOR_xenoprof_op(XENOPROF_stop, NULL));
xenoprof_arch_stop();
}
@@ -419,7 +420,8 @@ static int xenoprof_set_active(int * act
out:
if (ret)
- HYPERVISOR_xenoprof_op(XENOPROF_reset_active_list, NULL);
+ WARN_ON(HYPERVISOR_xenoprof_op(XENOPROF_reset_active_list,
+ NULL));
active_defined = !ret;
return ret;
}
@@ -539,6 +541,6 @@ void xenoprofile_exit(void)
xenoprof_arch_unmap_shared_buffer(&shared_buffer);
if (xenoprof_is_primary) {
unmap_passive_list();
- HYPERVISOR_xenoprof_op(XENOPROF_shutdown, NULL);
+ WARN_ON(HYPERVISOR_xenoprof_op(XENOPROF_shutdown, NULL));
}
}
diff -r 7070d34f251c -r 17a1a39df565 include/asm-i386/mach-xen/asm/desc.h
--- a/include/asm-i386/mach-xen/asm/desc.h Mon Jan 21 11:43:31 2008 +0000
+++ b/include/asm-i386/mach-xen/asm/desc.h Tue Jan 22 10:09:52 2008 +0000
@@ -111,7 +111,9 @@ extern int write_ldt_entry(void *ldt, in
static inline void load_TLS(struct thread_struct *t, unsigned int cpu)
{
-#define C(i)
HYPERVISOR_update_descriptor(virt_to_machine(&get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN
+ i]), *(u64 *)&t->tls_array[i])
+#define C(i) if
(HYPERVISOR_update_descriptor(virt_to_machine(&get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN
+ i]), \
+ *(u64 *)&t->tls_array[i])) \
+ BUG();
C(0); C(1); C(2);
#undef C
}
diff -r 7070d34f251c -r 17a1a39df565 include/asm-i386/mach-xen/asm/hypercall.h
--- a/include/asm-i386/mach-xen/asm/hypercall.h Mon Jan 21 11:43:31 2008 +0000
+++ b/include/asm-i386/mach-xen/asm/hypercall.h Tue Jan 22 10:09:52 2008 +0000
@@ -123,14 +123,14 @@
(type)__res; \
})
-static inline int
+static inline int __must_check
HYPERVISOR_set_trap_table(
const trap_info_t *table)
{
return _hypercall1(int, set_trap_table, table);
}
-static inline int
+static inline int __must_check
HYPERVISOR_mmu_update(
mmu_update_t *req, unsigned int count, unsigned int *success_count,
domid_t domid)
@@ -138,7 +138,7 @@ HYPERVISOR_mmu_update(
return _hypercall4(int, mmu_update, req, count, success_count, domid);
}
-static inline int
+static inline int __must_check
HYPERVISOR_mmuext_op(
struct mmuext_op *op, unsigned int count, unsigned int *success_count,
domid_t domid)
@@ -146,21 +146,21 @@ HYPERVISOR_mmuext_op(
return _hypercall4(int, mmuext_op, op, count, success_count, domid);
}
-static inline int
+static inline int __must_check
HYPERVISOR_set_gdt(
unsigned long *frame_list, unsigned int entries)
{
return _hypercall2(int, set_gdt, frame_list, entries);
}
-static inline int
+static inline int __must_check
HYPERVISOR_stack_switch(
unsigned long ss, unsigned long esp)
{
return _hypercall2(int, stack_switch, ss, esp);
}
-static inline int
+static inline int __must_check
HYPERVISOR_set_callbacks(
unsigned long event_selector, unsigned long event_address,
unsigned long failsafe_selector, unsigned long failsafe_address)
@@ -177,21 +177,21 @@ HYPERVISOR_fpu_taskswitch(
return _hypercall1(int, fpu_taskswitch, set);
}
-static inline int
+static inline int __must_check
HYPERVISOR_sched_op_compat(
int cmd, unsigned long arg)
{
return _hypercall2(int, sched_op_compat, cmd, arg);
}
-static inline int
+static inline int __must_check
HYPERVISOR_sched_op(
int cmd, void *arg)
{
return _hypercall2(int, sched_op, cmd, arg);
}
-static inline long
+static inline long __must_check
HYPERVISOR_set_timer_op(
u64 timeout)
{
@@ -200,7 +200,7 @@ HYPERVISOR_set_timer_op(
return _hypercall2(long, set_timer_op, timeout_lo, timeout_hi);
}
-static inline int
+static inline int __must_check
HYPERVISOR_platform_op(
struct xen_platform_op *platform_op)
{
@@ -208,42 +208,42 @@ HYPERVISOR_platform_op(
return _hypercall1(int, platform_op, platform_op);
}
-static inline int
+static inline int __must_check
HYPERVISOR_set_debugreg(
unsigned int reg, unsigned long value)
{
return _hypercall2(int, set_debugreg, reg, value);
}
-static inline unsigned long
+static inline unsigned long __must_check
HYPERVISOR_get_debugreg(
unsigned int reg)
{
return _hypercall1(unsigned long, get_debugreg, reg);
}
-static inline int
+static inline int __must_check
HYPERVISOR_update_descriptor(
u64 ma, u64 desc)
{
return _hypercall4(int, update_descriptor, ma, ma>>32, desc, desc>>32);
}
-static inline int
+static inline int __must_check
HYPERVISOR_memory_op(
unsigned int cmd, void *arg)
{
return _hypercall2(int, memory_op, cmd, arg);
}
-static inline int
+static inline int __must_check
HYPERVISOR_multicall(
multicall_entry_t *call_list, unsigned int nr_calls)
{
return _hypercall2(int, multicall, call_list, nr_calls);
}
-static inline int
+static inline int __must_check
HYPERVISOR_update_va_mapping(
unsigned long va, pte_t new_val, unsigned long flags)
{
@@ -255,7 +255,7 @@ HYPERVISOR_update_va_mapping(
new_val.pte_low, pte_hi, flags);
}
-static inline int
+static inline int __must_check
HYPERVISOR_event_channel_op(
int cmd, void *arg)
{
@@ -274,28 +274,28 @@ HYPERVISOR_event_channel_op(
return rc;
}
-static inline int
+static inline int __must_check
HYPERVISOR_acm_op(
int cmd, void *arg)
{
return _hypercall2(int, acm_op, cmd, arg);
}
-static inline int
+static inline int __must_check
HYPERVISOR_xen_version(
int cmd, void *arg)
{
return _hypercall2(int, xen_version, cmd, arg);
}
-static inline int
+static inline int __must_check
HYPERVISOR_console_io(
int cmd, unsigned int count, char *str)
{
return _hypercall3(int, console_io, cmd, count, str);
}
-static inline int
+static inline int __must_check
HYPERVISOR_physdev_op(
int cmd, void *arg)
{
@@ -314,14 +314,14 @@ HYPERVISOR_physdev_op(
return rc;
}
-static inline int
+static inline int __must_check
HYPERVISOR_grant_table_op(
unsigned int cmd, void *uop, unsigned int count)
{
return _hypercall3(int, grant_table_op, cmd, uop, count);
}
-static inline int
+static inline int __must_check
HYPERVISOR_update_va_mapping_otherdomain(
unsigned long va, pte_t new_val, unsigned long flags, domid_t domid)
{
@@ -333,21 +333,21 @@ HYPERVISOR_update_va_mapping_otherdomain
new_val.pte_low, pte_hi, flags, domid);
}
-static inline int
+static inline int __must_check
HYPERVISOR_vm_assist(
unsigned int cmd, unsigned int type)
{
return _hypercall2(int, vm_assist, cmd, type);
}
-static inline int
+static inline int __must_check
HYPERVISOR_vcpu_op(
int cmd, unsigned int vcpuid, void *extra_args)
{
return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
}
-static inline int
+static inline int __must_check
HYPERVISOR_suspend(
unsigned long srec)
{
@@ -367,15 +367,17 @@ HYPERVISOR_suspend(
return rc;
}
+#if CONFIG_XEN_COMPAT <= 0x030002
static inline int
HYPERVISOR_nmi_op(
unsigned long op, void *arg)
{
return _hypercall2(int, nmi_op, op, arg);
}
+#endif
#ifndef CONFIG_XEN
-static inline unsigned long
+static inline unsigned long __must_check
HYPERVISOR_hvm_op(
int op, void *arg)
{
@@ -383,21 +385,21 @@ HYPERVISOR_hvm_op(
}
#endif
-static inline int
+static inline int __must_check
HYPERVISOR_callback_op(
int cmd, const void *arg)
{
return _hypercall2(int, callback_op, cmd, arg);
}
-static inline int
+static inline int __must_check
HYPERVISOR_xenoprof_op(
int op, void *arg)
{
return _hypercall2(int, xenoprof_op, op, arg);
}
-static inline int
+static inline int __must_check
HYPERVISOR_kexec_op(
unsigned long op, void *args)
{
diff -r 7070d34f251c -r 17a1a39df565 include/asm-i386/mach-xen/asm/hypervisor.h
--- a/include/asm-i386/mach-xen/asm/hypervisor.h Mon Jan 21 11:43:31
2008 +0000
+++ b/include/asm-i386/mach-xen/asm/hypervisor.h Tue Jan 22 10:09:52
2008 +0000
@@ -175,7 +175,7 @@ HYPERVISOR_block(
return rc;
}
-static inline int
+static inline void __noreturn
HYPERVISOR_shutdown(
unsigned int reason)
{
@@ -183,17 +183,16 @@ HYPERVISOR_shutdown(
.reason = reason
};
- int rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
-
-#if CONFIG_XEN_COMPAT <= 0x030002
- if (rc == -ENOSYS)
- rc = HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason);
-#endif
-
- return rc;
-}
-
-static inline int
+ VOID(HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown));
+#if CONFIG_XEN_COMPAT <= 0x030002
+ VOID(HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason));
+#endif
+ /* Don't recurse needlessly. */
+ BUG_ON(reason != SHUTDOWN_crash);
+ for(;;);
+}
+
+static inline int __must_check
HYPERVISOR_poll(
evtchn_port_t *ports, unsigned int nr_ports, u64 timeout)
{
diff -r 7070d34f251c -r 17a1a39df565 include/asm-i386/mach-xen/asm/processor.h
--- a/include/asm-i386/mach-xen/asm/processor.h Mon Jan 21 11:43:31 2008 +0000
+++ b/include/asm-i386/mach-xen/asm/processor.h Tue Jan 22 10:09:52 2008 +0000
@@ -513,8 +513,10 @@ static inline void __load_esp0(struct ts
#define load_esp0(tss, thread) \
__load_esp0(tss, thread)
#else
-#define load_esp0(tss, thread) \
- HYPERVISOR_stack_switch(__KERNEL_DS, (thread)->esp0)
+#define load_esp0(tss, thread) do { \
+ if (HYPERVISOR_stack_switch(__KERNEL_DS, (thread)->esp0)) \
+ BUG(); \
+} while (0)
#endif
#define start_thread(regs, new_eip, new_esp) do { \
@@ -534,7 +536,7 @@ static inline void __load_esp0(struct ts
#define get_debugreg(var, register) \
(var) = HYPERVISOR_get_debugreg((register))
#define set_debugreg(value, register) \
- HYPERVISOR_set_debugreg((register), (value))
+ WARN_ON(HYPERVISOR_set_debugreg((register), (value)))
/*
* Set IOPL bits in EFLAGS from given mask
@@ -545,7 +547,7 @@ static inline void set_iopl_mask(unsigne
/* Force the change at ring 0. */
set_iopl.iopl = (mask == 0) ? 1 : (mask >> 12) & 3;
- HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl);
+ WARN_ON(HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl));
}
/* Forward declaration, a strange C thing */
diff -r 7070d34f251c -r 17a1a39df565 include/asm-x86_64/mach-xen/asm/desc.h
--- a/include/asm-x86_64/mach-xen/asm/desc.h Mon Jan 21 11:43:31 2008 +0000
+++ b/include/asm-x86_64/mach-xen/asm/desc.h Tue Jan 22 10:09:52 2008 +0000
@@ -229,7 +229,9 @@ static inline void load_TLS(struct threa
gdt[2] = t->tls_array[2];
#endif
#define C(i) \
-
HYPERVISOR_update_descriptor(virt_to_machine(&cpu_gdt(cpu)[GDT_ENTRY_TLS_MIN +
i]), t->tls_array[i])
+ if
(HYPERVISOR_update_descriptor(virt_to_machine(&cpu_gdt(cpu)[GDT_ENTRY_TLS_MIN +
i]), \
+ t->tls_array[i])) \
+ BUG();
C(0); C(1); C(2);
#undef C
diff -r 7070d34f251c -r 17a1a39df565 include/asm-x86_64/mach-xen/asm/hypercall.h
--- a/include/asm-x86_64/mach-xen/asm/hypercall.h Mon Jan 21 11:43:31
2008 +0000
+++ b/include/asm-x86_64/mach-xen/asm/hypercall.h Tue Jan 22 10:09:52
2008 +0000
@@ -129,14 +129,14 @@
(type)__res; \
})
-static inline int
+static inline int __must_check
HYPERVISOR_set_trap_table(
const trap_info_t *table)
{
return _hypercall1(int, set_trap_table, table);
}
-static inline int
+static inline int __must_check
HYPERVISOR_mmu_update(
mmu_update_t *req, unsigned int count, unsigned int *success_count,
domid_t domid)
@@ -144,7 +144,7 @@ HYPERVISOR_mmu_update(
return _hypercall4(int, mmu_update, req, count, success_count, domid);
}
-static inline int
+static inline int __must_check
HYPERVISOR_mmuext_op(
struct mmuext_op *op, unsigned int count, unsigned int *success_count,
domid_t domid)
@@ -152,21 +152,21 @@ HYPERVISOR_mmuext_op(
return _hypercall4(int, mmuext_op, op, count, success_count, domid);
}
-static inline int
+static inline int __must_check
HYPERVISOR_set_gdt(
unsigned long *frame_list, unsigned int entries)
{
return _hypercall2(int, set_gdt, frame_list, entries);
}
-static inline int
+static inline int __must_check
HYPERVISOR_stack_switch(
unsigned long ss, unsigned long esp)
{
return _hypercall2(int, stack_switch, ss, esp);
}
-static inline int
+static inline int __must_check
HYPERVISOR_set_callbacks(
unsigned long event_address, unsigned long failsafe_address,
unsigned long syscall_address)
@@ -182,28 +182,28 @@ HYPERVISOR_fpu_taskswitch(
return _hypercall1(int, fpu_taskswitch, set);
}
-static inline int
+static inline int __must_check
HYPERVISOR_sched_op_compat(
int cmd, unsigned long arg)
{
return _hypercall2(int, sched_op_compat, cmd, arg);
}
-static inline int
+static inline int __must_check
HYPERVISOR_sched_op(
int cmd, void *arg)
{
return _hypercall2(int, sched_op, cmd, arg);
}
-static inline long
+static inline long __must_check
HYPERVISOR_set_timer_op(
u64 timeout)
{
return _hypercall1(long, set_timer_op, timeout);
}
-static inline int
+static inline int __must_check
HYPERVISOR_platform_op(
struct xen_platform_op *platform_op)
{
@@ -211,49 +211,49 @@ HYPERVISOR_platform_op(
return _hypercall1(int, platform_op, platform_op);
}
-static inline int
+static inline int __must_check
HYPERVISOR_set_debugreg(
unsigned int reg, unsigned long value)
{
return _hypercall2(int, set_debugreg, reg, value);
}
-static inline unsigned long
+static inline unsigned long __must_check
HYPERVISOR_get_debugreg(
unsigned int reg)
{
return _hypercall1(unsigned long, get_debugreg, reg);
}
-static inline int
+static inline int __must_check
HYPERVISOR_update_descriptor(
unsigned long ma, unsigned long word)
{
return _hypercall2(int, update_descriptor, ma, word);
}
-static inline int
+static inline int __must_check
HYPERVISOR_memory_op(
unsigned int cmd, void *arg)
{
return _hypercall2(int, memory_op, cmd, arg);
}
-static inline int
+static inline int __must_check
HYPERVISOR_multicall(
multicall_entry_t *call_list, unsigned int nr_calls)
{
return _hypercall2(int, multicall, call_list, nr_calls);
}
-static inline int
+static inline int __must_check
HYPERVISOR_update_va_mapping(
unsigned long va, pte_t new_val, unsigned long flags)
{
return _hypercall3(int, update_va_mapping, va, new_val.pte, flags);
}
-static inline int
+static inline int __must_check
HYPERVISOR_event_channel_op(
int cmd, void *arg)
{
@@ -272,28 +272,28 @@ HYPERVISOR_event_channel_op(
return rc;
}
-static inline int
+static inline int __must_check
HYPERVISOR_acm_op(
int cmd, void *arg)
{
return _hypercall2(int, acm_op, cmd, arg);
}
-static inline int
+static inline int __must_check
HYPERVISOR_xen_version(
int cmd, void *arg)
{
return _hypercall2(int, xen_version, cmd, arg);
}
-static inline int
+static inline int __must_check
HYPERVISOR_console_io(
int cmd, unsigned int count, char *str)
{
return _hypercall3(int, console_io, cmd, count, str);
}
-static inline int
+static inline int __must_check
HYPERVISOR_physdev_op(
int cmd, void *arg)
{
@@ -312,14 +312,14 @@ HYPERVISOR_physdev_op(
return rc;
}
-static inline int
+static inline int __must_check
HYPERVISOR_grant_table_op(
unsigned int cmd, void *uop, unsigned int count)
{
return _hypercall3(int, grant_table_op, cmd, uop, count);
}
-static inline int
+static inline int __must_check
HYPERVISOR_update_va_mapping_otherdomain(
unsigned long va, pte_t new_val, unsigned long flags, domid_t domid)
{
@@ -327,28 +327,28 @@ HYPERVISOR_update_va_mapping_otherdomain
new_val.pte, flags, domid);
}
-static inline int
+static inline int __must_check
HYPERVISOR_vm_assist(
unsigned int cmd, unsigned int type)
{
return _hypercall2(int, vm_assist, cmd, type);
}
-static inline int
+static inline int __must_check
HYPERVISOR_vcpu_op(
int cmd, unsigned int vcpuid, void *extra_args)
{
return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
}
-static inline int
+static inline int __must_check
HYPERVISOR_set_segment_base(
int reg, unsigned long value)
{
return _hypercall2(int, set_segment_base, reg, value);
}
-static inline int
+static inline int __must_check
HYPERVISOR_suspend(
unsigned long srec)
{
@@ -368,15 +368,17 @@ HYPERVISOR_suspend(
return rc;
}
+#if CONFIG_XEN_COMPAT <= 0x030002
static inline int
HYPERVISOR_nmi_op(
unsigned long op, void *arg)
{
return _hypercall2(int, nmi_op, op, arg);
}
+#endif
#ifndef CONFIG_XEN
-static inline unsigned long
+static inline unsigned long __must_check
HYPERVISOR_hvm_op(
int op, void *arg)
{
@@ -384,21 +386,21 @@ HYPERVISOR_hvm_op(
}
#endif
-static inline int
+static inline int __must_check
HYPERVISOR_callback_op(
int cmd, const void *arg)
{
return _hypercall2(int, callback_op, cmd, arg);
}
-static inline int
+static inline int __must_check
HYPERVISOR_xenoprof_op(
int op, void *arg)
{
return _hypercall2(int, xenoprof_op, op, arg);
}
-static inline int
+static inline int __must_check
HYPERVISOR_kexec_op(
unsigned long op, void *args)
{
diff -r 7070d34f251c -r 17a1a39df565 include/asm-x86_64/mach-xen/asm/processor.h
--- a/include/asm-x86_64/mach-xen/asm/processor.h Mon Jan 21 11:43:31
2008 +0000
+++ b/include/asm-x86_64/mach-xen/asm/processor.h Tue Jan 22 10:09:52
2008 +0000
@@ -317,8 +317,10 @@ struct thread_struct {
#define get_debugreg(var, register) \
var = HYPERVISOR_get_debugreg(register)
-#define set_debugreg(value, register) \
- HYPERVISOR_set_debugreg(register, value)
+#define set_debugreg(value, register) do { \
+ if (HYPERVISOR_set_debugreg(register, value)) \
+ BUG(); \
+} while (0)
struct task_struct;
struct mm_struct;
diff -r 7070d34f251c -r 17a1a39df565 include/xen/evtchn.h
--- a/include/xen/evtchn.h Mon Jan 21 11:43:31 2008 +0000
+++ b/include/xen/evtchn.h Tue Jan 22 10:09:52 2008 +0000
@@ -126,7 +126,7 @@ static inline void notify_remote_via_evt
static inline void notify_remote_via_evtchn(int port)
{
struct evtchn_send send = { .port = port };
- (void)HYPERVISOR_event_channel_op(EVTCHNOP_send, &send);
+ VOID(HYPERVISOR_event_channel_op(EVTCHNOP_send, &send));
}
/*
diff -r 7070d34f251c -r 17a1a39df565 include/xen/hypercall.h
--- a/include/xen/hypercall.h Mon Jan 21 11:43:31 2008 +0000
+++ b/include/xen/hypercall.h Tue Jan 22 10:09:52 2008 +0000
@@ -3,7 +3,7 @@
#include <asm/hypercall.h>
-static inline int
+static inline int __must_check
HYPERVISOR_multicall_check(
multicall_entry_t *call_list, unsigned int nr_calls,
const unsigned long *rc_list)
@@ -22,4 +22,9 @@ HYPERVISOR_multicall_check(
return 0;
}
+/* A construct to ignore the return value of hypercall wrappers in a few
+ * exceptional cases (simply casting the function result to void doesn't
+ * avoid the compiler warning): */
+#define VOID(expr) ((void)((expr)?:0))
+
#endif /* __XEN_HYPERCALL_H__ */
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|