Received: by 10.192.165.148 with SMTP id m20csp1085393imm; Sat, 21 Apr 2018 00:33:30 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/RiA8X+Bb1xkE7/abaCpfLqnlbCRbTl9zCiciU/xvnttF5Yjx3L10KR15PxkCbX8Uxptf4 X-Received: by 10.98.242.67 with SMTP id y3mr9179284pfl.159.1524296010035; Sat, 21 Apr 2018 00:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524296009; cv=none; d=google.com; s=arc-20160816; b=0KFatM2zy4glgY0iHpaUj45gSZKs041mJorGqFtugRV3ymitc1oXe8WS+GD+6IuGTj KKV6Abno6k1ZReFqHPa/fydFh3ukExLAIqcHdFxu2Q9Btdfph8T/rFPWvXr/96ql4fzX 2JkFLdJJPuRKNfSit/9wh7uEbVbRdQonZZu3p8LSgPfChDbQRMzIWaGp9vUF9nDvM+Rj GaocGd75hDMmfwp0gdGJsYW4r0mT0LJ/qgtPN54UqzEoDYya0nBAWaB/ze6RShk0GAe+ jCX4dRT2JkWPo2YrAn+aKMi97yyjq+dKGd8VHXSR9kvTz8y/GIfPxqEbeUjE7qY7/uh8 ckBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=sCxNG4Wv9NSX0XkBjOn6psffQZsb6NzTi2oaJ3zisms=; b=isFGMrTDkm4lOj3iCuwYHAutjf8usmPZhkz7HRx/pRG1LGlXljgT7wzJgpd3LXql/y ItsMEgi6/NhQ30o65xEepXFS+UTQjStX81FoXWbYbepKwbErJhxzMigWb9LymPuUVSaO ZCvk4s6fB0XkM3u654/bZMnYXAkyL3m6FwDikh+aGS0yuFNaElvs+0pmScnCI0r4xEyv ND2hNdHi0hHDeaS2uNOazilHvps+tZmuaoNpbY1M9IfqCyxhQfx8f0vT8WnbD2Kfx3qJ 5fa/kaB4en3v59+PdcMYFvbPBYEw2bo7ZJNdIr06ifz28PceyB1Xas8vCckB0HP5DH10 F0cw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h6-v6si6861055pll.40.2018.04.21.00.32.52; Sat, 21 Apr 2018 00:33:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752241AbeDUHaN (ORCPT + 99 others); Sat, 21 Apr 2018 03:30:13 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:54142 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750931AbeDUHaM (ORCPT ); Sat, 21 Apr 2018 03:30:12 -0400 Received: from localhost (ip-213-127-148-58.ip.prioritytelecom.net [213.127.148.58]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 2921ACD8; Sat, 21 Apr 2018 07:30:11 +0000 (UTC) Date: Sat, 21 Apr 2018 09:30:05 +0200 From: Greg Kroah-Hartman To: "Michael S. Tsirkin" Cc: linux-kernel@vger.kernel.org, Amit Shah , Arnd Bergmann , virtualization@lists.linux-foundation.org, stable@vger.kernel.org, Tiwei Bie , Jason Wang Subject: Re: [PATCH 1/6] virtio_console: don't tie bufs to a vq Message-ID: <20180421073005.GA3744@kroah.com> References: <1524248223-393618-1-git-send-email-mst@redhat.com> <1524248223-393618-2-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1524248223-393618-2-git-send-email-mst@redhat.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 20, 2018 at 09:18:01PM +0300, Michael S. Tsirkin wrote: > an allocated buffer doesn't need to be tied to a vq - > only vq->vdev is ever used. Pass the function the > just what it needs - the vdev. > > Signed-off-by: Michael S. Tsirkin > --- > drivers/char/virtio_console.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c > index 468f061..3e56f32 100644 > --- a/drivers/char/virtio_console.c > +++ b/drivers/char/virtio_console.c > @@ -422,7 +422,7 @@ static void reclaim_dma_bufs(void) > } > } > > -static struct port_buffer *alloc_buf(struct virtqueue *vq, size_t buf_size, > +static struct port_buffer *alloc_buf(struct virtio_device *vdev, size_t buf_size, > int pages) > { > struct port_buffer *buf; > @@ -445,16 +445,16 @@ static struct port_buffer *alloc_buf(struct virtqueue *vq, size_t buf_size, > return buf; > } > > - if (is_rproc_serial(vq->vdev)) { > + if (is_rproc_serial(vdev)) { > /* > * Allocate DMA memory from ancestor. When a virtio > * device is created by remoteproc, the DMA memory is > * associated with the grandparent device: > * vdev => rproc => platform-dev. > */ > - if (!vq->vdev->dev.parent || !vq->vdev->dev.parent->parent) > + if (!vdev->dev.parent || !vdev->dev.parent->parent) > goto free_buf; > - buf->dev = vq->vdev->dev.parent->parent; > + buf->dev = vdev->dev.parent->parent; > > /* Increase device refcnt to avoid freeing it */ > get_device(buf->dev); > @@ -838,7 +838,7 @@ static ssize_t port_fops_write(struct file *filp, const char __user *ubuf, > > count = min((size_t)(32 * 1024), count); > > - buf = alloc_buf(port->out_vq, count, 0); > + buf = alloc_buf(port->portdev->vdev, count, 0); > if (!buf) > return -ENOMEM; > > @@ -957,7 +957,7 @@ static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe, > if (ret < 0) > goto error_out; > > - buf = alloc_buf(port->out_vq, 0, pipe->nrbufs); > + buf = alloc_buf(port->portdev->vdev, 0, pipe->nrbufs); > if (!buf) { > ret = -ENOMEM; > goto error_out; > @@ -1374,7 +1374,7 @@ static unsigned int fill_queue(struct virtqueue *vq, spinlock_t *lock) > > nr_added_bufs = 0; > do { > - buf = alloc_buf(vq, PAGE_SIZE, 0); > + buf = alloc_buf(vq->vdev, PAGE_SIZE, 0); > if (!buf) > break; > > -- > MST This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read: https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html for how to do this properly.