From: Wanlong Gao <gaowanlong@cn.fujitsu.com>
To: Asias He <asias@redhat.com>
Cc: 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, pbonzini@redhat.com
Subject: Re: [PATCH V6 5/5] virtio-scsi: reset virtqueue affinity when doing cpu hotplug
Date: Wed, 20 Mar 2013 15:33:10 +0800 [thread overview]
Message-ID: <51496636.8040000@cn.fujitsu.com> (raw)
In-Reply-To: <20130320072425.GA23182@hj.localdomain>
On 03/20/2013 03:24 PM, Asias He wrote:
> On Wed, Mar 20, 2013 at 03:01:24PM +0800, Wanlong Gao wrote:
>> Add hot cpu notifier to reset the request virtqueue affinity
>> when doing cpu hotplug.
>>
>> Cc: linux-scsi@vger.kernel.org
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
>> Reviewed-by: Asias He <asias@redhat.com>
>> ---
>> drivers/scsi/virtio_scsi.c | 29 +++++++++++++++++++++++++++++
>> 1 file changed, 29 insertions(+)
>>
>> diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
>> index 13d7672..0ad9017 100644
>> --- a/drivers/scsi/virtio_scsi.c
>> +++ b/drivers/scsi/virtio_scsi.c
>> @@ -110,6 +110,9 @@ struct virtio_scsi {
>> /* if the affinity hint is set for virtqueues */
>> bool affinity_hint_set;
>>
>> + /* CPU hotplug notifier */
>> + struct notifier_block nb;
>> +
>> struct virtio_scsi_vq ctrl_vq;
>> struct virtio_scsi_vq event_vq;
>> struct virtio_scsi_vq req_vqs[];
>> @@ -762,6 +765,23 @@ static void virtscsi_set_affinity(struct virtio_scsi *vscsi, bool affinity)
>> put_online_cpus();
>> }
>>
>> +static int virtscsi_cpu_callback(struct notifier_block *nfb,
>> + unsigned long action, void *hcpu)
>> +{
>> + struct virtio_scsi *vscsi = container_of(nfb, struct virtio_scsi, nb);
>> + switch(action) {
>> + case CPU_ONLINE:
>> + case CPU_ONLINE_FROZEN:
>> + case CPU_DEAD:
>> + case CPU_DEAD_FROZEN:
>> + __virtscsi_set_affinity(vscsi, true);
>> + break;
>> + default:
>> + break;
>> + }
>> + return NOTIFY_OK;
>> +}
>> +
>> static void virtscsi_init_vq(struct virtio_scsi_vq *virtscsi_vq,
>> struct virtqueue *vq)
>> {
>> @@ -884,6 +904,13 @@ static int virtscsi_probe(struct virtio_device *vdev)
>> if (err)
>> goto virtscsi_init_failed;
>>
>> + vscsi->nb.notifier_call = &virtscsi_cpu_callback;
>> + err = register_hotcpu_notifier(&vscsi->nb);
>> + if (err) {
>> + pr_err("registering cpu notifier failed\n");
>> + goto scsi_add_host_failed;
>> + }
>> +
>> cmd_per_lun = virtscsi_config_get(vdev, cmd_per_lun) ?: 1;
>> shost->cmd_per_lun = min_t(u32, cmd_per_lun, shost->can_queue);
>> shost->max_sectors = virtscsi_config_get(vdev, max_sectors) ?: 0xFFFF;
>> @@ -921,6 +948,8 @@ static void virtscsi_remove(struct virtio_device *vdev)
>>
>> scsi_remove_host(shost);
>>
>> + unregister_hotcpu_notifier(&vscsi->nb);
>> +
>> virtscsi_remove_vqs(vdev);
>> scsi_host_put(shost);
>> }
>> --
>> 1.8.2.rc2
>>
>
> This one does not apply on top of virtio-next + patch 1-4 in this series.
Oops, it's my fault. There may be something wrong here. But you can use "3-way merge"
to apply them, I'll take care next time.
Thanks,
Wanlong Gao
>
next prev parent reply other threads:[~2013-03-20 7:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-20 7:01 [PATCH V6 0/5] virtio-scsi multiqueue Wanlong Gao
2013-03-20 7:01 ` [PATCH V6 1/5] virtio-scsi: redo allocation of target data Wanlong Gao
2013-03-20 7:33 ` Asias He
2013-03-20 7:01 ` [PATCH V6 2/5] virtio-scsi: pass struct virtio_scsi to virtqueue completion function Wanlong Gao
2013-03-20 7:01 ` [PATCH V6 3/5] virtio-scsi: push vq lock/unlock into virtscsi_vq_done Wanlong Gao
2013-03-20 7:01 ` [PATCH V6 4/5] virtio-scsi: introduce multiqueue support Wanlong Gao
2013-03-20 21:22 ` Venkatesh Srinivas
2013-03-20 7:01 ` [PATCH V6 5/5] virtio-scsi: reset virtqueue affinity when doing cpu hotplug Wanlong Gao
2013-03-20 7:24 ` Asias He
2013-03-20 7:33 ` Wanlong Gao [this message]
2013-03-20 7:56 ` Wanlong Gao
2013-03-23 6:36 ` Paolo Bonzini
2013-03-23 11:16 ` Wanlong Gao
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=51496636.8040000@cn.fujitsu.com \
--to=gaowanlong@cn.fujitsu.com \
--cc=JBottomley@parallels.com \
--cc=asias@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mst@redhat.com \
--cc=pbonzini@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).