All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Bart Van Assche <bvanassche@acm.org>
Cc: kvm@vger.kernel.org, linux-scsi@vger.kernel.org, mst@redhat.com,
	linux-kernel@vger.kernel.org, JBottomley@parallels.com,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH V7 4/5] virtio-scsi: introduce multiqueue support
Date: Mon, 25 Mar 2013 15:27:30 +0100	[thread overview]
Message-ID: <51505ED2.70208@redhat.com> (raw)
In-Reply-To: <514FFC06.9030703@acm.org>

Il 25/03/2013 08:25, Bart Van Assche ha scritto:
>>
>> +        queue_num = smp_processor_id();
>> +        while (unlikely(queue_num >= vscsi->num_queues))
>> +            queue_num -= vscsi->num_queues;
>> +
>> +        tgt->req_vq = vq = &vscsi->req_vqs[queue_num];
>> +    }
>> +
>> +    spin_unlock_irqrestore(&tgt->tgt_lock, flags);
>> +    return vq;
>> +}
> 
> Is there any reason why the smp_processor_id() % vscsi->num_queues
> computation in virtscsi_pick_vq() has been implemented as a loop instead
> of as an arithmetic operation ? If so, I would appreciate it if that
> could be explained in a comment.

The expectation is that vscsi->num_queues is the same as the number of
CPUs in the virtual machine; see patch 5 too.

Paolo

WARNING: multiple messages have this Message-ID (diff)
From: Paolo Bonzini <pbonzini@redhat.com>
To: Bart Van Assche <bvanassche@acm.org>
Cc: Wanlong Gao <gaowanlong@cn.fujitsu.com>,
	linux-scsi@vger.kernel.org, kvm@vger.kernel.org, mst@redhat.com,
	linux-kernel@vger.kernel.org, JBottomley@parallels.com,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH V7 4/5] virtio-scsi: introduce multiqueue support
Date: Mon, 25 Mar 2013 15:27:30 +0100	[thread overview]
Message-ID: <51505ED2.70208@redhat.com> (raw)
In-Reply-To: <514FFC06.9030703@acm.org>

Il 25/03/2013 08:25, Bart Van Assche ha scritto:
>>
>> +        queue_num = smp_processor_id();
>> +        while (unlikely(queue_num >= vscsi->num_queues))
>> +            queue_num -= vscsi->num_queues;
>> +
>> +        tgt->req_vq = vq = &vscsi->req_vqs[queue_num];
>> +    }
>> +
>> +    spin_unlock_irqrestore(&tgt->tgt_lock, flags);
>> +    return vq;
>> +}
> 
> Is there any reason why the smp_processor_id() % vscsi->num_queues
> computation in virtscsi_pick_vq() has been implemented as a loop instead
> of as an arithmetic operation ? If so, I would appreciate it if that
> could be explained in a comment.

The expectation is that vscsi->num_queues is the same as the number of
CPUs in the virtual machine; see patch 5 too.

Paolo

  reply	other threads:[~2013-03-25 14:27 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-23 11:28 [PATCH V7 0/5] virtio-scsi multiqueue Wanlong Gao
2013-03-23 11:28 ` Wanlong Gao
2013-03-23 11:28 ` [PATCH V7 1/5] virtio-scsi: redo allocation of target data Wanlong Gao
2013-03-23 11:28   ` Wanlong Gao
2013-03-23 11:28 ` [PATCH V7 2/5] virtio-scsi: pass struct virtio_scsi to virtqueue completion function Wanlong Gao
2013-03-23 11:28   ` Wanlong Gao
2013-03-23 11:28 ` [PATCH V7 3/5] virtio-scsi: push vq lock/unlock into virtscsi_vq_done Wanlong Gao
2013-03-23 11:28   ` Wanlong Gao
2013-03-23 11:28 ` [PATCH V7 4/5] virtio-scsi: introduce multiqueue support Wanlong Gao
2013-03-23 11:28   ` Wanlong Gao
2013-03-25  7:25   ` Bart Van Assche
2013-03-25  7:25     ` Bart Van Assche
2013-03-25 14:27     ` Paolo Bonzini [this message]
2013-03-25 14:27       ` Paolo Bonzini
2013-03-23 11:28 ` [PATCH V7 5/5] virtio-scsi: reset virtqueue affinity when doing cpu hotplug Wanlong Gao
2013-03-23 11:28   ` Wanlong Gao
2013-03-28  2:22 ` [PATCH V7 0/5] virtio-scsi multiqueue Wanlong Gao
2013-03-28  2:22   ` Wanlong Gao
2013-04-05  8:55   ` Wanlong Gao
2013-04-05  8:55     ` Wanlong Gao
2013-04-06  8:40     ` James Bottomley
2013-04-06 10:14       ` Wanlong Gao
2013-04-06 10:14         ` Wanlong Gao
2013-04-07  2:01       ` Asias He
2013-04-07  2:01         ` Asias He
2013-04-08 13:36         ` Rusty Russell
2013-04-08 13:36         ` Rusty Russell

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=51505ED2.70208@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=JBottomley@parallels.com \
    --cc=bvanassche@acm.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.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 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.