Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: gregkh@linuxfoundation.org
Cc: lvivier@redhat.com, mst@redhat.com, stable@vger.kernel.org
Subject: Re: FAILED: patch "[PATCH] virtio_console: allocate inbufs in add_port() only if it is" failed to apply to 4.9-stable tree
Date: Tue, 26 Nov 2019 21:14:06 -0500	[thread overview]
Message-ID: <20191127021406.GL5861@sasha-vm> (raw)
In-Reply-To: <15747038452146@kroah.com>

On Mon, Nov 25, 2019 at 06:44:05PM +0100, gregkh@linuxfoundation.org wrote:
>
>The patch below does not apply to the 4.9-stable tree.
>If someone wants it applied there, or to any other stable or longterm
>tree, then please email the backport, including the original git commit
>id to <stable@vger.kernel.org>.
>
>thanks,
>
>greg k-h
>
>------------------ original commit in Linus's tree ------------------
>
>From d791cfcbf98191122af70b053a21075cb450d119 Mon Sep 17 00:00:00 2001
>From: Laurent Vivier <lvivier@redhat.com>
>Date: Thu, 14 Nov 2019 13:25:48 +0100
>Subject: [PATCH] virtio_console: allocate inbufs in add_port() only if it is
> needed
>
>When we hot unplug a virtserialport and then try to hot plug again,
>it fails:
>
>(qemu) chardev-add socket,id=serial0,path=/tmp/serial0,server,nowait
>(qemu) device_add virtserialport,bus=virtio-serial0.0,nr=2,\
>                  chardev=serial0,id=serial0,name=serial0
>(qemu) device_del serial0
>(qemu) device_add virtserialport,bus=virtio-serial0.0,nr=2,\
>                  chardev=serial0,id=serial0,name=serial0
>kernel error:
>  virtio-ports vport2p2: Error allocating inbufs
>qemu error:
>  virtio-serial-bus: Guest failure in adding port 2 for device \
>                     virtio-serial0.0
>
>This happens because buffers for the in_vq are allocated when the port is
>added but are not released when the port is unplugged.
>
>They are only released when virtconsole is removed (see a7a69ec0d8e4)
>
>To avoid the problem and to be symmetric, we could allocate all the buffers
>in init_vqs() as they are released in remove_vqs(), but it sounds like
>a waste of memory.
>
>Rather than that, this patch changes add_port() logic to ignore ENOSPC
>error in fill_queue(), which means queue has already been filled.
>
>Fixes: a7a69ec0d8e4 ("virtio_console: free buffers after reset")
>Cc: mst@redhat.com
>Cc: stable@vger.kernel.org
>Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

I took the following two commits as well and queued all 3 for 4.9 and
4.4:

2855b33514d2 ("virtio_console: don't tie bufs to a vq")
5c60300d68da ("virtio_console: reset on out of memory")

-- 
Thanks,
Sasha

      reply	other threads:[~2019-11-27  2:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-25 17:44 FAILED: patch "[PATCH] virtio_console: allocate inbufs in add_port() only if it is" failed to apply to 4.9-stable tree gregkh
2019-11-27  2:14 ` Sasha Levin [this message]

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=20191127021406.GL5861@sasha-vm \
    --to=sashal@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=lvivier@redhat.com \
    --cc=mst@redhat.com \
    --cc=stable@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox