Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 88764e0a authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'stable/for-linus-3.15-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull Xen fixes from David Vrabel:
 "Xen regression and bug fixes for 3.15-rc1:

   - fix completely broken 32-bit PV guests caused by x86 refactoring
     32-bit thread_info.
   - only enable ticketlock slow path on Xen (not bare metal)
   - fix two bugs with PV guests not shutting down when requested
   - fix a minor memory leak in xen-pciback error path"

* tag 'stable/for-linus-3.15-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
  xen/manage: Poweroff forcefully if user-space is not yet up.
  xen/xenbus: Avoid synchronous wait on XenBus stalling shutdown/restart.
  xen/spinlock: Don't enable them unconditionally.
  xen-pciback: silence an unwanted debug printk
  xen: fix memory leak in __xen_pcibk_add_pci_dev()
  x86/xen: Fix 32-bit PV guests's usage of kernel_stack
parents 23c1a60e eb47f712
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -441,10 +441,11 @@ static int xen_cpu_up(unsigned int cpu, struct task_struct *idle)
	irq_ctx_init(cpu);
	irq_ctx_init(cpu);
#else
#else
	clear_tsk_thread_flag(idle, TIF_FORK);
	clear_tsk_thread_flag(idle, TIF_FORK);
#endif
	per_cpu(kernel_stack, cpu) =
	per_cpu(kernel_stack, cpu) =
		(unsigned long)task_stack_page(idle) -
		(unsigned long)task_stack_page(idle) -
		KERNEL_STACK_OFFSET + THREAD_SIZE;
		KERNEL_STACK_OFFSET + THREAD_SIZE;
#endif

	xen_setup_runstate_info(cpu);
	xen_setup_runstate_info(cpu);
	xen_setup_timer(cpu);
	xen_setup_timer(cpu);
	xen_init_lock_cpu(cpu);
	xen_init_lock_cpu(cpu);
+4 −1
Original line number Original line Diff line number Diff line
@@ -274,7 +274,7 @@ void __init xen_init_spinlocks(void)
		printk(KERN_DEBUG "xen: PV spinlocks disabled\n");
		printk(KERN_DEBUG "xen: PV spinlocks disabled\n");
		return;
		return;
	}
	}

	printk(KERN_DEBUG "xen: PV spinlocks enabled\n");
	pv_lock_ops.lock_spinning = PV_CALLEE_SAVE(xen_lock_spinning);
	pv_lock_ops.lock_spinning = PV_CALLEE_SAVE(xen_lock_spinning);
	pv_lock_ops.unlock_kick = xen_unlock_kick;
	pv_lock_ops.unlock_kick = xen_unlock_kick;
}
}
@@ -290,6 +290,9 @@ static __init int xen_init_spinlocks_jump(void)
	if (!xen_pvspin)
	if (!xen_pvspin)
		return 0;
		return 0;


	if (!xen_domain())
		return 0;

	static_key_slow_inc(&paravirt_ticketlocks_enabled);
	static_key_slow_inc(&paravirt_ticketlocks_enabled);
	return 0;
	return 0;
}
}
+17 −8
Original line number Original line Diff line number Diff line
@@ -75,6 +75,17 @@ ENDPROC(xen_sysexit)
 * stack state in whatever form its in, we keep things simple by only
 * stack state in whatever form its in, we keep things simple by only
 * using a single register which is pushed/popped on the stack.
 * using a single register which is pushed/popped on the stack.
 */
 */

.macro POP_FS
1:
	popw %fs
.pushsection .fixup, "ax"
2:	movw $0, (%esp)
	jmp 1b
.popsection
	_ASM_EXTABLE(1b,2b)
.endm

ENTRY(xen_iret)
ENTRY(xen_iret)
	/* test eflags for special cases */
	/* test eflags for special cases */
	testl $(X86_EFLAGS_VM | XEN_EFLAGS_NMI), 8(%esp)
	testl $(X86_EFLAGS_VM | XEN_EFLAGS_NMI), 8(%esp)
@@ -83,15 +94,13 @@ ENTRY(xen_iret)
	push %eax
	push %eax
	ESP_OFFSET=4	# bytes pushed onto stack
	ESP_OFFSET=4	# bytes pushed onto stack


	/*
	/* Store vcpu_info pointer for easy access */
	 * Store vcpu_info pointer for easy access.  Do it this way to
	 * avoid having to reload %fs
	 */
#ifdef CONFIG_SMP
#ifdef CONFIG_SMP
	GET_THREAD_INFO(%eax)
	pushw %fs
	movl %ss:TI_cpu(%eax), %eax
	movl $(__KERNEL_PERCPU), %eax
	movl %ss:__per_cpu_offset(,%eax,4), %eax
	movl %eax, %fs
	mov %ss:xen_vcpu(%eax), %eax
	movl %fs:xen_vcpu, %eax
	POP_FS
#else
#else
	movl %ss:xen_vcpu, %eax
	movl %ss:xen_vcpu, %eax
#endif
#endif
+30 −2
Original line number Original line Diff line number Diff line
@@ -198,10 +198,32 @@ struct shutdown_handler {
	void (*cb)(void);
	void (*cb)(void);
};
};


static void do_poweroff(void)
static int poweroff_nb(struct notifier_block *cb, unsigned long code, void *unused)
{
{
	switch (code) {
	case SYS_DOWN:
	case SYS_HALT:
	case SYS_POWER_OFF:
		shutting_down = SHUTDOWN_POWEROFF;
		shutting_down = SHUTDOWN_POWEROFF;
	default:
		break;
	}
	return NOTIFY_DONE;
}
static void do_poweroff(void)
{
	switch (system_state) {
	case SYSTEM_BOOTING:
		orderly_poweroff(true);
		break;
	case SYSTEM_RUNNING:
		orderly_poweroff(false);
		orderly_poweroff(false);
		break;
	default:
		/* Don't do it when we are halting/rebooting. */
		pr_info("Ignoring Xen toolstack shutdown.\n");
		break;
	}
}
}


static void do_reboot(void)
static void do_reboot(void)
@@ -307,6 +329,10 @@ static struct xenbus_watch shutdown_watch = {
	.callback = shutdown_handler
	.callback = shutdown_handler
};
};


static struct notifier_block xen_reboot_nb = {
	.notifier_call = poweroff_nb,
};

static int setup_shutdown_watcher(void)
static int setup_shutdown_watcher(void)
{
{
	int err;
	int err;
@@ -317,6 +343,7 @@ static int setup_shutdown_watcher(void)
		return err;
		return err;
	}
	}



#ifdef CONFIG_MAGIC_SYSRQ
#ifdef CONFIG_MAGIC_SYSRQ
	err = register_xenbus_watch(&sysrq_watch);
	err = register_xenbus_watch(&sysrq_watch);
	if (err) {
	if (err) {
@@ -345,6 +372,7 @@ int xen_setup_shutdown_event(void)
	if (!xen_domain())
	if (!xen_domain())
		return -ENODEV;
		return -ENODEV;
	register_xenstore_notifier(&xenstore_notifier);
	register_xenstore_notifier(&xenstore_notifier);
	register_reboot_notifier(&xen_reboot_nb);


	return 0;
	return 0;
}
}
+2 −1
Original line number Original line Diff line number Diff line
@@ -217,7 +217,7 @@ int xen_pcibk_enable_msix(struct xen_pcibk_device *pdev,
	if (result == 0) {
	if (result == 0) {
		for (i = 0; i < op->value; i++) {
		for (i = 0; i < op->value; i++) {
			op->msix_entries[i].entry = entries[i].entry;
			op->msix_entries[i].entry = entries[i].entry;
			if (entries[i].vector)
			if (entries[i].vector) {
				op->msix_entries[i].vector =
				op->msix_entries[i].vector =
					xen_pirq_from_irq(entries[i].vector);
					xen_pirq_from_irq(entries[i].vector);
				if (unlikely(verbose_request))
				if (unlikely(verbose_request))
@@ -226,6 +226,7 @@ int xen_pcibk_enable_msix(struct xen_pcibk_device *pdev,
						pci_name(dev), i,
						pci_name(dev), i,
						op->msix_entries[i].vector);
						op->msix_entries[i].vector);
			}
			}
		}
	} else
	} else
		pr_warn_ratelimited("%s: error enabling MSI-X for guest %u: err %d!\n",
		pr_warn_ratelimited("%s: error enabling MSI-X for guest %u: err %d!\n",
				    pci_name(dev), pdev->xdev->otherend_id,
				    pci_name(dev), pdev->xdev->otherend_id,
Loading