All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amit Shah <amit.shah@redhat.com>
To: zanghongyong@huawei.com
Cc: aliguori@us.ibm.com, kvm@vger.kernel.org, wusongwei@huawei.com,
	hanweidong@huawei.com,
	Virtualization List <virtualization@lists.linux-foundation.org>,
	xiaowei.yang@huawei.com, "Michael S. Tsirkin" <mst@redhat.com>,
	jiangningyu@huawei.com
Subject: Re: [PATCH 1/2] virtio-pci: add setup_vqs flag in vp_try_to_find_vqs
Date: Wed, 1 Feb 2012 13:44:10 +0530	[thread overview]
Message-ID: <20120201081410.GE24943@amit.redhat.com> (raw)
In-Reply-To: <1326331207-10339-2-git-send-email-zanghongyong@huawei.com>

Michael, Rusty, any comments?

On (Thu) 12 Jan 2012 [09:20:06], zanghongyong@huawei.com wrote:
> From: Hongyong Zang <zanghongyong@huawei.com>
> 
> changes in vp_try_to_find_vqs:
> Virtio-serial's probe() calls it to request irqs and setup vqs of port0 and
> controls; add_port() calls it to set up vqs of io_port.
> it will not create virtqueue if the name is null.
> 
> Signed-off-by: Hongyong Zang <zanghongyong@huawei.com>
> ---
>  drivers/virtio/virtio_pci.c |   17 +++++++++++++----
>  1 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
> index baabb79..1f98c36 100644
> --- a/drivers/virtio/virtio_pci.c
> +++ b/drivers/virtio/virtio_pci.c
> @@ -492,9 +492,11 @@ static void vp_del_vqs(struct virtio_device *vdev)
>  	list_for_each_entry_safe(vq, n, &vdev->vqs, list) {
>  		info = vq->priv;
>  		if (vp_dev->per_vq_vectors &&
> -			info->msix_vector != VIRTIO_MSI_NO_VECTOR)
> +			info->msix_vector != VIRTIO_MSI_NO_VECTOR) {
>  			free_irq(vp_dev->msix_entries[info->msix_vector].vector,
>  				 vq);
> +			vp_dev->msix_used_vectors--;
> +		}
>  		vp_del_vq(vq);
>  	}
>  	vp_dev->per_vq_vectors = false;
> @@ -511,7 +513,10 @@ static int vp_try_to_find_vqs(struct virtio_device *vdev, unsigned nvqs,
>  {
>  	struct virtio_pci_device *vp_dev = to_vp_device(vdev);
>  	u16 msix_vec;
> -	int i, err, nvectors, allocated_vectors;
> +	int i, err, nvectors;
> +
> +	if (vp_dev->msix_used_vectors)
> +		goto setup_vqs;
>  
>  	if (!use_msix) {
>  		/* Old style: one normal interrupt for change and all vqs. */
> @@ -536,12 +541,16 @@ static int vp_try_to_find_vqs(struct virtio_device *vdev, unsigned nvqs,
>  	}
>  
>  	vp_dev->per_vq_vectors = per_vq_vectors;
> -	allocated_vectors = vp_dev->msix_used_vectors;
> +
> +setup_vqs:
>  	for (i = 0; i < nvqs; ++i) {
> +		if (names[i] == NULL)
> +			continue;
> +
>  		if (!callbacks[i] || !vp_dev->msix_enabled)
>  			msix_vec = VIRTIO_MSI_NO_VECTOR;
>  		else if (vp_dev->per_vq_vectors)
> -			msix_vec = allocated_vectors++;
> +			msix_vec = vp_dev->msix_used_vectors++;
>  		else
>  			msix_vec = VP_MSIX_VQ_VECTOR;
>  		vqs[i] = setup_vq(vdev, i, callbacks[i], names[i], msix_vec);
> -- 
> 1.7.1
> 

		Amit

  reply	other threads:[~2012-02-01  8:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-12  1:20 [PATCH 0/2] virtio-serial: set up vqs on demand zanghongyong
2012-01-12  1:20 ` [PATCH 1/2] virtio-pci: add setup_vqs flag in vp_try_to_find_vqs zanghongyong
2012-02-01  8:14   ` Amit Shah [this message]
2012-02-01  9:54   ` Michael S. Tsirkin
2012-02-03  3:56     ` Rusty Russell
2012-01-12  1:20 ` [PATCH 2/2] virtio-serial: setup_port_vq when adding port zanghongyong
2012-02-01  8:12   ` Amit Shah
2012-02-01  9:32     ` Zang Hongyong
2012-02-01  9:40 ` [PATCH 0/2] virtio-serial: set up vqs on demand Michael S. Tsirkin
2013-04-08  7:51 ` Amit Shah

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=20120201081410.GE24943@amit.redhat.com \
    --to=amit.shah@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=hanweidong@huawei.com \
    --cc=jiangningyu@huawei.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=wusongwei@huawei.com \
    --cc=xiaowei.yang@huawei.com \
    --cc=zanghongyong@huawei.com \
    /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.