Skip to contentSkip to conversation

xl block-attach vs block-detach

DISCUSSION Jan Beulich 5 participants 22 messages Mar 1, 2012 – Mar 5, 2012

lore
Share & tools
lore
#0 lore raw

So it seems that "xl block-attach" allows a variety of ways to specify the devices ID (xvdN, dNpN, decimal or hex number) - why is it that the inverse operation ("xl block-detach") can't deal with anything by a decimal number?

Further, why is it that with no blktap module loaded I'm getting an incomplete attach when using the (deprecated) file:/ format for specifying the backing file? It reports that it would be using qdisk, and blkfront also sees the device appearing, but all I'm seeing in the kernel log is the single message from blkfront's probe function. (With no blktap in pv-ops, I wonder how file backed disks work there.) When trying to detach such a broken device I'm getting "unrecognized disk backend type: 0", and the remove fails.

Jan

#1 lore raw
Quoted 4 lines · Jan Beulich

So it seems that "xl block-attach" allows a variety of ways to specify the devices ID (xvdN, dNpN, decimal or hex number) - why is it that the inverse operation ("xl block-detach") can't deal with anything by a decimal number?

Just an omission?

Quoted 5 lines

Further, why is it that with no blktap module loaded I'm getting an incomplete attach when using the (deprecated) file:/ format for specifying the backing file? It reports that it would be using qdisk, and blkfront also sees the device appearing, but all I'm seeing in the kernel log is the single message from blkfront's probe function.

What do you mean by "incomplete"? What else would you expect to see?

What do the xenstore entries for the device look like?

Quoted 1 line

(With no blktap in pv-ops, I wonder how file backed disks work there.)

file backed disks without blktap use the qdisk backend supplied by qemu.

Quoted 2 lines

When trying to detach such a broken device I'm getting "unrecognized disk backend type: 0", and the remove fails.

What version of xen is this?

libxl__device_disk_from_xs_be tries to read the backend type from xenstore, the be "type" node. Is that present for you?

libxl_string_to_backend looks a bit suspect to me...

Ian.

#2 lore raw
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 4 lines · Jan Beulich

So it seems that "xl block-attach" allows a variety of ways to specify the devices ID (xvdN, dNpN, decimal or hex number) - why is it that the inverse operation ("xl block-detach") can't deal with anything by a decimal number?

Just an omission?

Maybe. How many else are there throughout the xl stack then? (I'm asking because any time I do something more advanced than "xl dmesg" or "xl debug-key ..." with xl, I'm running into endless problems.

Quoted 7 lines
Quoted 5 lines

Further, why is it that with no blktap module loaded I'm getting an incomplete attach when using the (deprecated) file:/ format for specifying the backing file? It reports that it would be using qdisk, and blkfront also sees the device appearing, but all I'm seeing in the kernel log is the single message from blkfront's probe function.

What do you mean by "incomplete"? What else would you expect to see?

Either a fully failed operation (including an error message indicating so even without wading through the -vvv output), or a fully working one (after all, the -vvv messages suggest that a usable backend was selected).

Quoted 1 line

What do the xenstore entries for the device look like?

local = ""
domain = ""
0 = ""
name = "Domain-0"
device = ""

    vbd = ""
     51712 = ""
      backend = "/local/domain/0/backend/qdisk/0/51712"
      backend-id = "0"
      state = "1"
      virtual-device = "51712"
      device-type = "disk"
     51728 = ""
      backend = "/local/domain/0/backend/qdisk/0/51728"
      backend-id = "0"
      state = "3"
      virtual-device = "51728"
      device-type = "disk"
      ring-ref = "9"
      event-channel = "60"
      protocol = "x86_64-abi"
     51760 = ""
      backend = "/local/domain/0/backend/qdisk/0/51760"
      backend-id = "0"
      state = "3"
      virtual-device = "51760"
      device-type = "disk"
      ring-ref = "10"
      event-channel = "61"
      protocol = "x86_64-abi"
   backend = ""
    qdisk = ""
     0 = ""
      51712 = ""
       frontend = "/local/domain/0/device/vbd/51712"
       params = "aio:/srv/SuSE/SLES-11-SP1-MINI-ISO-x86_64-GMC3-CD.iso"
       frontend-id = "0"
       online = "1"
       removable = "0"
       bootable = "1"
       state = "1"
       dev = "xvda"
       type = "qdisk"
       mode = "r"
       device-type = "disk"
      51728 = ""
       frontend = "/local/domain/0/device/vbd/51728"
       params = "aio:/srv/SuSE/SLES-11-SP1-MINI-ISO-x86_64-GMC3-CD.iso"
       frontend-id = "0"
       online = "1"
       removable = "0"
       bootable = "1"
       state = "1"
       dev = "xvdb"
       type = "qdisk"
       mode = "r"
       device-type = "disk"
      51760 = ""
       frontend = "/local/domain/0/device/vbd/51760"
       params = "aio:/srv/SuSE/SLES-11-SP1-MINI-ISO-x86_64-GMC3-CD.iso"
       frontend-id = "0"
       online = "1"
       removable = "0"
       bootable = "1"
       state = "1"
       dev = "d3p0"
       type = "qdisk"
       mode = "r"
       device-type = "disk"
Quoted 3 lines
Quoted 1 line

(With no blktap in pv-ops, I wonder how file backed disks work there.)

file backed disks without blktap use the qdisk backend supplied by qemu.

Which apparently doesn't work (for me).

Quoted 4 lines
Quoted 2 lines

When trying to detach such a broken device I'm getting "unrecognized disk backend type: 0", and the remove fails.

What version of xen is this?

-unstable c/s 24691:3432abcf9380.

I should probably add that I'm running the tools from the build tree, but with xend this never caused any problems after I had added the necessary paths to various environment variables in a wrapper script. I'd expect xl to be similarly tolerable of such an environment, otherwise it's not a drop-in replacement.

Quoted 2 lines

libxl__device_disk_from_xs_be tries to read the backend type from xenstore, the be "type" node. Is that present for you?

See above.

Jan

#3 lore raw
In reply to Ian Campbell
Quoted 10 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 6 lines · Jan Beulich

Further, why is it that with no blktap module loaded I'm getting an incomplete attach when using the (deprecated) file:/ format for specifying the backing file? It reports that it would be using qdisk, and blkfront also sees the device appearing, but all I'm seeing in the kernel log is the single message from blkfront's probe function. (With no blktap in pv-ops, I wonder how file backed disks work there.)

file backed disks without blktap use the qdisk backend supplied by qemu.

What is the rationale for using blkback over blktap for file backed disks anyway? If using blktap, why not directly do so? And if using blkback, why not (as in xend) via loop devices?

Jan

#4 lore raw
Quoted 9 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 6 lines · Jan Beulich

Further, why is it that with no blktap module loaded I'm getting an incomplete attach when using the (deprecated) file:/ format for specifying the backing file? It reports that it would be using qdisk, and blkfront also sees the device appearing, but all I'm seeing in the kernel log is the single message from blkfront's probe function. (With no blktap in pv-ops, I wonder how file backed disks work there.)

Quoted 4 lines
Quoted 1 line

file backed disks without blktap use the qdisk backend supplied by qemu.

What is the rationale for using blkback over blktap for file backed disks anyway? If using blktap, why not directly do so?

"directly" how? blktap always requires a blkback to export it to the guest. The old blktap1 incorporated a disk backend but this lead to duplicated code, complex set up and teardown interlocking and interesting interactions between the "backdev" (which exposed the blktap device to dom0 for toolstack and qemu use) and the pv disk backend. blktap2 was intended to fix those by layering blkback on blktap2, which now just provides a block device in dom0 (blktap2 is almost independent of Xen).

(I originally misread the above and wrote the following, so it's not actually relevant to your questions, but they are perhaps interest facts so I've left them in:...

There is no blktap in upstream kernels and the kernel module is considered non-upstreamable.

If blktap is available then libxl will use it in preference to qdisk.

There are some folks working on a purely userspace blktap ("blktap3" == blktap2 with a userspace disk backend bolted on). I hope this will be ready in time for 4.2 but I'm not sure.

...)

Quoted 1 line

And if using blkback, why not (as in xend) via loop devices?

Support for block device script= in xl/libxl is on the 4.2 blocker list, this feature would re-enable the loop+blkback case -- I think this would be a better option than blktap* or qdisk once it becomes available.

Ian.

#5 lore raw
Quoted 5 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 1 line · Jan Beulich

And if using blkback, why not (as in xend) via loop devices?

Support for block device script= in xl/libxl is on the 4.2 blocker list,

Ah, that's good to know. (However, you mentioning script= makes me assume that one would have to specify this among the block-attach options, which again wouldn't be a drop-in replacement of how xm worked in this regard.)

Quoted 2 lines

this feature would re-enable the loop+blkback case -- I think this would be a better option than blktap* or qdisk once it becomes available.

Jan

#6 lore raw
Quoted 10 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 1 line · Jan Beulich

And if using blkback, why not (as in xend) via loop devices?

Support for block device script= in xl/libxl is on the 4.2 blocker list,

Ah, that's good to know. (However, you mentioning script= makes me assume that one would have to specify this among the block-attach options, which again wouldn't be a drop-in replacement of how xm worked in this regard.)

We could make a decision about the default script to run based on the type of the device and the selected backend.

Quoted 5 lines
Quoted 2 lines

this feature would re-enable the loop+blkback case -- I think this would be a better option than blktap* or qdisk once it becomes available.

Jan

#7 lore raw
In reply to Ian Campbell
Quoted 5 lines · Ian Campbell
Quoted 1 line

And if using blkback, why not (as in xend) via loop devices?

Support for block device script= in xl/libxl is on the 4.2 blocker list, this feature would re-enable the loop+blkback case -- I think this would be a better option than blktap* or qdisk once it becomes available.

Of course we need to make sure that blkback with loop devices performs well before doing that, and it was certainly not the case in my last tests.

#8 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line

On 02.03.12 at 14:49, Stefano Stabellini <[email protected]>

Quoted 9 lines · wrote:
Quoted 5 lines · Ian Campbell
Quoted 1 line

And if using blkback, why not (as in xend) via loop devices?

Support for block device script= in xl/libxl is on the 4.2 blocker list, this feature would re-enable the loop+blkback case -- I think this would be a better option than blktap* or qdisk once it becomes available.

Of course we need to make sure that blkback with loop devices performs well before doing that, and it was certainly not the case in my last tests.

No - no policy should be involved here: If file:/ is specified, one should get blkback alone (no tap, qdisk, or what not. If another protocol was specified, that one should be used. Only if guessing is needed, some sort of heuristic (into which performance considerations may play) will (naturally) be required.

Jan

#9 lore raw
Quoted 9 lines · Jan Beulich
Quoted 1 line
Quoted 1 line
Quoted 1 line

On 02.03.12 at 14:49, Stefano Stabellini <[email protected]>

Quoted 7 lines · wrote:
Quoted 5 lines · Ian Campbell
Quoted 1 line

And if using blkback, why not (as in xend) via loop devices?

Support for block device script= in xl/libxl is on the 4.2 blocker list, this feature would re-enable the loop+blkback case -- I think this would be a better option than blktap* or qdisk once it becomes available.

Quoted 8 lines
Quoted 2 lines

Of course we need to make sure that blkback with loop devices performs well before doing that, and it was certainly not the case in my last tests.

No - no policy should be involved here: If file:/ is specified, one should get blkback alone (no tap, qdisk, or what not. If another protocol was specified, that one should be used. Only if guessing is needed, some sort of heuristic (into which performance considerations may play) will (naturally) be required.

Let's suppose we find out that blkback+loop is slower than qdisk and that block-attach/detach work well with qdisk by the time of the next release.

What would be the rationale behind using blkback+loop for "file:"? Backward compatibility?
Do you think it might break something for users if we change the backend from xend to xl?

On the other hand do you think that using qdisk with the new disk syntax introduced with xl is reasonable because users are not supposed to make any assumptions there?

#10 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line

On 02.03.12 at 15:35, Stefano Stabellini <[email protected]>

Quoted 19 lines · wrote:
Quoted 9 lines · Jan Beulich
Quoted 1 line
Quoted 1 line
Quoted 1 line

On 02.03.12 at 14:49, Stefano Stabellini <[email protected]>

Quoted 7 lines · wrote:
Quoted 5 lines · Ian Campbell
Quoted 1 line

And if using blkback, why not (as in xend) via loop devices?

Support for block device script= in xl/libxl is on the 4.2 blocker list, this feature would re-enable the loop+blkback case -- I think this would be a better option than blktap* or qdisk once it becomes available.

Quoted 8 lines
Quoted 2 lines

Of course we need to make sure that blkback with loop devices performs well before doing that, and it was certainly not the case in my last tests.

No - no policy should be involved here: If file:/ is specified, one should get blkback alone (no tap, qdisk, or what not. If another protocol was specified, that one should be used. Only if guessing is needed, some sort of heuristic (into which performance considerations may play) will (naturally) be required.

Quoted 6 lines

Let's suppose we find out that blkback+loop is slower than qdisk and that block-attach/detach work well with qdisk by the time of the next release.

What would be the rationale behind using blkback+loop for "file:"? Backward compatibility?

Yes.

Quoted 2 lines

Do you think it might break something for users if we change the backend from xend to xl?

This cannot be excluded, particularly because (just like me here) users tend to do things you didn't expect them to when you write the code.

Quoted 3 lines

On the other hand do you think that using qdisk with the new disk syntax introduced with xl is reasonable because users are not supposed to make any assumptions there?

Perhaps yes.

Jan

#11 lore raw
Quoted 11 lines · Jan Beulich
Quoted 2 lines

What would be the rationale behind using blkback+loop for "file:"? Backward compatibility?

Yes.

Quoted 2 lines

Do you think it might break something for users if we change the backend from xend to xl?

This cannot be excluded, particularly because (just like me here) users tend to do things you didn't expect them to when you write the code.

I see your point but actually that is quite an obvious bug, not a very subtle one that only happens in strange user configs.

#12 lore raw
Quoted 9 lines · Stefano Stabellini
Quoted 8 lines · Jan Beulich
Quoted 2 lines

What would be the rationale behind using blkback+loop for "file:"? Backward compatibility?

Yes.

Quoted 2 lines

Do you think it might break something for users if we change the backend from xend to xl?

Quoted 7 lines
Quoted 3 lines

This cannot be excluded, particularly because (just like me here) users tend to do things you didn't expect them to when you write the code.

I see your point but actually that is quite an obvious bug, not a very subtle one that only happens in strange user configs.

Scratch that: I have just tried on Linux 3.3 and the performance of blkback with loopback is very good. We should use it whenever we can.

#13 lore raw

Hi,

As I understand it prefering tapdisk over loop+blkback has never been for performance reasons historically. (tapdisk2:aio does however exhibit very good performance)
The primary reason that tapdisk was always recommended over file: is that the Linux file cache does very interesting things to your data and sync is returned to the blkback backend much sooner than the data actually resides safely on disk (which can sit in the linux disk cache for a sizeable amount of time if they machine has alot of ram).

Unfortunately changing the default behavior to tapdisk probably isn't viable at this time for a number of reasons - not least of which is the fact it is yet to be included in mainline.
However it would definitely be preferable in the long term - atleast from the perspective of data integrity and principle of least surprises.

Just my 2c.

Joseph.

Quoted 25 lines · Stefano Stabellini
Quoted 9 lines · Stefano Stabellini
Quoted 8 lines · Jan Beulich
Quoted 2 lines

What would be the rationale behind using blkback+loop for "file:"? Backward compatibility?

Yes.

Quoted 2 lines

Do you think it might break something for users if we change the backend from xend to xl?

Quoted 7 lines
Quoted 3 lines

This cannot be excluded, particularly because (just like me here) users tend to do things you didn't expect them to when you write the code.

I see your point but actually that is quite an obvious bug, not a very subtle one that only happens in strange user configs.

Scratch that: I have just tried on Linux 3.3 and the performance of blkback with loopback is very good. We should use it whenever we can.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Signature · 3 lines
Founder | Director | VP Research
Orion Virtualisation Solutions | www.orionvm.com.au | Phone: 1300 56
99 52 | Mobile: 0428 754 846
#14 lore raw

Please don't top post, it destroys the flow of the conversation.

Quoted 10 lines · Joseph Glanville

Hi,

As I understand it prefering tapdisk over loop+blkback has never been for performance reasons historically. (tapdisk2:aio does however exhibit very good performance)
The primary reason that tapdisk was always recommended over file: is that the Linux file cache does very interesting things to your data and sync is returned to the blkback backend much sooner than the data actually resides safely on disk (which can sit in the linux disk cache for a sizeable amount of time if they machine has alot of ram).

Are you suggesting that the loop device doesn't support O_DIRECT and will leave stuff dirty in the page cache even when direct access is used? That is worth knowing!

Quoted 1 line

Unfortunately changing the default behavior to tapdisk

What exactly needs changing?

Quoted 3 lines

probably isn't
viable at this time for a number of reasons - not least of which is the fact it is yet to be included in mainline.

tapdisk is not going to be included in mainline. The kernel side is deemed to be non-upstreamble.

Someone is working on a fully userspace version of bkltap which we hope will be ready soon.

Ian.

Quoted 38 lines

However it would definitely be preferable in the long term - atleast from the perspective of data integrity and principle of least surprises.

Just my 2c.

Joseph.

Quoted 25 lines · Stefano Stabellini
Quoted 9 lines · Stefano Stabellini
Quoted 8 lines · Jan Beulich
Quoted 2 lines

What would be the rationale behind using blkback+loop for "file:"? Backward compatibility?

Yes.

Quoted 2 lines

Do you think it might break something for users if we change the backend from xend to xl?

Quoted 7 lines
Quoted 3 lines

This cannot be excluded, particularly because (just like me here) users tend to do things you didn't expect them to when you write the code.

I see your point but actually that is quite an obvious bug, not a very subtle one that only happens in strange user configs.

Scratch that: I have just tried on Linux 3.3 and the performance of blkback with loopback is very good. We should use it whenever we can.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#15 lore raw
Quoted 1 line · Ian Campbell

Please don't top post, it destroys the flow of the conversation.

My apologies, GMail is a very irritating client.

Quoted 13 lines · Joseph Glanville
Quoted 10 lines

Hi,

As I understand it prefering tapdisk over loop+blkback has never been for performance reasons historically. (tapdisk2:aio does however exhibit very good performance)
The primary reason that tapdisk was always recommended over file: is that the Linux file cache does very interesting things to your data and sync is returned to the blkback backend much sooner than the data actually resides safely on disk (which can sit in the linux disk cache for a sizeable amount of time if they machine has alot of ram).

Quoted 3 lines

Are you suggesting that the loop device doesn't support O_DIRECT and will leave stuff dirty in the page cache even when direct access is used? That is worth knowing!

As far as I am aware this is the case. It doesn't support O_DIRECT in any capacity.
There was some patches submitted to the list a very long time ago ( I could probably find them if I tried) but they were knocked back by upstream.
It is possible this could have changed so I will take a glance at the source of loop.c tonight to see if that is actually the case.

Quoted 4 lines
Quoted 2 lines

Unfortunately changing the default behavior to tapdisk

What exactly needs changing?

I was suggesting that tapdisk would be a much safer default in terms of data integrity for the above reason that the loop driver doesn't support O_DIRECT.

Quoted 10 lines
Quoted 4 lines

 probably isn't
viable at this time for a number of reasons - not least of which is the fact it is yet to be included in mainline.

tapdisk is not going to be included in mainline. The kernel side is deemed to be non-upstreamble.

Someone is working on a fully userspace version of bkltap which we hope will be ready soon.

That is unfortunate, would you mind pointing me in the direction of the pure userspace version?
Would the performance be considerably worse than the current implementation?

Quoted 43 lines

Ian.

Quoted 38 lines

However it would definitely be preferable in the long term - atleast from the perspective of data integrity and principle of least surprises.

Just my 2c.

Joseph.

Quoted 25 lines · Stefano Stabellini
Quoted 9 lines · Stefano Stabellini
Quoted 8 lines · Jan Beulich
Quoted 2 lines

What would be the rationale behind using blkback+loop for "file:"? Backward compatibility?

Yes.

Quoted 2 lines

Do you think it might break something for users if we change the backend from xend to xl?

Quoted 7 lines
Quoted 3 lines

This cannot be excluded, particularly because (just like me here) users tend to do things you didn't expect them to when you write the code.

I see your point but actually that is quite an obvious bug, not a very subtle one that only happens in strange user configs.

Scratch that: I have just tried on Linux 3.3 and the performance of blkback with loopback is very good. We should use it whenever we can.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

All of that being said it is still relatively OK to leave blkback+loop as the default as the majority of users I would assume use actual block devices (though I could be horribly wrong here).
All documentation and best-practices on the wiki outline this in detail.

Joseph.

Signature · 3 lines
Founder | Director | VP Research
Orion Virtualisation Solutions | www.orionvm.com.au | Phone: 1300 56
99 52 | Mobile: 0428 754 846
#16 lore raw
In reply to Ian Campbell
Quoted 14 lines · Ian Campbell

Please don't top post, it destroys the flow of the conversation.

Quoted 10 lines · Joseph Glanville

Hi,

As I understand it prefering tapdisk over loop+blkback has never been for performance reasons historically. (tapdisk2:aio does however exhibit very good performance)
The primary reason that tapdisk was always recommended over file: is that the Linux file cache does very interesting things to your data and sync is returned to the blkback backend much sooner than the data actually resides safely on disk (which can sit in the linux disk cache for a sizeable amount of time if they machine has alot of ram).

Quoted 7 lines

Are you suggesting that the loop device doesn't support O_DIRECT and will leave stuff dirty in the page cache even when direct access is used? That is worth knowing!

Quoted 1 line

Unfortunately changing the default behavior to tapdisk

What exactly needs changing?

Doh! I finally get what you meant by this comment. Tapdisk -is- the current default for xl.
xm uses loop and thus my mistake, sigh must learn to think before typing.

Quoted 5 lines
Quoted 4 lines

 probably isn't
viable at this time for a number of reasons - not least of which is the fact it is yet to be included in mainline.

Quoted 48 lines

tapdisk is not going to be included in mainline. The kernel side is deemed to be non-upstreamble.

Someone is working on a fully userspace version of bkltap which we hope will be ready soon.

Ian.

Quoted 38 lines

However it would definitely be preferable in the long term - atleast from the perspective of data integrity and principle of least surprises.

Just my 2c.

Joseph.

Quoted 25 lines · Stefano Stabellini
Quoted 9 lines · Stefano Stabellini
Quoted 8 lines · Jan Beulich
Quoted 2 lines

What would be the rationale behind using blkback+loop for "file:"? Backward compatibility?

Yes.

Quoted 2 lines

Do you think it might break something for users if we change the backend from xend to xl?

Quoted 7 lines
Quoted 3 lines

This cannot be excluded, particularly because (just like me here) users tend to do things you didn't expect them to when you write the code.

I see your point but actually that is quite an obvious bug, not a very subtle one that only happens in strange user configs.

Scratch that: I have just tried on Linux 3.3 and the performance of blkback with loopback is very good. We should use it whenever we can.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

I did have a trawl through the linux kernel and linux-util repos last night however and it appears that none of the direct-io/O_DIRECT patches were ever merged.

Joseph.

Signature · 3 lines
Founder | Director | VP Research
Orion Virtualisation Solutions | www.orionvm.com.au | Phone: 1300 56
99 52 | Mobile: 0428 754 846
#17 lore raw
Quoted 85 lines · Joseph Glanville
Quoted 14 lines · Ian Campbell

Please don't top post, it destroys the flow of the conversation.

Quoted 10 lines · Joseph Glanville

Hi,

As I understand it prefering tapdisk over loop+blkback has never been for performance reasons historically. (tapdisk2:aio does however exhibit very good performance)
The primary reason that tapdisk was always recommended over file: is that the Linux file cache does very interesting things to your data and sync is returned to the blkback backend much sooner than the data actually resides safely on disk (which can sit in the linux disk cache for a sizeable amount of time if they machine has alot of ram).

Quoted 7 lines

Are you suggesting that the loop device doesn't support O_DIRECT and will leave stuff dirty in the page cache even when direct access is used? That is worth knowing!

Quoted 1 line

Unfortunately changing the default behavior to tapdisk

What exactly needs changing?

Doh! I finally get what you meant by this comment. Tapdisk -is- the current default for xl.
xm uses loop and thus my mistake, sigh must learn to think before typing.

Quoted 5 lines
Quoted 4 lines

 probably isn't
viable at this time for a number of reasons - not least of which is the fact it is yet to be included in mainline.

Quoted 48 lines

tapdisk is not going to be included in mainline. The kernel side is deemed to be non-upstreamble.

Someone is working on a fully userspace version of bkltap which we hope will be ready soon.

Ian.

Quoted 38 lines

However it would definitely be preferable in the long term - atleast from the perspective of data integrity and principle of least surprises.

Just my 2c.

Joseph.

Quoted 25 lines · Stefano Stabellini
Quoted 9 lines · Stefano Stabellini
Quoted 8 lines · Jan Beulich
Quoted 2 lines

What would be the rationale behind using blkback+loop for "file:"? Backward compatibility?

Yes.

Quoted 2 lines

Do you think it might break something for users if we change the backend from xend to xl?

Quoted 7 lines
Quoted 3 lines

This cannot be excluded, particularly because (just like me here) users tend to do things you didn't expect them to when you write the code.

I see your point but actually that is quite an obvious bug, not a very subtle one that only happens in strange user configs.

Scratch that: I have just tried on Linux 3.3 and the performance of blkback with loopback is very good. We should use it whenever we can.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

I did have a trawl through the linux kernel and linux-util repos last night however and it appears that none of the direct-io/O_DIRECT patches were ever merged.

Quoted 7 lines

Joseph.

--
Founder | Director | VP Research
Orion Virtualisation Solutions | www.orionvm.com.au | Phone: 1300 56 99 52 | Mobile: 0428 754 846

For interested parties this is the original patch series I was reffering to:
http://www.spinics.net/lists/linux-fsdevel/msg27514.html

There also seems to be a revival of this effort as of about a week ago:
https://lkml.org/lkml/2012/2/28/251

Kind regards,
Joseph.

Signature · 3 lines
Founder | Director | VP Research
Orion Virtualisation Solutions | www.orionvm.com.au | Phone: 1300 56
99 52 | Mobile: 0428 754 846
#18 lore raw
Quoted 6 lines · Joseph Glanville
Quoted 4 lines · Joseph Glanville

On 3 March 2012 16:25, Ian Campbell <[email protected]> wrote:
I did have a trawl through the linux kernel and linux-util repos last night however and it appears that none of the direct-io/O_DIRECT patches were ever merged.

Quoted 6 lines

For interested parties this is the original patch series I was reffering to:
http://www.spinics.net/lists/linux-fsdevel/msg27514.html

There also seems to be a revival of this effort as of about a week ago:
https://lkml.org/lkml/2012/2/28/251

Thanks for all the useful info and pointers. We should keep an eye on this series.

Ian.

#19 lore raw
In reply to Jan Beulich

Jan Beulich writes ("[Xen-devel] xl block-attach vs block-detach"):

Quoted 4 lines

So it seems that "xl block-attach" allows a variety of ways to specify the devices ID (xvdN, dNpN, decimal or hex number) - why is it that the inverse operation ("xl block-detach") can't deal with anything by a decimal number?

Probably because I didn't notice that xl block-detach was using a different parser when I replaced the block-attach one with a call to the same parser as is used for disks specified in the config file.

Would you like to fix it ? :-)

Quoted 8 lines

Further, why is it that with no blktap module loaded I'm getting an incomplete attach when using the (deprecated) file:/ format for specifying the backing file? It reports that it would be using qdisk, and blkfront also sees the device appearing, but all I'm seeing in the kernel log is the single message from blkfront's probe function. (With no blktap in pv-ops, I wonder how file backed disks work there.) When trying to detach such a broken device I'm getting "unrecognized disk backend type: 0", and the remove fails.

That might well be a bug. In addition to Ian's questions, what do you get if you turn on the debug by passing xl lots of -v flags (before the block-attach) ? Can you attach the disk by naming it in the config file ?

thanks,
Ian.

#20 lore raw
Quoted 10 lines
Quoted 9 lines
Quoted 1 line · Ian Jackson

Further, why is it that with no blktap module loaded I'm getting an incomplete attach when using the (deprecated) file:/ format for specifying the backing file? It reports that it would be using qdisk, and blkfront also sees the device appearing, but all I'm seeing in the kernel log is the single message from blkfront's probe function. (With no blktap in pv-ops, I wonder how file backed disks work there.) When trying to detach such a broken device I'm getting "unrecognized disk backend type: 0", and the remove fails.

Quoted 3 lines

That might well be a bug. In addition to Ian's questions, what do you get if you turn on the debug by passing xl lots of -v flags (before the block-attach) ?

+ xl -vvvvv block-attach 0 file:/srv/SuSE/SLES-11-SP1-MINI-ISO-x86_64-GMC3-CD.iso 0xca00 r
libxl: debug: libxl_device.c:183:libxl__device_disk_set_backend: Disk vdev=0xca00 spec.backend=unknown
libxl: debug: libxl_device.c:137:disk_try_backend: Disk vdev=0xca00, backend phy unsuitable as phys path not a block device
libxl: debug: libxl_device.c:144:disk_try_backend: Disk vdev=0xca00, backend tap unsuitable because blktap not available
libxl: debug: libxl_device.c:219:libxl__device_disk_set_backend: Disk vdev=0xca00, using backend qdisk
libxl: debug: libxl_device.c:183:libxl__device_disk_set_backend: Disk vdev=0xca00 spec.backend=qdisk
xc: debug: hypercall buffer: total allocations:2 total releases:2
xc: debug: hypercall buffer: current allocations:0 maximum allocations:2
xc: debug: hypercall buffer: cache current size:2
xc: debug: hypercall buffer: cache hits:0 misses:2 toobig:0
+ xl -vvvvv block-attach 0 file:/srv/SuSE/SLES-11-SP1-MINI-ISO-x86_64-GMC3-CD.iso 0xca00 r
libxl: debug: libxl_device.c:183:libxl__device_disk_set_backend: Disk vdev=0xca00 spec.backend=unknown
libxl: debug: libxl_device.c:137:disk_try_backend: Disk vdev=0xca00, backend phy unsuitable as phys path not a block device
libxl: debug: libxl_device.c:144:disk_try_backend: Disk vdev=0xca00, backend tap unsuitable because blktap not available
libxl: debug: libxl_device.c:219:libxl__device_disk_set_backend: Disk vdev=0xca00, using backend qdisk
libxl: debug: libxl_device.c:183:libxl__device_disk_set_backend: Disk vdev=0xca00 spec.backend=qdisk
xc: debug: hypercall buffer: total allocations:2 total releases:2
xc: debug: hypercall buffer: current allocations:0 maximum allocations:2
xc: debug: hypercall buffer: cache current size:2
xc: debug: hypercall buffer: cache hits:0 misses:2 toobig:0
+ xl -vvvvv block-detach 0 51712
libxl: error: libxl.c:1223:libxl__device_from_disk: unrecognized disk backend type: 0

libxl_device_disk_remove failed.
xc: debug: hypercall buffer: total allocations:2 total releases:2
xc: debug: hypercall buffer: current allocations:0 maximum allocations:2
xc: debug: hypercall buffer: cache current size:2
xc: debug: hypercall buffer: cache hits:0 misses:2 toobig:0
+ xl -vvvvv block-detach 0 51712
libxl: error: libxl.c:1223:libxl__device_from_disk: unrecognized disk backend type: 0

libxl_device_disk_remove failed.
xc: debug: hypercall buffer: total allocations:2 total releases:2
xc: debug: hypercall buffer: current allocations:0 maximum allocations:2
xc: debug: hypercall buffer: cache current size:2
xc: debug: hypercall buffer: cache hits:0 misses:2 toobig:0

Quoted 1 line

Can you attach the disk by naming it in the config file ?

Didn't try, for the purpose at hand I want the disk attached to Dom0.

Jan

#21 lore raw
Quoted 51 lines · Jan Beulich
Quoted 10 lines
Quoted 9 lines
Quoted 1 line · Ian Jackson

Further, why is it that with no blktap module loaded I'm getting an incomplete attach when using the (deprecated) file:/ format for specifying the backing file? It reports that it would be using qdisk, and blkfront also sees the device appearing, but all I'm seeing in the kernel log is the single message from blkfront's probe function. (With no blktap in pv-ops, I wonder how file backed disks work there.) When trying to detach such a broken device I'm getting "unrecognized disk backend type: 0", and the remove fails.

Quoted 3 lines

That might well be a bug. In addition to Ian's questions, what do you get if you turn on the debug by passing xl lots of -v flags (before the block-attach) ?

+ xl -vvvvv block-attach 0 file:/srv/SuSE/SLES-11-SP1-MINI-ISO-x86_64-GMC3-CD.iso 0xca00 r
libxl: debug: libxl_device.c:183:libxl__device_disk_set_backend: Disk vdev=0xca00 spec.backend=unknown
libxl: debug: libxl_device.c:137:disk_try_backend: Disk vdev=0xca00, backend phy unsuitable as phys path not a block device
libxl: debug: libxl_device.c:144:disk_try_backend: Disk vdev=0xca00, backend tap unsuitable because blktap not available
libxl: debug: libxl_device.c:219:libxl__device_disk_set_backend: Disk vdev=0xca00, using backend qdisk
libxl: debug: libxl_device.c:183:libxl__device_disk_set_backend: Disk vdev=0xca00 spec.backend=qdisk
xc: debug: hypercall buffer: total allocations:2 total releases:2
xc: debug: hypercall buffer: current allocations:0 maximum allocations:2
xc: debug: hypercall buffer: cache current size:2
xc: debug: hypercall buffer: cache hits:0 misses:2 toobig:0
+ xl -vvvvv block-attach 0 file:/srv/SuSE/SLES-11-SP1-MINI-ISO-x86_64-GMC3-CD.iso 0xca00 r
libxl: debug: libxl_device.c:183:libxl__device_disk_set_backend: Disk vdev=0xca00 spec.backend=unknown
libxl: debug: libxl_device.c:137:disk_try_backend: Disk vdev=0xca00, backend phy unsuitable as phys path not a block device
libxl: debug: libxl_device.c:144:disk_try_backend: Disk vdev=0xca00, backend tap unsuitable because blktap not available
libxl: debug: libxl_device.c:219:libxl__device_disk_set_backend: Disk vdev=0xca00, using backend qdisk
libxl: debug: libxl_device.c:183:libxl__device_disk_set_backend: Disk vdev=0xca00 spec.backend=qdisk
xc: debug: hypercall buffer: total allocations:2 total releases:2
xc: debug: hypercall buffer: current allocations:0 maximum allocations:2
xc: debug: hypercall buffer: cache current size:2
xc: debug: hypercall buffer: cache hits:0 misses:2 toobig:0
+ xl -vvvvv block-detach 0 51712
libxl: error: libxl.c:1223:libxl__device_from_disk: unrecognized disk backend type: 0

libxl_device_disk_remove failed.
xc: debug: hypercall buffer: total allocations:2 total releases:2
xc: debug: hypercall buffer: current allocations:0 maximum allocations:2
xc: debug: hypercall buffer: cache current size:2
xc: debug: hypercall buffer: cache hits:0 misses:2 toobig:0
+ xl -vvvvv block-detach 0 51712
libxl: error: libxl.c:1223:libxl__device_from_disk: unrecognized disk backend type: 0

libxl_device_disk_remove failed.
xc: debug: hypercall buffer: total allocations:2 total releases:2
xc: debug: hypercall buffer: current allocations:0 maximum allocations:2
xc: debug: hypercall buffer: cache current size:2
xc: debug: hypercall buffer: cache hits:0 misses:2 toobig:0

Quoted 3 lines
Quoted 1 line

Can you attach the disk by naming it in the config file ?

Didn't try, for the purpose at hand I want the disk attached to Dom0.

AH, I bet that is it -- it is very unlikely that dom0 has a qemu which would process the qdisk backend stuff.

Hrm, in fact I wonder if block-attach handles starting a qemu at all if one isn't already running. I also wonder how well qemu handles hotplug of disks if it is running.

I think you may have opened a can of works here. Hopefully someone will correct me but I expect there is work to be done here...

Ian.