mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
Merge.
This commit is contained in:
commit
dfcfb2ba53
20 files changed
+442
-1093
No files matched your search
@@ -102,9 +102,9 @@ for i in `find . -type l`; do rm -f $i; done
|
||||
relative_lndir ${RS}
|
||||
rm -f mkbuildtree
|
||||
|
||||
set ${RS}/../linux-2.6-xen-sparse
|
||||
[ "$1" == "${RS}/../linux-2.6-xen-sparse" ] && { echo "no Linux 2.6 sparse tree at ${RS}/../linux-2.6-xen-sparse"; exit 1; }
|
||||
LINUX_26="$1"
|
||||
LINUX_26=${RS}/../linux-2.6-xen-sparse
|
||||
[ -d $LINUX_26 ] || { echo "no Linux 2.6 sparse tree at ${RS}/../linux-2.6-xen-sparse"; exit 1; }
|
||||
|
||||
|
||||
# Create links to the shared definitions of the Xen interfaces.
|
||||
rm -rf ${AD}/include/asm-xen/xen-public
|
||||
|
||||
@@ -807,8 +807,8 @@ choice
|
||||
direct access method and falls back to the BIOS if that doesn't
|
||||
work. If unsure, go with the default, which is "Any".
|
||||
|
||||
config PCI_GOBIOS
|
||||
bool "BIOS"
|
||||
#config PCI_GOBIOS
|
||||
# bool "BIOS"
|
||||
|
||||
config PCI_GOMMCONFIG
|
||||
bool "MMConfig"
|
||||
@@ -821,10 +821,10 @@ config PCI_GOANY
|
||||
|
||||
endchoice
|
||||
|
||||
config PCI_BIOS
|
||||
bool
|
||||
depends on !X86_VISWS && PCI && (PCI_GOBIOS || PCI_GOANY)
|
||||
default y
|
||||
#config PCI_BIOS
|
||||
# bool
|
||||
# depends on !X86_VISWS && PCI && (PCI_GOBIOS || PCI_GOANY)
|
||||
# default y
|
||||
|
||||
config PCI_DIRECT
|
||||
bool
|
||||
|
||||
@@ -610,7 +610,7 @@ static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
|
||||
acpi_fadt.force_apic_physical_destination_mode = fadt->force_apic_physical_destination_mode;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86_PM_TIMER
|
||||
#if defined(CONFIG_X86_PM_TIMER) && !defined(CONFIG_XEN)
|
||||
/* detect the location of the ACPI PM Timer */
|
||||
if (fadt->revision >= FADT2_REVISION_ID) {
|
||||
/* FADT rev. 2 */
|
||||
|
||||
@@ -135,6 +135,10 @@ static inline void play_dead(void)
|
||||
* low exit latency (ie sit in a loop waiting for
|
||||
* somebody to say that they'd like to reschedule)
|
||||
*/
|
||||
#ifdef CONFIG_SMP
|
||||
extern void smp_suspend(void);
|
||||
extern void smp_resume(void);
|
||||
#endif
|
||||
void cpu_idle (void)
|
||||
{
|
||||
int cpu = _smp_processor_id();
|
||||
@@ -149,6 +153,9 @@ void cpu_idle (void)
|
||||
|
||||
if (cpu_is_offline(cpu)) {
|
||||
local_irq_disable();
|
||||
#ifdef CONFIG_SMP
|
||||
smp_suspend();
|
||||
#endif
|
||||
#if defined(CONFIG_XEN) && defined(CONFIG_HOTPLUG_CPU)
|
||||
/* Ack it. From this point on until
|
||||
we get woken up, we're not allowed
|
||||
@@ -159,6 +166,9 @@ void cpu_idle (void)
|
||||
HYPERVISOR_vcpu_down(cpu);
|
||||
#endif
|
||||
play_dead();
|
||||
#ifdef CONFIG_SMP
|
||||
smp_resume();
|
||||
#endif
|
||||
local_irq_enable();
|
||||
}
|
||||
|
||||
@@ -789,10 +799,3 @@ unsigned long arch_align_stack(unsigned long sp)
|
||||
sp -= get_random_int() % 8192;
|
||||
return sp & ~0xf;
|
||||
}
|
||||
|
||||
|
||||
#ifndef CONFIG_X86_SMP
|
||||
void _restore_vcpu(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
@@ -1601,32 +1601,71 @@ extern void local_teardown_timer_irq(void);
|
||||
|
||||
void smp_suspend(void)
|
||||
{
|
||||
/* XXX todo: take down time and ipi's on all cpus */
|
||||
local_teardown_timer_irq();
|
||||
smp_intr_exit();
|
||||
}
|
||||
|
||||
void smp_resume(void)
|
||||
{
|
||||
/* XXX todo: restore time and ipi's on all cpus */
|
||||
smp_intr_init();
|
||||
local_setup_timer_irq();
|
||||
}
|
||||
|
||||
DECLARE_PER_CPU(int, timer_irq);
|
||||
static atomic_t vcpus_rebooting;
|
||||
|
||||
void _restore_vcpu(void)
|
||||
static void restore_vcpu_ready(void)
|
||||
{
|
||||
int cpu = smp_processor_id();
|
||||
extern atomic_t vcpus_rebooting;
|
||||
|
||||
/* We are the first thing the vcpu runs when it comes back,
|
||||
and we are supposed to restore the IPIs and timer
|
||||
interrupts etc. When we return, the vcpu's idle loop will
|
||||
start up again. */
|
||||
_bind_virq_to_irq(VIRQ_TIMER, cpu, per_cpu(timer_irq, cpu));
|
||||
_bind_virq_to_irq(VIRQ_DEBUG, cpu, per_cpu(ldebug_irq, cpu));
|
||||
_bind_ipi_to_irq(RESCHEDULE_VECTOR, cpu, per_cpu(resched_irq, cpu) );
|
||||
_bind_ipi_to_irq(CALL_FUNCTION_VECTOR, cpu, per_cpu(callfunc_irq, cpu) );
|
||||
atomic_dec(&vcpus_rebooting);
|
||||
}
|
||||
|
||||
void save_vcpu_context(int vcpu, vcpu_guest_context_t *ctxt)
|
||||
{
|
||||
int r;
|
||||
int gdt_pages;
|
||||
r = HYPERVISOR_vcpu_pickle(vcpu, ctxt);
|
||||
if (r != 0)
|
||||
panic("pickling vcpu %d -> %d!\n", vcpu, r);
|
||||
|
||||
/* Translate from machine to physical addresses where necessary,
|
||||
so that they can be translated to our new machine address space
|
||||
after resume. libxc is responsible for doing this to vcpu0,
|
||||
but we do it to the others. */
|
||||
gdt_pages = (ctxt->gdt_ents + 511) / 512;
|
||||
ctxt->ctrlreg[3] = machine_to_phys(ctxt->ctrlreg[3]);
|
||||
for (r = 0; r < gdt_pages; r++)
|
||||
ctxt->gdt_frames[r] = mfn_to_pfn(ctxt->gdt_frames[r]);
|
||||
}
|
||||
|
||||
int restore_vcpu_context(int vcpu, vcpu_guest_context_t *ctxt)
|
||||
{
|
||||
int r;
|
||||
int gdt_pages = (ctxt->gdt_ents + 511) / 512;
|
||||
|
||||
/* This is kind of a hack, and implicitly relies on the fact that
|
||||
the vcpu stops in a place where all of the call clobbered
|
||||
registers are already dead. */
|
||||
ctxt->user_regs.esp -= 4;
|
||||
((unsigned long *)ctxt->user_regs.esp)[0] = ctxt->user_regs.eip;
|
||||
ctxt->user_regs.eip = (unsigned long)restore_vcpu_ready;
|
||||
|
||||
/* De-canonicalise. libxc handles this for vcpu 0, but we need
|
||||
to do it for the other vcpus. */
|
||||
ctxt->ctrlreg[3] = phys_to_machine(ctxt->ctrlreg[3]);
|
||||
for (r = 0; r < gdt_pages; r++)
|
||||
ctxt->gdt_frames[r] = pfn_to_mfn(ctxt->gdt_frames[r]);
|
||||
|
||||
atomic_set(&vcpus_rebooting, 1);
|
||||
r = HYPERVISOR_boot_vcpu(vcpu, ctxt);
|
||||
if (r != 0) {
|
||||
printk(KERN_EMERG "Failed to reboot vcpu %d (%d)\n", vcpu, r);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Make sure we wait for the new vcpu to come up before trying to do
|
||||
anything with it or starting the next one. */
|
||||
while (atomic_read(&vcpus_rebooting))
|
||||
barrier();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -219,6 +219,8 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef CONFIG_XEN
|
||||
|
||||
static inline int page_kills_ppro(unsigned long pagenr)
|
||||
{
|
||||
if (pagenr >= 0x70000 && pagenr <= 0x7003F)
|
||||
@@ -266,6 +268,13 @@ static inline int page_is_ram(unsigned long pagenr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* CONFIG_XEN */
|
||||
|
||||
#define page_kills_ppro(p) 0
|
||||
#define page_is_ram(p) 1
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HIGHMEM
|
||||
pte_t *kmap_pte;
|
||||
pgprot_t kmap_prot;
|
||||
|
||||
@@ -4,7 +4,7 @@ CFLAGS += -Iarch/$(XENARCH)/pci
|
||||
|
||||
c-obj-y := i386.o
|
||||
|
||||
c-obj-$(CONFIG_PCI_BIOS) += pcbios.o
|
||||
#c-obj-$(CONFIG_PCI_BIOS) += pcbios.o
|
||||
c-obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o
|
||||
c-obj-$(CONFIG_PCI_DIRECT) += direct.o
|
||||
|
||||
|
||||
@@ -245,74 +245,6 @@ void unbind_virq_from_irq(int virq)
|
||||
spin_unlock(&irq_mapping_update_lock);
|
||||
}
|
||||
|
||||
/* This is only used when a vcpu from an xm save. The ipi is expected
|
||||
to have been bound before we suspended, and so all of the xenolinux
|
||||
state is set up; we only need to restore the Xen side of things.
|
||||
The irq number has to be the same, but the evtchn number can
|
||||
change. */
|
||||
void _bind_ipi_to_irq(int ipi, int vcpu, int irq)
|
||||
{
|
||||
evtchn_op_t op;
|
||||
int evtchn;
|
||||
|
||||
spin_lock(&irq_mapping_update_lock);
|
||||
|
||||
op.cmd = EVTCHNOP_bind_ipi;
|
||||
if ( HYPERVISOR_event_channel_op(&op) != 0 )
|
||||
panic("Failed to bind virtual IPI %d on cpu %d\n", ipi, vcpu);
|
||||
evtchn = op.u.bind_ipi.port;
|
||||
|
||||
printk("<0>IPI %d, old evtchn %d, evtchn %d.\n",
|
||||
ipi, per_cpu(ipi_to_evtchn, vcpu)[ipi],
|
||||
evtchn);
|
||||
|
||||
evtchn_to_irq[irq_to_evtchn[irq]] = -1;
|
||||
irq_to_evtchn[irq] = -1;
|
||||
|
||||
evtchn_to_irq[evtchn] = irq;
|
||||
irq_to_evtchn[irq] = evtchn;
|
||||
|
||||
printk("<0>evtchn_to_irq[%d] = %d.\n", evtchn,
|
||||
evtchn_to_irq[evtchn]);
|
||||
per_cpu(ipi_to_evtchn, vcpu)[ipi] = evtchn;
|
||||
|
||||
bind_evtchn_to_cpu(evtchn, vcpu);
|
||||
|
||||
spin_unlock(&irq_mapping_update_lock);
|
||||
|
||||
clear_bit(evtchn, (unsigned long *)HYPERVISOR_shared_info->evtchn_mask);
|
||||
clear_bit(evtchn, (unsigned long *)HYPERVISOR_shared_info->evtchn_pending);
|
||||
}
|
||||
|
||||
void _bind_virq_to_irq(int virq, int cpu, int irq)
|
||||
{
|
||||
evtchn_op_t op;
|
||||
int evtchn;
|
||||
|
||||
spin_lock(&irq_mapping_update_lock);
|
||||
|
||||
op.cmd = EVTCHNOP_bind_virq;
|
||||
op.u.bind_virq.virq = virq;
|
||||
if ( HYPERVISOR_event_channel_op(&op) != 0 )
|
||||
panic("Failed to bind virtual IRQ %d\n", virq);
|
||||
evtchn = op.u.bind_virq.port;
|
||||
|
||||
evtchn_to_irq[irq_to_evtchn[irq]] = -1;
|
||||
irq_to_evtchn[irq] = -1;
|
||||
|
||||
evtchn_to_irq[evtchn] = irq;
|
||||
irq_to_evtchn[irq] = evtchn;
|
||||
|
||||
per_cpu(virq_to_irq, cpu)[virq] = irq;
|
||||
|
||||
bind_evtchn_to_cpu(evtchn, cpu);
|
||||
|
||||
spin_unlock(&irq_mapping_update_lock);
|
||||
|
||||
clear_bit(evtchn, (unsigned long *)HYPERVISOR_shared_info->evtchn_mask);
|
||||
clear_bit(evtchn, (unsigned long *)HYPERVISOR_shared_info->evtchn_pending);
|
||||
}
|
||||
|
||||
int bind_ipi_to_irq(int ipi)
|
||||
{
|
||||
evtchn_op_t op;
|
||||
|
||||
@@ -65,66 +65,13 @@ static int shutting_down = SHUTDOWN_INVALID;
|
||||
#define cpu_up(x) (-EOPNOTSUPP)
|
||||
#endif
|
||||
|
||||
static void save_vcpu_context(int vcpu, vcpu_guest_context_t *ctxt)
|
||||
{
|
||||
int r;
|
||||
int gdt_pages;
|
||||
r = HYPERVISOR_vcpu_pickle(vcpu, ctxt);
|
||||
if (r != 0)
|
||||
panic("pickling vcpu %d -> %d!\n", vcpu, r);
|
||||
|
||||
/* Translate from machine to physical addresses where necessary,
|
||||
so that they can be translated to our new machine address space
|
||||
after resume. libxc is responsible for doing this to vcpu0,
|
||||
but we do it to the others. */
|
||||
gdt_pages = (ctxt->gdt_ents + 511) / 512;
|
||||
ctxt->ctrlreg[3] = machine_to_phys(ctxt->ctrlreg[3]);
|
||||
for (r = 0; r < gdt_pages; r++)
|
||||
ctxt->gdt_frames[r] = mfn_to_pfn(ctxt->gdt_frames[r]);
|
||||
}
|
||||
|
||||
void _restore_vcpu(int cpu);
|
||||
|
||||
atomic_t vcpus_rebooting;
|
||||
|
||||
static int restore_vcpu_context(int vcpu, vcpu_guest_context_t *ctxt)
|
||||
{
|
||||
int r;
|
||||
int gdt_pages = (ctxt->gdt_ents + 511) / 512;
|
||||
|
||||
/* This is kind of a hack, and implicitly relies on the fact that
|
||||
the vcpu stops in a place where all of the call clobbered
|
||||
registers are already dead. */
|
||||
ctxt->user_regs.esp -= 4;
|
||||
((unsigned long *)ctxt->user_regs.esp)[0] = ctxt->user_regs.eip;
|
||||
ctxt->user_regs.eip = (unsigned long)_restore_vcpu;
|
||||
|
||||
/* De-canonicalise. libxc handles this for vcpu 0, but we need
|
||||
to do it for the other vcpus. */
|
||||
ctxt->ctrlreg[3] = phys_to_machine(ctxt->ctrlreg[3]);
|
||||
for (r = 0; r < gdt_pages; r++)
|
||||
ctxt->gdt_frames[r] = pfn_to_mfn(ctxt->gdt_frames[r]);
|
||||
|
||||
atomic_set(&vcpus_rebooting, 1);
|
||||
r = HYPERVISOR_boot_vcpu(vcpu, ctxt);
|
||||
if (r != 0) {
|
||||
printk(KERN_EMERG "Failed to reboot vcpu %d (%d)\n", vcpu, r);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Make sure we wait for the new vcpu to come up before trying to do
|
||||
anything with it or starting the next one. */
|
||||
while (atomic_read(&vcpus_rebooting))
|
||||
barrier();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#ifdef CONFIG_SMP
|
||||
#endif
|
||||
|
||||
static int __do_suspend(void *ignore)
|
||||
{
|
||||
int i, j;
|
||||
suspend_record_t *suspend_record;
|
||||
static vcpu_guest_context_t suspended_cpu_records[NR_CPUS];
|
||||
|
||||
/* Hmmm... a cleaner interface to suspend/resume blkdevs would be nice. */
|
||||
/* XXX SMH: yes it would :-( */
|
||||
@@ -138,16 +85,22 @@ static int __do_suspend(void *ignore)
|
||||
extern int gnttab_suspend(void);
|
||||
extern int gnttab_resume(void);
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
extern void smp_suspend(void);
|
||||
extern void smp_resume(void);
|
||||
#endif
|
||||
extern void time_suspend(void);
|
||||
extern void time_resume(void);
|
||||
extern unsigned long max_pfn;
|
||||
extern unsigned int *pfn_to_mfn_frame_list;
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
extern void smp_suspend(void);
|
||||
extern void smp_resume(void);
|
||||
|
||||
static vcpu_guest_context_t suspended_cpu_records[NR_CPUS];
|
||||
cpumask_t prev_online_cpus, prev_present_cpus;
|
||||
|
||||
void save_vcpu_context(int vcpu, vcpu_guest_context_t *ctxt);
|
||||
int restore_vcpu_context(int vcpu, vcpu_guest_context_t *ctxt);
|
||||
#endif
|
||||
|
||||
int err = 0;
|
||||
|
||||
BUG_ON(smp_processor_id() != 0);
|
||||
@@ -164,6 +117,8 @@ static int __do_suspend(void *ignore)
|
||||
if ( suspend_record == NULL )
|
||||
goto out;
|
||||
|
||||
preempt_disable();
|
||||
#ifdef CONFIG_SMP
|
||||
/* Take all of the other cpus offline. We need to be careful not
|
||||
to get preempted between the final test for num_online_cpus()
|
||||
== 1 and disabling interrupts, since otherwise userspace could
|
||||
@@ -175,7 +130,6 @@ static int __do_suspend(void *ignore)
|
||||
since by the time num_online_cpus() == 1, there aren't any
|
||||
other cpus) */
|
||||
cpus_clear(prev_online_cpus);
|
||||
preempt_disable();
|
||||
while (num_online_cpus() > 1) {
|
||||
preempt_enable();
|
||||
for_each_online_cpu(i) {
|
||||
@@ -190,6 +144,7 @@ static int __do_suspend(void *ignore)
|
||||
}
|
||||
preempt_disable();
|
||||
}
|
||||
#endif
|
||||
|
||||
suspend_record->nr_pfns = max_pfn; /* final number of pfns */
|
||||
|
||||
@@ -197,6 +152,7 @@ static int __do_suspend(void *ignore)
|
||||
|
||||
preempt_enable();
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
cpus_clear(prev_present_cpus);
|
||||
for_each_present_cpu(i) {
|
||||
if (i == 0)
|
||||
@@ -204,6 +160,7 @@ static int __do_suspend(void *ignore)
|
||||
save_vcpu_context(i, &suspended_cpu_records[i]);
|
||||
cpu_set(i, prev_present_cpus);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __i386__
|
||||
mm_pin_all();
|
||||
@@ -269,12 +226,14 @@ static int __do_suspend(void *ignore)
|
||||
|
||||
usbif_resume();
|
||||
|
||||
for_each_cpu_mask(i, prev_present_cpus) {
|
||||
#ifdef CONFIG_SMP
|
||||
for_each_cpu_mask(i, prev_present_cpus)
|
||||
restore_vcpu_context(i, &suspended_cpu_records[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
__sti();
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
out_reenable_cpus:
|
||||
for_each_cpu_mask(i, prev_online_cpus) {
|
||||
j = cpu_up(i);
|
||||
@@ -284,6 +243,7 @@ static int __do_suspend(void *ignore)
|
||||
err = j;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
out:
|
||||
if ( suspend_record != NULL )
|
||||
|
||||
@@ -40,7 +40,7 @@ obj-$(CONFIG_DUMMY_IOMMU) += pci-nommu.o
|
||||
i386-obj-$(CONFIG_DUMMY_IOMMU) += pci-dma.o
|
||||
i386-obj-$(CONFIG_SWIOTLB) += swiotlb.o
|
||||
obj-$(CONFIG_KPROBES) += kprobes.o
|
||||
obj-$(CONFIG_X86_PM_TIMER) += pmtimer.o
|
||||
#obj-$(CONFIG_X86_PM_TIMER) += pmtimer.o
|
||||
|
||||
c-obj-$(CONFIG_MODULES) += module.o
|
||||
|
||||
|
||||
@@ -1277,21 +1277,23 @@ extern void local_teardown_timer_irq(void);
|
||||
|
||||
void smp_suspend(void)
|
||||
{
|
||||
/* XXX todo: take down time and ipi's on all cpus */
|
||||
local_teardown_timer_irq();
|
||||
smp_intr_exit();
|
||||
}
|
||||
|
||||
void smp_resume(void)
|
||||
{
|
||||
/* XXX todo: restore time and ipi's on all cpus */
|
||||
smp_intr_init();
|
||||
local_setup_timer_irq();
|
||||
}
|
||||
|
||||
void _restore_vcpu(void)
|
||||
void save_vcpu_context(int vcpu, vcpu_guest_context_t *ctxt)
|
||||
{
|
||||
/* XXX need to write this */
|
||||
}
|
||||
|
||||
int restore_vcpu_context(int vcpu, vcpu_guest_context_t *ctxt)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -767,9 +767,6 @@ void __init clear_kernel_mapping(unsigned long address, unsigned long size)
|
||||
|
||||
static inline int page_is_ram (unsigned long pagenr)
|
||||
{
|
||||
if (pagenr < start_pfn || pagenr >= end_pfn)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -295,10 +295,10 @@ static struct xenbus_watch target_watch =
|
||||
/* React to a change in the target key */
|
||||
static void watch_target(struct xenbus_watch *watch, const char *node)
|
||||
{
|
||||
unsigned long new_target;
|
||||
unsigned long long new_target;
|
||||
int err;
|
||||
|
||||
err = xenbus_scanf("memory", "target", "%lu", &new_target);
|
||||
err = xenbus_scanf("memory", "target", "%llu", &new_target);
|
||||
if (err != 1) {
|
||||
printk(KERN_ERR "Unable to read memory/target\n");
|
||||
return;
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -96,6 +96,14 @@ struct xlbd_major_info
|
||||
struct xlbd_type_info *type;
|
||||
};
|
||||
|
||||
struct blk_shadow {
|
||||
blkif_request_t req;
|
||||
unsigned long request;
|
||||
unsigned long frame[BLKIF_MAX_SEGMENTS_PER_REQUEST];
|
||||
};
|
||||
|
||||
#define BLK_RING_SIZE __RING_SIZE((blkif_sring_t *)0, PAGE_SIZE)
|
||||
|
||||
/*
|
||||
* We have one of these per vbd, whether ide, scsi or 'other'. They
|
||||
* hang in private_data off the gendisk structure. We may end up
|
||||
@@ -116,11 +124,11 @@ struct blkfront_info
|
||||
blkif_front_ring_t ring;
|
||||
unsigned int evtchn;
|
||||
struct xlbd_major_info *mi;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
|
||||
request_queue_t *rq;
|
||||
#endif
|
||||
struct work_struct work;
|
||||
struct gnttab_free_callback callback;
|
||||
struct blk_shadow shadow[BLK_RING_SIZE];
|
||||
unsigned long shadow_free;
|
||||
};
|
||||
|
||||
extern spinlock_t blkif_io_lock;
|
||||
|
||||
@@ -1272,25 +1272,24 @@ static int netfront_remove(struct xenbus_device *dev)
|
||||
|
||||
static int netfront_suspend(struct xenbus_device *dev)
|
||||
{
|
||||
struct net_private *np = dev->data;
|
||||
/* Avoid having tx/rx stuff happen until we're ready. */
|
||||
unbind_evtchn_from_irqhandler(np->evtchn, np->netdev);
|
||||
return 0;
|
||||
struct netfront_info *info = dev->data;
|
||||
|
||||
unregister_xenbus_watch(&info->watch);
|
||||
kfree(info->backend);
|
||||
info->backend = NULL;
|
||||
|
||||
netif_free(info);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int netfront_resume(struct xenbus_device *dev)
|
||||
{
|
||||
struct net_private *np = dev->data;
|
||||
/*
|
||||
* Connect regardless of whether IFF_UP flag set.
|
||||
* Stop bad things from happening until we're back up.
|
||||
*/
|
||||
np->backend_state = BEST_DISCONNECTED;
|
||||
memset(np->tx, 0, PAGE_SIZE);
|
||||
memset(np->rx, 0, PAGE_SIZE);
|
||||
|
||||
// send_interface_connect(np);
|
||||
return 0;
|
||||
struct net_private *np = dev->data;
|
||||
int err;
|
||||
|
||||
err = talk_to_backend(dev, np);
|
||||
return err;
|
||||
}
|
||||
|
||||
static struct xenbus_driver netfront = {
|
||||
|
||||
@@ -763,8 +763,6 @@ int xc_linux_save(int xc_handle, int io_fd, u32 dom)
|
||||
batch++;
|
||||
}
|
||||
|
||||
// DPRINTF("batch %d:%d (n=%d)\n", iter, batch, n);
|
||||
|
||||
if ( batch == 0 )
|
||||
goto skip; /* vanishingly unlikely... */
|
||||
|
||||
@@ -915,7 +913,7 @@ int xc_linux_save(int xc_handle, int io_fd, u32 dom)
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( last_iter ) break;
|
||||
if ( last_iter ) break;
|
||||
|
||||
if ( live )
|
||||
{
|
||||
|
||||
@@ -51,7 +51,7 @@ def save(xd, fd, dominfo):
|
||||
p = select.poll()
|
||||
p.register(child.fromchild.fileno())
|
||||
p.register(child.childerr.fileno())
|
||||
while True:
|
||||
while True:
|
||||
r = p.poll()
|
||||
for (fd, event) in r:
|
||||
if not event & select.POLLIN:
|
||||
@@ -69,8 +69,9 @@ def save(xd, fd, dominfo):
|
||||
try:
|
||||
dominfo.db.releaseDomain(dominfo.id)
|
||||
except Exception, ex:
|
||||
log.warning("error in domain release on xenstore: %s",
|
||||
ex)
|
||||
log.warning(
|
||||
"error in domain release on xenstore: %s",
|
||||
ex)
|
||||
pass
|
||||
dominfo.state_wait("suspended")
|
||||
log.info("suspend %d done" % dominfo.id)
|
||||
|
||||
@@ -42,7 +42,8 @@ class Daemon:
|
||||
self.traceon = 0
|
||||
self.tracefile = None
|
||||
self.traceindent = 0
|
||||
|
||||
self.child = 0
|
||||
|
||||
def daemon_pids(self):
|
||||
pids = []
|
||||
pidex = '(?P<pid>\d+)'
|
||||
@@ -140,15 +141,12 @@ class Daemon:
|
||||
else:
|
||||
return 0
|
||||
|
||||
def install_child_reaper(self):
|
||||
#signal.signal(signal.SIGCHLD, self.onSIGCHLD)
|
||||
# Ensure that zombie children are automatically reaped.
|
||||
xu.autoreap()
|
||||
|
||||
def onSIGCHLD(self, signum, frame):
|
||||
code = 1
|
||||
while code > 0:
|
||||
code = os.waitpid(-1, os.WNOHANG)
|
||||
if self.child > 0:
|
||||
try:
|
||||
pid, sts = os.waitpid(self.child, os.WNOHANG)
|
||||
except os.error, ex:
|
||||
pass
|
||||
|
||||
def fork_pid(self, pidfile):
|
||||
"""Fork and write the pid of the child to 'pidfile'.
|
||||
@@ -156,13 +154,16 @@ class Daemon:
|
||||
@param pidfile: pid file
|
||||
@return: pid of child in parent, 0 in child
|
||||
"""
|
||||
pid = os.fork()
|
||||
if pid:
|
||||
|
||||
self.child = os.fork()
|
||||
|
||||
if self.child:
|
||||
# Parent
|
||||
pidfile = open(pidfile, 'w')
|
||||
pidfile.write(str(pid))
|
||||
pidfile.write(str(self.child))
|
||||
pidfile.close()
|
||||
return pid
|
||||
|
||||
return self.child
|
||||
|
||||
def daemonize(self):
|
||||
if not XEND_DAEMONIZE: return
|
||||
@@ -203,8 +204,7 @@ class Daemon:
|
||||
# Trying to run an already-running service is a success.
|
||||
return 0
|
||||
|
||||
self.install_child_reaper()
|
||||
|
||||
signal.signal(signal.SIGCHLD, self.onSIGCHLD)
|
||||
if self.fork_pid(XEND_PID_FILE):
|
||||
#Parent. Sleep to give child time to start.
|
||||
time.sleep(1)
|
||||
@@ -309,7 +309,7 @@ class Daemon:
|
||||
print >>sys.stderr, 'Exception starting xend:', ex
|
||||
if XEND_DEBUG:
|
||||
traceback.print_exc()
|
||||
log.exception("Exception starting xend")
|
||||
log.exception("Exception starting xend (%s)" % ex)
|
||||
self.exit(1)
|
||||
|
||||
def createFactories(self):
|
||||
|
||||
@@ -715,9 +715,9 @@ def main(argv=sys.argv):
|
||||
err("Most commands need root access. Please try again as root")
|
||||
sys.exit(1)
|
||||
except XendError, ex:
|
||||
if args[0] == "bogus":
|
||||
args.remove("bogus")
|
||||
if len(args) > 0:
|
||||
if args[0] == "bogus":
|
||||
args.remove("bogus")
|
||||
handle_xend_error(argv[1], args[0], ex)
|
||||
else:
|
||||
print "Unexpected error:", sys.exc_info()[0]
|
||||
|
||||