From: Cong Meng <mc@linux.vnet.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: stefanha@linux.vnet.ibm.com, zwanp@cn.ibm.com,
linuxram@us.ibm.com, qemu-devel@nongnu.org,
virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 1/2 v1] blkdrv: Add queue limits parameters for sg block drive
Date: Tue, 21 Aug 2012 17:41:06 +0800 [thread overview]
Message-ID: <503357B2.5040901@linux.vnet.ibm.com> (raw)
In-Reply-To: <50334B51.6050900@redhat.com>
On Tue 21 Aug 2012 04:48:17 PM CST, Paolo Bonzini wrote:
> Il 21/08/2012 10:23, Cong Meng ha scritto:
>> +static void sg_get_queue_limits(BlockDriverState *bs, const char *filename)
>> +{
>> + DIR *ffs;
>> + struct dirent *d;
>> + char path[MAXPATHLEN];
>> +
>> + snprintf(path, MAXPATHLEN,
>> + "/sys/class/scsi_generic/sg%s/device/block/",
>> + filename + strlen("/dev/sg"));
>> +
>> + ffs = opendir(path);
>> + if (!ffs) {
>> + return;
>> + }
>> +
>> + for (;;) {
>> + d = readdir(ffs);
>> + if (!d) {
>> + return;
>> + }
>> +
>> + if (strcmp(d->d_name, ".") == 0 || strcmp(d->d_name, "..") == 0) {
>> + continue;
>> + }
>> +
>> + break;
>> + }
>> +
>> + closedir(ffs);
>> +
>> + pstrcat(path, MAXPATHLEN, d->d_name);
>> + pstrcat(path, MAXPATHLEN, "/queue/");
>> +
>> + read_queue_limit(path, "max_sectors_kb", &bs->max_sectors);
>> + read_queue_limit(path, "max_segments", &bs->max_segments);
>> + read_queue_limit(path, "max_segment_size", &bs->max_segment_size);
>> +}
>
> Using /sys/dev/block or /sys/dev/char seems easier, and lets you
> retrieve the parameters for block devices too.
>
what do you mean with "block devices"? Using "/dev/sda" instead of
"/dev/sg0"?
> However, I'm worried of the consequences this has for migration. You
> could have the same physical disk accessed with two different HBAs, with
> different limits. So I don't know if this can really be solved at all.
>
I know little about qemu migration now. The pending scsi commands will
be saved and
transfered to remote machine when starting migration?
Cong.
> Paolo
>
WARNING: multiple messages have this Message-ID (diff)
From: Cong Meng <mc@linux.vnet.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
stefanha@linux.vnet.ibm.com, zwanp@cn.ibm.com,
Rusty Russell <rusty@rustcorp.com.au>,
linuxram@us.ibm.com, qemu-devel@nongnu.org,
virtualization@lists.linux-foundation.org
Subject: Re: [Qemu-devel] [PATCH 1/2 v1] blkdrv: Add queue limits parameters for sg block drive
Date: Tue, 21 Aug 2012 17:41:06 +0800 [thread overview]
Message-ID: <503357B2.5040901@linux.vnet.ibm.com> (raw)
In-Reply-To: <50334B51.6050900@redhat.com>
On Tue 21 Aug 2012 04:48:17 PM CST, Paolo Bonzini wrote:
> Il 21/08/2012 10:23, Cong Meng ha scritto:
>> +static void sg_get_queue_limits(BlockDriverState *bs, const char *filename)
>> +{
>> + DIR *ffs;
>> + struct dirent *d;
>> + char path[MAXPATHLEN];
>> +
>> + snprintf(path, MAXPATHLEN,
>> + "/sys/class/scsi_generic/sg%s/device/block/",
>> + filename + strlen("/dev/sg"));
>> +
>> + ffs = opendir(path);
>> + if (!ffs) {
>> + return;
>> + }
>> +
>> + for (;;) {
>> + d = readdir(ffs);
>> + if (!d) {
>> + return;
>> + }
>> +
>> + if (strcmp(d->d_name, ".") == 0 || strcmp(d->d_name, "..") == 0) {
>> + continue;
>> + }
>> +
>> + break;
>> + }
>> +
>> + closedir(ffs);
>> +
>> + pstrcat(path, MAXPATHLEN, d->d_name);
>> + pstrcat(path, MAXPATHLEN, "/queue/");
>> +
>> + read_queue_limit(path, "max_sectors_kb", &bs->max_sectors);
>> + read_queue_limit(path, "max_segments", &bs->max_segments);
>> + read_queue_limit(path, "max_segment_size", &bs->max_segment_size);
>> +}
>
> Using /sys/dev/block or /sys/dev/char seems easier, and lets you
> retrieve the parameters for block devices too.
>
what do you mean with "block devices"? Using "/dev/sda" instead of
"/dev/sg0"?
> However, I'm worried of the consequences this has for migration. You
> could have the same physical disk accessed with two different HBAs, with
> different limits. So I don't know if this can really be solved at all.
>
I know little about qemu migration now. The pending scsi commands will
be saved and
transfered to remote machine when starting migration?
Cong.
> Paolo
>
next prev parent reply other threads:[~2012-08-21 9:41 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-21 8:23 [PATCH 1/2 v1] blkdrv: Add queue limits parameters for sg block drive Cong Meng
2012-08-21 8:23 ` [Qemu-devel] " Cong Meng
2012-08-21 8:23 ` [PATCH 2/2 v1] virtio-scsi: set per-LUN queue limits for sg devices Cong Meng
2012-08-21 8:23 ` [Qemu-devel] " Cong Meng
2012-08-21 9:56 ` Stefan Hajnoczi
2012-08-21 9:56 ` [Qemu-devel] " Stefan Hajnoczi
2012-08-21 8:48 ` [PATCH 1/2 v1] blkdrv: Add queue limits parameters for sg block drive Paolo Bonzini
2012-08-21 8:48 ` [Qemu-devel] " Paolo Bonzini
2012-08-21 9:41 ` Cong Meng [this message]
2012-08-21 9:41 ` Cong Meng
2012-08-21 9:52 ` Stefan Hajnoczi
2012-08-21 9:52 ` [Qemu-devel] " Stefan Hajnoczi
2012-08-21 10:14 ` Paolo Bonzini
2012-08-21 10:14 ` [Qemu-devel] " Paolo Bonzini
2012-08-22 11:04 ` Cong Meng
2012-08-22 11:04 ` [Qemu-devel] " Cong Meng
2012-08-22 12:09 ` Paolo Bonzini
2012-08-22 12:09 ` [Qemu-devel] " Paolo Bonzini
2012-08-22 13:13 ` Stefan Hajnoczi
2012-08-22 13:13 ` [Qemu-devel] " Stefan Hajnoczi
2012-08-22 14:13 ` Paolo Bonzini
2012-08-22 14:13 ` [Qemu-devel] " Paolo Bonzini
2012-08-23 9:31 ` Cong Meng
2012-08-23 9:31 ` [Qemu-devel] " Cong Meng
2012-08-23 10:03 ` Paolo Bonzini
2012-08-23 10:03 ` [Qemu-devel] " Paolo Bonzini
2012-08-23 10:08 ` Stefan Hajnoczi
2012-08-23 10:08 ` [Qemu-devel] " Stefan Hajnoczi
2012-08-23 10:52 ` Paolo Bonzini
2012-08-23 10:52 ` [Qemu-devel] " Paolo Bonzini
2012-08-23 12:08 ` Stefan Hajnoczi
2012-08-23 12:08 ` [Qemu-devel] " Stefan Hajnoczi
2012-08-24 0:45 ` Nicholas A. Bellinger
2012-08-24 7:56 ` Paolo Bonzini
2012-08-24 7:56 ` [Qemu-devel] " Paolo Bonzini
2012-08-24 10:43 ` Hannes Reinecke
2012-08-24 10:43 ` [Qemu-devel] " Hannes Reinecke
2012-08-24 9:05 ` Stefan Hajnoczi
2012-08-24 9:05 ` [Qemu-devel] " Stefan Hajnoczi
2012-08-24 9:14 ` Paolo Bonzini
2012-08-24 9:14 ` [Qemu-devel] " Paolo Bonzini
2012-08-24 0:45 ` Nicholas A. Bellinger
2012-08-21 9:49 ` Stefan Hajnoczi
2012-08-21 9:49 ` [Qemu-devel] " Stefan Hajnoczi
2012-08-21 18:31 ` Blue Swirl
2012-08-21 18:31 ` Blue Swirl
2012-08-22 8:25 ` Stefan Hajnoczi
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=503357B2.5040901@linux.vnet.ibm.com \
--to=mc@linux.vnet.ibm.com \
--cc=linuxram@us.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=zwanp@cn.ibm.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.