Re: [PATCH] virtio: avoid possible OOM lockup at virtballoon_oom_notify()

2017-10-13 Thread Tetsuo Handa
Michael S. Tsirkin wrote: > On Tue, Oct 10, 2017 at 07:47:37PM +0900, Tetsuo Handa wrote: > > In leak_balloon(), mutex_lock(>balloon_lock) is called in order to > > serialize against fill_balloon(). But in fill_balloon(), > > alloc_page(GFP_HIGHUSER[_MOVABLE] | __GFP_NOMEMALLOC | __GFP_NORETRY) is

[PATCH net-next] virtio_net: implement VIRTIO_CONFIG_S_NEEDS_RESET

2017-10-13 Thread Willem de Bruijn
From: Willem de Bruijn Implement the reset communication request defined in the VIRTIO 1.0 specification and introduces in Linux in commit c00bbcf862896 ("virtio: add VIRTIO_CONFIG_S_NEEDS_RESET device status bit"). Use the virtnet_reset function introduced in commit

Re: [PATCH] virtio_balloon: fix deadlock on OOM

2017-10-13 Thread Tetsuo Handa
Michael S. Tsirkin wrote: > This is a replacement for > [PATCH] virtio: avoid possible OOM lockup at virtballoon_oom_notify() > but unlike that patch it actually deflates on oom even in presence of > lock contention. But Wei Wang is proposing VIRTIO_BALLOON_F_SG which will try to allocate

Re: [PATCH] virtio_balloon: fix deadlock on OOM

2017-10-13 Thread Michal Hocko
On Fri 13-10-17 16:21:22, Michael S. Tsirkin wrote: > fill_balloon doing memory allocations under balloon_lock > can cause a deadlock when leak_balloon is called from > virtballoon_oom_notify and tries to take same lock. > > To fix, split page allocation and enqueue and do allocations outside the

Re: [PATCH v16 5/5] virtio-balloon: VIRTIO_BALLOON_F_CTRL_VQ

2017-10-13 Thread Michael S. Tsirkin
On Thu, Oct 12, 2017 at 11:54:56AM +0800, Wei Wang wrote: > > But I think flushing is very fragile. You will easily run into races > > if one of the actors gets out of sync and keeps adding data. > > I think adding an ID in the free vq stream is a more robust > > approach. > > > > Adding ID to

Re: [PATCH] virtio: avoid possible OOM lockup at virtballoon_oom_notify()

2017-10-13 Thread Michael S. Tsirkin
On Tue, Oct 10, 2017 at 07:47:37PM +0900, Tetsuo Handa wrote: > In leak_balloon(), mutex_lock(>balloon_lock) is called in order to > serialize against fill_balloon(). But in fill_balloon(), > alloc_page(GFP_HIGHUSER[_MOVABLE] | __GFP_NOMEMALLOC | __GFP_NORETRY) is > called with vb->balloon_lock

[PATCH] virtio_balloon: fix deadlock on OOM

2017-10-13 Thread Michael S. Tsirkin
fill_balloon doing memory allocations under balloon_lock can cause a deadlock when leak_balloon is called from virtballoon_oom_notify and tries to take same lock. To fix, split page allocation and enqueue and do allocations outside the lock. Here's a detailed analysis of the deadlock by Tetsuo

Re: [PATCH] virtio: avoid possible OOM lockup at virtballoon_oom_notify()

2017-10-13 Thread Michael S. Tsirkin
On Fri, Oct 13, 2017 at 08:28:37PM +0900, Tetsuo Handa wrote: > Michael, will you pick up this patch? > -- > >From 210dba24134e54cd470e79712c5cb8bb255566c0 Mon Sep 17 00:00:00 2001 > From: Tetsuo Handa > Date: Tue, 10 Oct 2017 19:28:20 +0900 > Subject: