All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Thomas Huth <thuth@linux.vnet.ibm.com>
Cc: kvm@vger.kernel.org, virtualization@lists.linux-foundation.org
Subject: Re: virtio balloon: do not call blocking ops when !TASK_RUNNING
Date: Wed, 25 Feb 2015 15:17:51 +0100	[thread overview]
Message-ID: <20150225141751.GA10789@redhat.com> (raw)
In-Reply-To: <20150225111318.0040536b@oc7435384737.ibm.com>

On Wed, Feb 25, 2015 at 11:13:18AM +0100, Thomas Huth wrote:
> 
>  Hi all,
> 
> with the recent kernel 3.19, I get a kernel warning when I start my
> KVM guest on s390 with virtio balloon enabled:
> 
> [    0.839687] do not call blocking ops when !TASK_RUNNING; state=1 set at
>                [<0000000000174a1e>] prepare_to_wait_event+0x7e/0x108
> [    0.839694] ------------[ cut here ]------------
> [    0.839697] WARNING: at kernel/sched/core.c:7326
> [    0.839698] Modules linked in:
> [    0.839702] CPU: 0 PID: 46 Comm: vballoon Not tainted 3.19.0 #233
> [    0.839705] task: 00000000021d0000 ti: 00000000021d8000 task.ti: 00000000021d8000
> [    0.839707] Krnl PSW : 0704c00180000000 000000000015bf8e (__might_sleep+0x8e/0x98)
> [    0.839713]            R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 EA:3
> Krnl GPRS: 000000000000000d 00000000021d0000 0000000000000071 0000000000000001
> [    0.839718]            0000000000675ace 0000000001998c50 cccccccccccccccc cccccccccccccccc
> [    0.839720]            0000000000982134 000000000058f824 0000000000a008a8 0000000000000000
> [    0.839722]            00000000000004d9 00000000007ea992 000000000015bf8a 00000000021dbc28
> [    0.839731] Krnl Code: 000000000015bf7e: c0200033e838	larl	%r2,7d8fee
>            000000000015bf84: c0e50028cd62	brasl	%r14,675a48
>           #000000000015bf8a: a7f40001		brc	15,15bf8c
>           >000000000015bf8e: 9201a000		mvi	0(%r10),1
>            000000000015bf92: a7f4ffe2		brc	15,15bf56
>            000000000015bf96: 0707		bcr	0,%r7
>            000000000015bf98: ebdff0800024	stmg	%r13,%r15,128(%r15)
>            000000000015bf9e: a7f13fe0		tmll	%r15,16352
> [    0.839749] Call Trace:
> [    0.839751] ([<000000000015bf8a>] __might_sleep+0x8a/0x98)
> [    0.839756]  [<000000000028a562>] __kmalloc+0x272/0x350
> [    0.839759]  [<000000000058f824>] virtio_ccw_get_config+0x3c/0x100
> [    0.839762]  [<000000000049fcb0>] balloon+0x1b8/0x330
> [    0.839765]  [<00000000001529c8>] kthread+0x120/0x138
> [    0.839767]  [<0000000000683c22>] kernel_thread_starter+0x6/0xc
> [    0.839770]  [<0000000000683c1c>] kernel_thread_starter+0x0/0xc
> [    0.839772] no locks held by vballoon/46.
> [    0.839773] Last Breaking-Event-Address:
> [    0.839776]  [<000000000015bf8a>] __might_sleep+0x8a/0x98
> [    0.839778] ---[ end trace d27fcdfa27273d7c ]---
> 
> The problem seems to be this code in balloon() in
> drivers/virtio/virtio_balloon.c:
> 
> 	wait_event_interruptible(vb->config_change,
> 				 (diff = towards_target(vb)) != 0
> 				 || vb->need_stats_update
> 				 || kthread_should_stop()
> 				 || freezing(current));
> 
> wait_event_interruptible() sets the state of the current task to
> TASK_INTERRUPTIBLE, then checks the condition. The condition contains
> towards_target() which reads the virtio config space via virtio_cread().
> On s390, this then triggers virtio_ccw_get_config() - and this function
> calls some other functions again that might sleep (e.g. kzalloc or
> wait_event in ccw_io_helper) ... and this causes the new kernel warning
> message with kernel 3.19.
> 
> I think it would be quite difficult or at least ugly to rewrite
> virtio_ccw_get_config() so that it does not call sleepable functions
> anymore. So would it be feasible to rewrite the balloon() function that
> it does not call the towards_target() in its wait_event condition
> anymore? I am unfortunately not that familiar with the balloon code
> semantics, so any help is very appreciated here!
> 
>  Thanks,
>   Thomas

Thanks for finding this!
I just sent a patch that should fix this problem:
	http://article.gmane.org/gmane.linux.kernel.virtualization/24851
Testing would be appreciated.

Thanks again!

-- 
MST

  parent reply	other threads:[~2015-02-25 14:17 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-25 10:13 virtio balloon: do not call blocking ops when !TASK_RUNNING Thomas Huth
2015-02-25 11:09 ` Cornelia Huck
2015-02-25 14:17 ` Michael S. Tsirkin [this message]
2015-02-26  1:20 ` Rusty Russell
2015-02-26  7:36   ` Thomas Huth
2015-03-02  0:07     ` Rusty Russell
2015-03-02 11:13       ` Michael S. Tsirkin
2015-03-02 11:13       ` Michael S. Tsirkin
2015-03-02 11:31         ` Cornelia Huck
2015-03-02 11:46           ` Michael S. Tsirkin
2015-03-02 12:11             ` Cornelia Huck
2015-03-02 12:11             ` Cornelia Huck
2015-03-02 12:19               ` Michael S. Tsirkin
2015-03-02 12:35                 ` Cornelia Huck
2015-03-02 20:44                   ` Michael S. Tsirkin
2015-03-02 20:44                   ` Michael S. Tsirkin
2015-03-06 11:47                     ` Cornelia Huck
2015-03-06 11:47                     ` Cornelia Huck
2015-03-02 12:19               ` Michael S. Tsirkin
2015-03-02 20:39               ` Michael S. Tsirkin
2015-03-02 20:39               ` Michael S. Tsirkin
2015-03-02 11:31         ` Cornelia Huck
2015-03-04  6:14         ` Rusty Russell
2015-03-04 10:25           ` Michael S. Tsirkin
2015-03-06 11:56             ` Cornelia Huck
2015-03-10  1:26               ` Rusty Russell
2015-02-26  7:36   ` Thomas Huth
2015-02-26  8:30   ` Michael S. Tsirkin
2015-02-26 17:08     ` Peter Zijlstra
2015-02-26 17:27       ` Michael S. Tsirkin
2015-02-26 17:41         ` Michael S. Tsirkin
2015-02-26 17:27       ` Michael S. Tsirkin
2015-02-26  8:45   ` Michael S. Tsirkin
2015-02-26  8:57     ` Cornelia Huck
2015-02-26  8:45   ` Michael S. Tsirkin
2015-02-26  8:47   ` Cornelia Huck
2015-02-26  8:47   ` Cornelia Huck

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=20150225141751.GA10789@redhat.com \
    --to=mst@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=thuth@linux.vnet.ibm.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.