LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>,
	<david.vrabel@citrix.com>, <konrad.wilk@oracle.com>,
	<boris.ostrovsky@oracle.com>, <xen-devel@lists.xenproject.org>
Cc: Borislav Petkov <bp@suse.de>, <kvm@vger.kernel.org>,
	"Luis R. Rodriguez" <mcgrof@suse.com>, <x86@kernel.org>,
	<linux-kernel@vger.kernel.org>, <rostedt@goodmis.org>,
	Andy Lutomirski <luto@amacapital.net>,
	Ingo Molnar <mingo@redhat.com>, Jan Beulich <JBeulich@suse.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	<paulmck@linux.vnet.ibm.com>
Subject: Re: [Xen-devel] [RFC v4 2/2] x86/xen: allow privcmd hypercalls to be preempted
Date: Fri, 23 Jan 2015 11:45:06 +0000	[thread overview]
Message-ID: <54C23442.9000008@citrix.com> (raw)
In-Reply-To: <1421972951-3940-3-git-send-email-mcgrof@do-not-panic.com>

On 23/01/15 00:29, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <mcgrof@suse.com>
> 
> Xen has support for splitting heavy work work into a series
> of hypercalls, called multicalls, and preempting them through
> what Xen calls continuation [0]. Despite this though without
> CONFIG_PREEMPT preemption won't happen, without preemption
> a system can become pretty useless on heavy handed hypercalls.
> Such is the case for example when creating a > 50 GiB HVM guest,
> we can get softlockups [1] with:.
> 
> kernel: [  802.084335] BUG: soft lockup - CPU#1 stuck for 22s! [xend:31351]
> 
> The softlock up triggers on the TASK_UNINTERRUPTIBLE hanger check
> (default 120 seconds), on the Xen side in this particular case
> this happens when the following Xen hypervisor code is used:
> 
> xc_domain_set_pod_target() -->
>   do_memory_op() -->
>     arch_memory_op() -->
>       p2m_pod_set_mem_target()
> 	-- long delay (real or emulated) --
> 
> This happens on arch_memory_op() on the XENMEM_set_pod_target memory
> op even though arch_memory_op() can handle continuation via
> hypercall_create_continuation() for example.
> 
> Machines over 50 GiB of memory are on high demand and hard to come
> by so to help replicate this sort of issue long delays on select
> hypercalls have been emulated in order to be able to test this on
> smaller machines [2].
> 
> On one hand this issue can be considered as expected given that
> CONFIG_PREEMPT=n is used however we have forced voluntary preemption
> precedent practices in the kernel even for CONFIG_PREEMPT=n through
> the usage of cond_resched() sprinkled in many places. To address
> this issue with Xen hypercalls though we need to find a way to aid
> to the schedular in the middle of hypercalls. We are motivated to
> address this issue on CONFIG_PREEMPT=n as otherwise the system becomes
> rather unresponsive for long periods of time; in the worst case, at least
> only currently by emulating long delays on select io disk bound
> hypercalls, this can lead to filesystem corruption if the delay happens
> for example on SCHEDOP_remote_shutdown (when we call 'xl <domain> shutdown').
> 
> We can address this problem by trying to check if we should schedule
> on the xen timer in the middle of a hypercall on the return from the
> timer interrupt. We want to be careful to not always force voluntary
> preemption though so to do this we only selectively enable preemption
> on very specific xen hypercalls.
[...]
> @@ -1243,6 +1247,25 @@ void xen_evtchn_do_upcall(struct pt_regs *regs)
>  	set_irq_regs(old_regs);
>  }
>  
> +/*
> + * CONFIG_PREEMPT=n kernels can end up triggering the softlock
> + * TASK_UNINTERRUPTIBLE hanger check (default 120 seconds)
> + * when certain multicalls are used [0] on large systems, in
> + * that case we need a way to voluntarily preempt. This is
> + * only an issue on CONFIG_PREEMPT=n kernels.

Rewrite this comment as;

* Some hypercalls issued by the toolstack can take many 10s of
* seconds.  Allow tasks running hypercalls via the privcmd driver to be
* voluntarily preempted even if full kernel preemption is disabled.

> + * [0] https://bugzilla.novell.com/show_bug.cgi?id=861093

This link isn't accessible so I don't think it should be included here.

> + */
> +void xen_end_upcall(struct pt_regs *regs)
> +{
> +	if (xen_is_preemptible_hypercall(regs)) {
> +		int cpuid = smp_processor_id();
> +		if (_cond_resched())
> +			trace_xen_hypercall_preemption(cpuid);

I don't think a tracepoint here is useful.

> +	}
> +}
> +NOKPROBE_SYMBOL(xen_end_upcall);

Do we need this is this function is no longer notrace?

David

  parent reply	other threads:[~2015-01-23 11:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23  0:29 [RFC v4 0/2] x86/xen: add xen hypercall preemption Luis R. Rodriguez
2015-01-23  0:29 ` [RFC v4 1/2] x86/xen: add xen_is_preemptible_hypercall() Luis R. Rodriguez
2015-01-23  1:40   ` Andy Lutomirski
2015-01-27  1:45     ` Luis R. Rodriguez
2015-01-23 11:30   ` [Xen-devel] " David Vrabel
2015-01-23 18:57     ` Luis R. Rodriguez
2015-01-23  0:29 ` [RFC v4 2/2] x86/xen: allow privcmd hypercalls to be preempted Luis R. Rodriguez
2015-01-23  1:40   ` Andy Lutomirski
2015-01-23  1:57     ` Steven Rostedt
2015-01-23 11:45   ` David Vrabel [this message]
2015-01-23 18:58     ` [Xen-devel] " Luis R. Rodriguez
2015-01-26 10:46       ` Jan Beulich
2015-01-26 10:47       ` David Vrabel
2015-01-23 19:16     ` Luis R. Rodriguez
2015-01-23 11:51 ` [Xen-devel] [RFC v4 0/2] x86/xen: add xen hypercall preemption David Vrabel
2015-01-23 18:58   ` Luis R. Rodriguez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54C23442.9000008@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@suse.de \
    --cc=hpa@zytor.com \
    --cc=konrad.wilk@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mcgrof@do-not-panic.com \
    --cc=mcgrof@suse.com \
    --cc=mingo@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    --subject='Re: [Xen-devel] [RFC v4 2/2] x86/xen: allow privcmd hypercalls to be preempted' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).