Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync up with Linus #50

Merged
merged 33 commits into from
Mar 17, 2015
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
09cadf6
regmap-irq: set IRQF_ONESHOT flag to ensure IRQ request
Feb 11, 2015
4ceba98
regmap: Skip read-only registers in regcache_sync()
tiwai Mar 4, 2015
4f6e24e
virtio_console: init work unconditionally
mstsirkin Mar 5, 2015
eeb8a7e
virtio_console: avoid config access from irq
mstsirkin Mar 5, 2015
328f494
regmap: regcache-rbtree: Fix present bitmap resize
larsclausen Mar 7, 2015
7d720ee
Merge remote-tracking branches 'regmap/fix/irq', 'regmap/fix/rbtree' …
broonie Mar 7, 2015
0548bf4
regulator: Only enable disabled regulators on resume
Mar 2, 2015
29d62ec
regulator: core: Fix enable GPIO reference counting
dianders Mar 3, 2015
88660f7
virtio_balloon: set DRIVER_OK before using device
mstsirkin Mar 5, 2015
7e41a9d
virtio_blk: typo fix
mstsirkin Mar 6, 2015
0fa2a56
virtio_blk: fix comment for virtio 1.0
mstsirkin Mar 6, 2015
3d2a377
virtio-balloon: do not call blocking ops when !TASK_RUNNING
mstsirkin Mar 10, 2015
dc9be0f
kvm: move advertising of KVM_CAP_IRQFD to common code
bonzini Mar 5, 2015
a987370
arm64: KVM: Fix stage-2 PGD allocation to have per-page refcounting
Mar 10, 2015
04b8dc8
arm64: KVM: Do not use pgd_index to index stage-2 pgd
Mar 10, 2015
84ed741
arm64: KVM: Fix outdated comment about VTCR_EL2.PS
Mar 10, 2015
c1a6bff
kvm: x86: i8259: return initialized data on invalid-size read
pmatouse Mar 11, 2015
8051a2a
9p/trans_virtio: fix hot-unplug
mstsirkin Mar 12, 2015
71e4b8b
virtio_rpmsg: set DRIVER_OK before using device
mstsirkin Mar 12, 2015
87e7bf1
virtio_mmio: generation support
mstsirkin Mar 12, 2015
a4994b8
uapi/virtio_scsi: allow overriding CDB/SENSE size
mstsirkin Mar 13, 2015
b52104e
arm/arm64: KVM: fix missing unlock on error in kvm_vgic_create()
Feb 27, 2015
670125b
KVM: VMX: Set msr bitmap correctly if vcpu is in guest mode
Mar 4, 2015
ae70593
arm/arm64: KVM: Keep elrsr/aisr in sync with software model
chazy Mar 13, 2015
d16da51
regulator: tps65910: Add missing #include <linux/of.h>
geertu Mar 15, 2015
8ca8f32
Merge remote-tracking branches 'regulator/fix/gpio-enable' and 'regul…
broonie Mar 16, 2015
f710a12
Merge tag 'kvm-arm-fixes-4.0-rc5' of git://git.kernel.org/pub/scm/lin…
Mar 16, 2015
704a0b5
virtio_mmio: fix access width for mmio
mstsirkin Mar 17, 2015
ab676b7
pagemap: do not leak physical addresses to non-privileged userspace
kiryl Mar 9, 2015
2fc6775
Merge git://git.kernel.org/pub/scm/virt/kvm/kvm
torvalds Mar 17, 2015
4d272f9
Merge tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/lin…
torvalds Mar 17, 2015
529d2eb
Merge tag 'regmap-v4.0-rc4' of git://git.kernel.org/pub/scm/linux/ker…
torvalds Mar 17, 2015
8e6e44f
Merge tag 'regulator-fix-v4.0-rc4' of git://git.kernel.org/pub/scm/li…
torvalds Mar 17, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
virtio-balloon: do not call blocking ops when !TASK_RUNNING
virtio balloon has this code:
        wait_event_interruptible(vb->config_change,
                                 (diff = towards_target(vb)) != 0
                                 || vb->need_stats_update
                                 || kthread_should_stop()
                                 || freezing(current));

Which is a problem because towards_target() call might block after
wait_event_interruptible sets task state to TAST_INTERRUPTIBLE, causing
the task_struct::state collision typical of nesting of sleeping
primitives

See also http://lwn.net/Articles/628628/ or Thomas's
bug report
http://article.gmane.org/gmane.linux.kernel.virtualization/24846
for a fuller explanation.

To fix, rewrite using wait_woken.

Cc: stable@vger.kernel.org
Reported-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
mstsirkin authored and rustyrussell committed Mar 10, 2015

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 3d2a3774c1b046f548ebea0391a602fd5685a307
19 changes: 14 additions & 5 deletions drivers/virtio/virtio_balloon.c
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@
#include <linux/module.h>
#include <linux/balloon_compaction.h>
#include <linux/oom.h>
#include <linux/wait.h>

/*
* Balloon device works in 4K page units. So each page is pointed to by
@@ -334,17 +335,25 @@ static int virtballoon_oom_notify(struct notifier_block *self,
static int balloon(void *_vballoon)
{
struct virtio_balloon *vb = _vballoon;
DEFINE_WAIT_FUNC(wait, woken_wake_function);

set_freezable();
while (!kthread_should_stop()) {
s64 diff;

try_to_freeze();
wait_event_interruptible(vb->config_change,
(diff = towards_target(vb)) != 0
|| vb->need_stats_update
|| kthread_should_stop()
|| freezing(current));

add_wait_queue(&vb->config_change, &wait);
for (;;) {
if ((diff = towards_target(vb)) != 0 ||
vb->need_stats_update ||
kthread_should_stop() ||
freezing(current))
break;
wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
}
remove_wait_queue(&vb->config_change, &wait);

if (vb->need_stats_update)
stats_handle_request(vb);
if (diff > 0)