POD: soft lockups in dom0 kernel
Subsystems (2)
Hi,
when creating a bigger (> 50 GB) HVM guest with maxmem > memory we get softlockups from time to time.
kernel: [ 802.084335] BUG: soft lockup - CPU#1 stuck for 22s! [xend:31351]
I tracked this down to the call of xc_domain_set_pod_target() and further p2m_pod_set_mem_target().
Unfortunately I can this check only with xen-4.2.2 as I don't have a machine with enough memory for current hypervisors. But it seems the code is nearly the same.
My suggestion would be to do the 'pod set target' in the function xc_domain_set_pod_target() in chunks of maybe 1GB to give the dom0 scheduler a chance to run.
As this is not performance critical it should not be a problem.
I can reproduce this with SLES11-SP3 with Linux 3.0.101 and xen-4.2.2.
# cat dummy name = "DummyOS" memory = 10000 maxmem = 12000 builder='hvm'
# echo 1 > /proc/sys/kernel/watchdog_thresh # xm create -c dummy
This leads to a kernel message:
kernel: [ 5019.958089] BUG: soft lockup - CPU#4 stuck for 3s! [xend:20854]
Any comments are welcome.
Thanks.
Dietmar.
Signature · 1 line
Company details: http://ts.fujitsu.com/imprint.html
Quoted 9 lines
Quoted 1 line
Quoted 1 line · Dietmar Hahn
when creating a bigger (> 50 GB) HVM guest with maxmem > memory we get softlockups from time to time.
kernel: [ 802.084335] BUG: soft lockup - CPU#1 stuck for 22s! [xend:31351]
I tracked this down to the call of
xc_domain_set_pod_target()and furtherp2m_pod_set_mem_target().
Quoted 8 lines
Unfortunately I can this check only with xen-4.2.2 as I don't have a machine with enough memory for current hypervisors. But it seems the code is nearly the same.
My suggestion would be to do the 'pod set target' in the function
xc_domain_set_pod_target()in chunks of maybe 1GB to give the dom0 scheduler a chance to run.
As this is not performance critical it should not be a problem.
This is a broader problem: There are more long running hypercalls than just the one setting the POD target. While a kernel built with CONFIG_PREEMPT ought to have no issue with this (as the hypervisor internal preemption will always exit back to the guest, thus allowing interrupts to be processed) as long as such hypercalls aren't invoked with preemption disabled, non- preemptable kernels (the suggested default for servers) have - afaict - no way to deal with this.
However, as long as interrupts and softirqs can get serviced by the kernel (which they can as long as they weren't disabled upon invocation of the hypercall), that may also be a mostly cosmetic problem (in that the soft lockup is being reported) as long as no real time like guarantees are required (which if they were would be sort of contradictory to the kernel being non-preemptable), i.e. other tasks may get starved for some time, but OS health shouldn't be impacted.
Hence I wonder whether it wouldn't make sense to simply suppress the soft lockup detection at least across privcmd invoked hypercalls - Cc-ing upstream Linux maintainers to see if they have an opinion or thoughts towards a proper solution.
Jan
Quoted 36 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · Dietmar Hahn
when creating a bigger (> 50 GB) HVM guest with maxmem > memory we get softlockups from time to time.
kernel: [ 802.084335] BUG: soft lockup - CPU#1 stuck for 22s! [xend:31351]
I tracked this down to the call of
xc_domain_set_pod_target()and furtherp2m_pod_set_mem_target().Quoted 8 lines
Unfortunately I can this check only with xen-4.2.2 as I don't have a machine with enough memory for current hypervisors. But it seems the code is nearly the same.
My suggestion would be to do the 'pod set target' in the function
xc_domain_set_pod_target()in chunks of maybe 1GB to give the dom0 scheduler a chance to run.
As this is not performance critical it should not be a problem.This is a broader problem: There are more long running hypercalls than just the one setting the POD target. While a kernel built with
CONFIG_PREEMPTought to have no issue with this (as the hypervisor internal preemption will always exit back to the guest, thus allowing interrupts to be processed) as long as such hypercalls aren't invoked with preemption disabled, non- preemptable kernels (the suggested default for servers) have - afaict - no way to deal with this.However, as long as interrupts and softirqs can get serviced by the kernel (which they can as long as they weren't disabled upon invocation of the hypercall), that may also be a mostly cosmetic problem (in that the soft lockup is being reported) as long as no real time like guarantees are required (which if they were would be sort of contradictory to the kernel being non-preemptable), i.e. other tasks may get starved for some time, but OS health shouldn't be impacted.
Quoted 4 lines
Hence I wonder whether it wouldn't make sense to simply suppress the soft lockup detection at least across privcmd invoked hypercalls - Cc-ing upstream Linux maintainers to see if they have an opinion or thoughts towards a proper solution.
We do not want to disable the soft lockup detection here as it has found a bug. We can't have tasks that are unschedulable for minutes as it would only take a handful of such tasks to hose the system.
We should put an explicit preemption point in. This will fix it for the CONFIG_PREEMPT_VOLUNTARY case which I think is the most common configuration. Or perhaps this should even be a cond_reched() call to fix it for fully non-preemptible as well.
David
Quoted 4 lines
Quoted 1 line
Quoted 1 line · David Vrabel
We do not want to disable the soft lockup detection here as it has found a bug. We can't have tasks that are unschedulable for minutes as it would only take a handful of such tasks to hose the system.
My understanding is that the soft lockup detection is what its name says - a mechanism to find cases where the kernel software locked up. Yet that's not the case with long running hypercalls.
Quoted 4 lines
We should put an explicit preemption point in. This will fix it for the
CONFIG_PREEMPT_VOLUNTARYcase which I think is the most common configuration. Or perhaps this should even be acond_reched()call to fix it for fully non-preemptible as well.
How do you imagine to do this? When the hypervisor preempts a hypercall, all the kernel gets to see is that it drops back into the hypercall page, such that the next thing to happen would be re-execution of the hypercall. You can't call anything at that point, all that can get run here are interrupts (i.e. event upcalls). Or do you suggest to call cond_resched() from within __xen_evtchn_do_upcall()?
And even if you do - how certain is it that what gets its continuation deferred won't interfere with other things the kernel wants to do (since if you'd be doing it that way, you'd cover all hypercalls at once, not just those coming through privcmd, and hence you could end up with partially completed multicalls or other forms of batching, plus you'd need to deal with possibly active lazy modes).
Jan
Quoted 8 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · David Vrabel
We do not want to disable the soft lockup detection here as it has found a bug. We can't have tasks that are unschedulable for minutes as it would only take a handful of such tasks to hose the system.
My understanding is that the soft lockup detection is what its name says - a mechanism to find cases where the kernel software locked up. Yet that's not the case with long running hypercalls.
Well ok, it's not a lockup in the kernel but it's still a task that cannot be descheduled for minutes of wallclock time. This is still a bug that needs to be fixed.
Quoted 5 lines
Quoted 4 lines
We should put an explicit preemption point in. This will fix it for the
CONFIG_PREEMPT_VOLUNTARYcase which I think is the most common configuration. Or perhaps this should even be acond_reched()call to fix it for fully non-preemptible as well.
Quoted 7 lines
How do you imagine to do this? When the hypervisor preempts a hypercall, all the kernel gets to see is that it drops back into the hypercall page, such that the next thing to happen would be re-execution of the hypercall. You can't call anything at that point, all that can get run here are interrupts (i.e. event upcalls). Or do you suggest to call
cond_resched()from within__xen_evtchn_do_upcall()?
I've not looked at how.
Quoted 6 lines
And even if you do - how certain is it that what gets its continuation deferred won't interfere with other things the kernel wants to do (since if you'd be doing it that way, you'd cover all hypercalls at once, not just those coming through privcmd, and hence you could end up with partially completed multicalls or other forms of batching, plus you'd need to deal with possibly active lazy modes).
I would only do this for hypercalls issued by the privcmd driver.
David
Am Freitag 06 Dezember 2013, 12:00:02 schrieb David Vrabel:
Quoted 29 lines · Jan Beulich
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line · David Vrabel
We do not want to disable the soft lockup detection here as it has found a bug. We can't have tasks that are unschedulable for minutes as it would only take a handful of such tasks to hose the system.
My understanding is that the soft lockup detection is what its name says - a mechanism to find cases where the kernel software locked up. Yet that's not the case with long running hypercalls.
Well ok, it's not a lockup in the kernel but it's still a task that cannot be descheduled for minutes of wallclock time. This is still a bug that needs to be fixed.
Quoted 5 lines
Quoted 4 lines
We should put an explicit preemption point in. This will fix it for the
CONFIG_PREEMPT_VOLUNTARYcase which I think is the most common configuration. Or perhaps this should even be acond_reched()call to fix it for fully non-preemptible as well.Quoted 7 lines
How do you imagine to do this? When the hypervisor preempts a hypercall, all the kernel gets to see is that it drops back into the hypercall page, such that the next thing to happen would be re-execution of the hypercall. You can't call anything at that point, all that can get run here are interrupts (i.e. event upcalls). Or do you suggest to call
cond_resched()from within__xen_evtchn_do_upcall()?I've not looked at how.
Quoted 8 lines
Quoted 6 lines
And even if you do - how certain is it that what gets its continuation deferred won't interfere with other things the kernel wants to do (since if you'd be doing it that way, you'd cover all hypercalls at once, not just those coming through privcmd, and hence you could end up with partially completed multicalls or other forms of batching, plus you'd need to deal with possibly active lazy modes).
I would only do this for hypercalls issued by the privcmd driver.
But I also got soft lockups when unmapping a bigger chunk of guest memory (our BS2000 OS) in the dom0 kernel via vunmap(). This calls in the end HYPERVISOR_update_va_mapping() and may take a very long time.
Quoted 1 line
From a kernel module I found no solution to split the virtual address area to
be able to call schedule(). Because all needed kernel functions are not exported to be usable in modules. The only possible solution was to turn of the soft lockup detection.
Dietmar.
Quoted 3 lines
David
Signature · 1 line
Company details: http://ts.fujitsu.com/imprint.html
Quoted 39 lines · Dietmar Hahn
Am Freitag 06 Dezember 2013, 12:00:02 schrieb David Vrabel:
Quoted 29 lines · Jan Beulich
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line · David Vrabel
We do not want to disable the soft lockup detection here as it has found a bug. We can't have tasks that are unschedulable for minutes as it would only take a handful of such tasks to hose the system.
My understanding is that the soft lockup detection is what its name says - a mechanism to find cases where the kernel software locked up. Yet that's not the case with long running hypercalls.
Well ok, it's not a lockup in the kernel but it's still a task that cannot be descheduled for minutes of wallclock time. This is still a bug that needs to be fixed.
Quoted 5 lines
Quoted 4 lines
We should put an explicit preemption point in. This will fix it for the
CONFIG_PREEMPT_VOLUNTARYcase which I think is the most common configuration. Or perhaps this should even be acond_reched()call to fix it for fully non-preemptible as well.Quoted 7 lines
How do you imagine to do this? When the hypervisor preempts a hypercall, all the kernel gets to see is that it drops back into the hypercall page, such that the next thing to happen would be re-execution of the hypercall. You can't call anything at that point, all that can get run here are interrupts (i.e. event upcalls). Or do you suggest to call
cond_resched()from within__xen_evtchn_do_upcall()?I've not looked at how.
Quoted 8 lines
Quoted 6 lines
And even if you do - how certain is it that what gets its continuation deferred won't interfere with other things the kernel wants to do (since if you'd be doing it that way, you'd cover all hypercalls at once, not just those coming through privcmd, and hence you could end up with partially completed multicalls or other forms of batching, plus you'd need to deal with possibly active lazy modes).
I would only do this for hypercalls issued by the privcmd driver.
Quoted 7 lines
But I also got soft lockups when unmapping a bigger chunk of guest memory (our BS2000 OS) in the dom0 kernel via
vunmap(). This calls in the endHYPERVISOR_update_va_mapping()and may take a very long time. From a kernel module I found no solution to split the virtual address area to be able to callschedule(). Because all needed kernel functions are not exported to be usable in modules. The only possible solution was to turn of the soft lockup detection.
vunmap() does a hypercall per-page since it calls ptep_get_and_clear() so there are no long running hypercalls here.
zap_pmd_range() (which is used for munmap()) already has appropriate cond_resched() calls after every zap_pte_range() so I think there needs to be a cond_resched() call added into vunmap_pmd_range() as well.
David
Quoted 16 lines · David Vrabel
Quoted 7 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · David Vrabel
We do not want to disable the soft lockup detection here as it has found a bug. We can't have tasks that are unschedulable for minutes as it would only take a handful of such tasks to hose the system.
My understanding is that the soft lockup detection is what its name says - a mechanism to find cases where the kernel software locked up. Yet that's not the case with long running hypercalls.
Well ok, it's not a lockup in the kernel but it's still a task that cannot be descheduled for minutes of wallclock time. This is still a bug that needs to be fixed.
Quoted 4 lines
Quoted 4 lines
We should put an explicit preemption point in. This will fix it for the
CONFIG_PREEMPT_VOLUNTARYcase which I think is the most common configuration. Or perhaps this should even be acond_reched()call to fix it for fully non-preemptible as well.
Quoted 8 lines
Quoted 7 lines
How do you imagine to do this? When the hypervisor preempts a hypercall, all the kernel gets to see is that it drops back into the hypercall page, such that the next thing to happen would be re-execution of the hypercall. You can't call anything at that point, all that can get run here are interrupts (i.e. event upcalls). Or do you suggest to call
cond_resched()from within__xen_evtchn_do_upcall()?I've not looked at how.
KVM has a hook (kvm_check_and_clear_guest_paused()) into watchdog code to prevent it from having false positives (for a different reason though). If we claim that soft lockup mechanism is only to detect Linux kernel problems and not long-running hypervisor code then perhaps we can make this hook a bit more generic.
We would still need to think about what may happen if we are stuck in the hypervisor for abnormally long time. Maybe this Xen hook can still return false when such cases are detected.
-boris
Quoted 10 lines
Quoted 7 lines
And even if you do - how certain is it that what gets its continuation deferred won't interfere with other things the kernel wants to do (since if you'd be doing it that way, you'd cover all hypercalls at once, not just those coming through privcmd, and hence you could end up with partially completed multicalls or other forms of batching, plus you'd need to deal with possibly active lazy modes).
I would only do this for hypercalls issued by the privcmd driver.
David
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Dietmar Hahn
when creating a bigger (> 50 GB) HVM guest with maxmem > memory we get softlockups from time to time.
Quoted 8 lines
kernel: [ 802.084335] BUG: soft lockup - CPU#1 stuck for 22s! [xend:31351]
I tracked this down to the call of
xc_domain_set_pod_target()and furtherp2m_pod_set_mem_target().Unfortunately I can this check only with xen-4.2.2 as I don't have a machine with enough memory for current hypervisors. But it seems the code is nearly the same.
While I still didn't see a formal report of this against SLE11 yet, attached a draft patch against the SP3 code base adding manual preemption to the hypercall path of privcmd. This is only lightly tested, and therefore has a little bit of debugging code still left in there. Mind giving this an try (perhaps together with the patch David had sent for the other issue - there may still be a need for further preemption points in the IOCTL_PRIVCMD_MMAP* handling, but without knowing for sure whether that matters to you I didn't want to add this right away)?
Jan
arch/x86/include/mach-xen/asm/hypervisor.h +3 -0
@@ -235,6 +235,9 @@ static inline int gnttab_post_map_adjust#ifdef CONFIG_XEN #define is_running_on_xen () 1extern char hypercall_page[PAGE_SIZE ]; +#define in_hypercall (regs) (!user_mode_vm(regs) && \ + (regs)->ip >= (unsigned long)hypercall_page && \ + (regs)->ip < (unsigned long)hypercall_page + PAGE_SIZE)#else extern char *hypercall_stubs;#define is_running_on_xen () (!!hypercall_stubs)
arch/x86/kernel/entry_32-xen.S +14 -0
@@ -980,6 +980,20 @@ ENTRY(hypervisor_callback) call evtchn_do_upcall add $4,%esp CFI_ADJUST_CFA_OFFSET -4 +#ifndef CONFIG_PREEMPT + test %al,%al + jz ret_from_intr + GET_THREAD_INFO(%edx) + cmpl $0,TI_preempt_count(%edx) + jnz ret_from_intr + testl $_TIF_NEED_RESCHED,TI_flags(%edx) + jz ret_from_intr + testl $X86_EFLAGS_IF,PT_EFLAGS(%esp) + jz ret_from_intr + movb $0,PER_CPU_VAR(privcmd_hcall) + call preempt_schedule_irq + movb $1,PER_CPU_VAR(privcmd_hcall) +#endif jmp ret_from_intr CFI_ENDPROC
arch/x86/kernel/entry_64-xen.S +14 -0
@@ -982,6 +982,20 @@ ENTRY(do_hypervisor_callback) # do_hyp popq %rsp CFI_DEF_CFA_REGISTER rsp decl PER_CPU_VAR(irq_count) +#ifndef CONFIG_PREEMPT + test %al,%al + jz error_exit + GET_THREAD_INFO(%rdx) + cmpl $0,TI_preempt_count(%rdx) + jnz error_exit + bt $TIF_NEED_RESCHED,TI_flags(%rdx) + jnc error_exit + bt $9,EFLAGS-ARGOFFSET(%rsp) + jnc error_exit + movb $0,PER_CPU_VAR(privcmd_hcall) + call preempt_schedule_irq + movb $1,PER_CPU_VAR(privcmd_hcall) +#endif jmp error_exit CFI_ENDPROC END(do_hypervisor_callback)
drivers/xen/core/evtchn.c +12 -2
@@ -379,7 +379,14 @@ static DEFINE_PER_CPU(unsigned int, curr#endif /* NB. Interrupts are disabled on entry. */ -asmlinkage void __irq_entry evtchn_do_upcall(struct pt_regs *regs) +asmlinkage +#ifdef CONFIG_PREEMPT +void +#define return(x) return +#else +bool +#endif +__irq_entry evtchn_do_upcall (struct pt_regs *regs) {unsigned long l1, l2;unsigned long masked_l1, masked_l2;
@@ -393,7 +400,7 @@ asmlinkage void __irq_entry evtchn_do_up__this_cpu_or (upcall_state,UPC_NESTED_LATCH );/* Avoid a callback storm when we reenable delivery. */ vcpu_info_write (evtchn_upcall_pending,0 ); -return ; +return (false); } old_regs =set_irq_regs (regs);
@@ -511,6 +518,9 @@ asmlinkage void __irq_entry evtchn_do_upirq_exit ();xen_spin_irq_exit ();set_irq_regs (old_regs); + +return (__this_cpu_read (privcmd_hcall) &&in_hypercall (regs)); +#undef return } static int find_unbound_irq(unsigned int node, struct irq_cfg **pcfg,
drivers/xen/privcmd/privcmd.c +15 -0
@@ -23,6 +23,18 @@#include <xen/interface/xen.h> #include <xen/xen_proc.h> #include <xen/features.h> +#include <xen/evtchn.h> + +#ifndef CONFIG_PREEMPT +DEFINE_PER_CPU (bool, privcmd_hcall); +#endif + +static inline void _privcmd_hcall (bool state) +{ +#ifndef CONFIG_PREEMPT +this_cpu_write (privcmd_hcall, state); +#endif +}static struct proc_dir_entry *privcmd_intf;static struct proc_dir_entry *capabilities_intf;
@@ -97,6 +109,7 @@ static long privcmd_ioctl(struct file *f ret = -ENOSYS ;if (hypercall.op >= (PAGE_SIZE >>5 ))break ; +_privcmd_hcall (true); ret = _hypercall(long, (unsigned int)hypercall.op, (unsigned long)hypercall.arg[0], (unsigned long)hypercall.arg[1],
@@ -104,8 +117,10 @@ static long privcmd_ioctl(struct file *f (unsigned long )hypercall.arg[3 ], (unsigned long)hypercall.arg[4]);#else +_privcmd_hcall (true); ret =privcmd_hypercall (&hypercall);#endif +_privcmd_hcall (false); }break ;
include/xen/evtchn.h +9 -1
@@ -143,7 +143,13 @@ void irq_resume(void);#endif /* Entry point for notifications into Linux subsystems. */ -asmlinkage void evtchn_do_upcall(struct pt_regs *regs); +asmlinkage +#ifdef CONFIG_PREEMPT +void +#else +bool +#endif +evtchn_do_upcall (struct pt_regs *regs);/* Mark a PIRQ as unavailable for dynamic allocation. */ void evtchn_register_pirq (int irq);
@@ -221,6 +227,8 @@ void notify_remote_via_ipi(unsigned intvoid clear_ipi_evtchn (void );#endif +DECLARE_PER_CPU (bool, privcmd_hcall); +#if defined(CONFIG_XEN_SPINLOCK_ACQUIRE_NESTING ) \ &&CONFIG_XEN_SPINLOCK_ACQUIRE_NESTING void xen_spin_irq_enter (void );
kernel/sched.c +11 -0
@@ -4690,6 +4690,9 @@ asmlinkage void __sched notrace preempt_ }EXPORT_SYMBOL (preempt_schedule); +#endif +#if defined(CONFIG_PREEMPT ) || defined(CONFIG_XEN ) +/* * this is the entry point to schedule() from kernel preemption * off of irq context.
@@ -4699,6 +4702,14 @@ EXPORT_SYMBOL(preempt_schedule); asmlinkage void __sched preempt_schedule_irq(void) {struct thread_info *ti =current_thread_info (); +#ifdef CONFIG_XEN //temp +static DEFINE_PER_CPU(unsigned long, cnt); +static DEFINE_PER_CPU(unsigned long, thr); +if (__this_cpu_inc_return (cnt) >__this_cpu_read (thr)) { +__this_cpu_or (thr,__this_cpu_read (cnt)); +printk ("psi[%02u] %08x:%d #%lx\n" ,raw_smp_processor_id (), ti->preempt_count,need_resched (),__this_cpu_read (cnt)); +} +#endif /* Catch callers which need to be fixed */ BUG_ON (ti->preempt_count || !irqs_disabled ());
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 22 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Dietmar Hahn
when creating a bigger (> 50 GB) HVM guest with maxmem > memory we get softlockups from time to time.
Quoted 8 lines
kernel: [ 802.084335] BUG: soft lockup - CPU#1 stuck for 22s! [xend:31351]
I tracked this down to the call of
xc_domain_set_pod_target()and furtherp2m_pod_set_mem_target().Unfortunately I can this check only with xen-4.2.2 as I don't have a machine with enough memory for current hypervisors. But it seems the code is nearly the same.
While I still didn't see a formal report of this against SLE11 yet, attached a draft patch against the SP3 code base adding manual preemption to the hypercall path of privcmd. This is only lightly tested, and therefore has a little bit of debugging code still left in there. Mind giving this an try (perhaps together with the patch David had sent for the other issue - there may still be a need for further preemption points in the IOCTL_PRIVCMD_MMAP* handling, but without knowing for sure whether that matters to you I didn't want to add this right away)?
Quoted 2 lines
Jan
With my 4.4-rc2 testing, these softlockups are becoming more of a problem, especially with construction/migration of 128GB guests.
I have been looking at doing a similar patch against mainline.
Having talked it through with David, it seems more sensible to have a second hypercall page, at which point in_hypercall() becomes in_preemptable_hypercall().
Any task (which could even be kernel tasks) could use the preemptable page, rather than the main hypercall page, and the asm code doesn't need to care whether the task was in privcmd.
This would avoid having to maintain extra state to identify whether the hypercall was preemptable, and would avoid modification to evtchn_do_upcall().
I shall see about hacking up a patch to this effect.
~Andrew
Quoted 32 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper
Quoted 22 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Dietmar Hahn
when creating a bigger (> 50 GB) HVM guest with maxmem > memory we get softlockups from time to time.
Quoted 8 lines
kernel: [ 802.084335] BUG: soft lockup - CPU#1 stuck for 22s! [xend:31351]
I tracked this down to the call of
xc_domain_set_pod_target()and furtherp2m_pod_set_mem_target().Unfortunately I can this check only with xen-4.2.2 as I don't have a machine with enough memory for current hypervisors. But it seems the code is nearly the same.
While I still didn't see a formal report of this against SLE11 yet, attached a draft patch against the SP3 code base adding manual preemption to the hypercall path of privcmd. This is only lightly tested, and therefore has a little bit of debugging code still left in there. Mind giving this an try (perhaps together with the patch David had sent for the other issue - there may still be a need for further preemption points in the IOCTL_PRIVCMD_MMAP* handling, but without knowing for sure whether that matters to you I didn't want to add this right away)?
Quoted 2 lines
Jan
With my 4.4-rc2 testing, these softlockups are becoming more of a problem, especially with construction/migration of 128GB guests.
I have been looking at doing a similar patch against mainline.
Quoted 7 lines
Having talked it through with David, it seems more sensible to have a second hypercall page, at which point
in_hypercall()becomesin_preemptable_hypercall().Any task (which could even be kernel tasks) could use the preemptable page, rather than the main hypercall page, and the asm code doesn't need to care whether the task was in privcmd.
Of course this can be generalized, but I don't think a second hypercall page is the answer here: You'd then also need a second set of hypercall wrappers (_hypercall0() etc as well as HYPERVISOR_*()), and generic library routines would need to have a way to know which one to call.
Therefore I think having a per-CPU state flag (which gets cleared/ restored during interrupt handling, or - like my patch does - honored only when outside or atomic context) is still the more reasonable approach.
Quoted 3 lines
This would avoid having to maintain extra state to identify whether the hypercall was preemptable, and would avoid modification to
evtchn_do_upcall().
I'd be curious to see how you avoid modifying evtchn_do_upcall() (other than by adding what I added there at the assembly call site) - I especially don't see where your in_preemptable_hypercall() would get invoked.
Jan
Hi,
sorry for the delay.
Am Donnerstag 16 Januar 2014, 11:10:38 schrieb Jan Beulich:
Quoted 23 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Dietmar Hahn
when creating a bigger (> 50 GB) HVM guest with maxmem > memory we get softlockups from time to time.
Quoted 8 lines
kernel: [ 802.084335] BUG: soft lockup - CPU#1 stuck for 22s! [xend:31351]
I tracked this down to the call of
xc_domain_set_pod_target()and furtherp2m_pod_set_mem_target().Unfortunately I can this check only with xen-4.2.2 as I don't have a machine with enough memory for current hypervisors. But it seems the code is nearly the same.
While I still didn't see a formal report of this against SLE11 yet, attached a draft patch against the SP3 code base adding manual preemption to the hypercall path of privcmd. This is only lightly tested, and therefore has a little bit of debugging code still left in there. Mind giving this an try (perhaps together with the patch David had sent for the other issue - there may still be a need for further preemption points in the IOCTL_PRIVCMD_MMAP* handling, but without knowing for sure whether that matters to you I didn't want to add this right away)?
Quoted 1 line
Jan
Today I did some tests with the patch. As the debug part didn't compile I changed the per cpu variables to local variables.
OK it works! I tried several times to start a domU with memory=100GB and maxmem=230GB and never got a soft lockup. Following messages in /var/log/message on the first start:
Jan 29 14:14:45 gut1 kernel: [ 178.976373] psi[03] 00000000:1 #2 Jan 29 14:14:46 gut1 kernel: [ 179.008774] psi[03] 00000000:1 #4 Jan 29 14:14:46 gut1 kernel: [ 179.073048] psi[03] 00000000:1 #8 Jan 29 14:14:46 gut1 kernel: [ 179.219272] psi[03] 00000000:1 #10 Jan 29 14:14:47 gut1 kernel: [ 180.220803] psi[03] 00000000:1 #20 Jan 29 14:14:48 gut1 kernel: [ 181.844153] psi[03] 00000000:1 #40 Jan 29 14:14:51 gut1 kernel: [ 184.769331] psi[03] 00000000:1 #80 Jan 29 14:14:56 gut1 kernel: [ 189.169159] psi[03] 00000000:1 #100 Jan 29 14:14:57 gut1 kernel: [ 190.178545] psi[03] 00000000:1 #200 Jan 29 14:15:03 gut1 kernel: [ 196.256353] psi[00] 00000000:1 #1 Jan 29 14:15:03 gut1 kernel: [ 196.260928] psi[00] 00000000:1 #2 Jan 29 14:15:03 gut1 kernel: [ 196.497156] psi[00] 00000000:1 #4 Jan 29 14:15:03 gut1 kernel: [ 196.552303] psi[00] 00000000:1 #8 Jan 29 14:15:04 gut1 kernel: [ 197.035527] psi[00] 00000000:1 #10 Jan 29 14:15:04 gut1 kernel: [ 197.060626] psi[01] 00000000:1 #1 Jan 29 14:15:04 gut1 kernel: [ 197.064101] psi[01] 00000000:1 #2 Jan 29 14:15:04 gut1 kernel: [ 197.096719] psi[01] 00000000:1 #4 Jan 29 14:15:04 gut1 kernel: [ 197.148756] psi[01] 00000000:1 #8 Jan 29 14:15:04 gut1 kernel: [ 197.517184] psi[01] 00000000:1 #10 Jan 29 14:15:05 gut1 kernel: [ 198.153211] psi[01] 00000000:1 #20 Jan 29 14:15:06 gut1 kernel: [ 199.162541] psi[02] 00000000:1 #1 Jan 29 14:15:06 gut1 kernel: [ 199.164895] psi[02] 00000000:1 #2 Jan 29 14:15:06 gut1 kernel: [ 199.169576] psi[02] 00000000:1 #4 Jan 29 14:15:06 gut1 kernel: [ 199.178073] psi[02] 00000000:1 #8 Jan 29 14:15:06 gut1 kernel: [ 199.195693] psi[02] 00000000:1 #10 Jan 29 14:15:06 gut1 kernel: [ 199.335857] psi[02] 00000000:1 #20 Jan 29 14:15:06 gut1 kernel: [ 199.805027] psi[02] 00000000:1 #40 Jan 29 14:15:07 gut1 kernel: [ 200.753118] psi[00] 00000000:1 #20 Jan 29 14:15:08 gut1 kernel: [ 201.524368] psi[01] 00000000:1 #40 Jan 29 14:15:09 gut1 kernel: [ 202.692159] psi[01] 00000000:1 #80 Jan 29 14:15:11 gut1 kernel: [ 204.968433] psi[01] 00000000:1 #100 Jan 29 14:15:16 gut1 kernel: [ 209.712892] psi[01] 00000000:1 #200 Jan 29 14:15:32 gut1 kernel: [ 225.940798] psi[01] 00000000:1 #400 Jan 29 14:15:38 gut1 kernel: [ 231.360556] psi[00] 00000000:1 #40
Second:
Jan 29 14:49:19 gut1 kernel: [ 2250.788926] psi[02] 00000000:1 #80 Jan 29 14:49:26 gut1 kernel: [ 2257.360767] psi[02] 00000000:1 #100 Jan 29 14:49:37 gut1 kernel: [ 2268.912916] psi[02] 00000000:1 #200 Jan 29 14:50:09 gut1 kernel: [ 2300.804211] psi[01] 00000000:1 #800
Thanks.
Dietmar.
Signature · 1 line
Company details: http://ts.fujitsu.com/imprint.html