Skip to contentSkip to conversation

PV DRM doesn't work without auto_translated_physmap feature in Dom0

Xen-devel Santucco 3 participants 7 messages Jan 6, 2020 – Feb 3, 2020

lore
Share & tools
lore

Santucco

author
#0 lore raw

Hello,
I’m trying to use vdispl interface from PV OS, it doesn’t work.
Configuration details:
Xen 4.12.1
Dom0: Linux 4.20.17-gentoo #13 SMP Sat Dec 28 11:12:24 MSK 2019 x86_64 Intel(R) Celeron(R) CPU N3050 @ 1.60GHz GenuineIntel GNU/Linux
DomU: x86 Plan9, PV
displ_be as a backend for vdispl and vkb

when VM starts, displ_be reports about an error:
gnttab: error: ioctl DMABUF_EXP_FROM_REFS failed: Invalid argument (displ_be.log:221)

related Dom0 output is:

[  191.579278] Cannot provide dma-buf: use_ptemode 1 (dmesg.create.log:123)

According to the linux kernel sources use_ptemod is:
gntdev.c:1213: use_ptemod = !xen_feature(XENFEAT_auto_translated_physmap);

But xen-features.pl script doesn't show this feature is set for Dom0:
Xen features: 000028f0
enabled: pae_pgdir_above_4gb
enabled: mmu_pt_update_preserve_ad
enabled: dom0
enabled: memory_op_vnode_supported

According to the Xen sources, auto_translated_physmap is set up in a case of :
xen/common/kernel.c:467: if ( paging_mode_translate(d) )
xen/common/kernel.c-468- fi.submap |=
xen/common/kernel.c-469- (1U << XENFEAT_writable_page_tables) |
xen/common/kernel.c-470- (1U << XENFEAT_auto_translated_physmap);

where
xen/include/asm-x86/paging.h:73:#define paging_mode_translate(_d) (!!((_d)->arch.paging.mode & PG_translate))

But PG_translate is applied only for HVM, at least I have not fount any other points:
xen/arch/x86/hvm/hvm.c:606: rc = paging_enable(d, PG_refcounts|PG_translate|PG_external);

What configuration should be for vdispl is able to work?
Or maybe I can to something to make Xen set auto_translated_physmap feature up to continue using of vdispl? And should I make any special support for the feature in PV OS?

All logs and configs are attached.

Thanks in advance.

Best regards,
Alexander Sychev

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#1 lore raw
Quoted 9 lines · Santucco

Hello,

I’m trying to use vdispl interface from PV OS, it doesn’t work.
Configuration details:
Xen 4.12.1
Dom0: Linux 4.20.17-gentoo #13 SMP Sat Dec 28 11:12:24 MSK 2019 x86_64 Intel(R) Celeron(R) CPU N3050 @ 1.60GHz GenuineIntel GNU/Linux
DomU: x86 Plan9, PV
displ_be as a backend for vdispl and vkb

Quoted 5 lines

when VM starts, displ_be reports about an error:
gnttab: error: ioctl DMABUF_EXP_FROM_REFS failed: Invalid argument (displ_be.log:221)

related Dom0 output is:

[  191.579278] Cannot provide dma-buf: use_ptemode 1 (dmesg.create.log:123)

This seems to be a limitation of the xen dma-buf driver. It was written for being used on ARM initially where PV is not available.

CC-ing Oleksandr Andrushchenko who is the author of that driver. He should be able to tell us what would be needed to enable PV dom0.

Depending on your use case it might be possible to use PVH dom0, but support for this mode is "experimental" only and some features are not yet working.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
Quoted 15 lines · Jürgen Groß
Quoted 14 lines · Santucco

Hello,

I’m trying to use vdispl interface from PV OS, it doesn’t work. Configuration details:
     Xen 4.12.1
     Dom0: Linux 4.20.17-gentoo #13 SMP Sat Dec 28 11:12:24 MSK 2019 x86_64 Intel(R) Celeron(R) CPU N3050 @ 1.60GHz GenuineIntel GNU/Linux
     DomU: x86 Plan9, PV
     displ_be as a backend for vdispl and vkb

when VM starts, displ_be reports about an error:
gnttab: error: ioctl DMABUF_EXP_FROM_REFS failed: Invalid argument (displ_be.log:221)

Quoted 6 lines
Quoted 3 lines

related Dom0 output is:
[  191.579278] Cannot provide dma-buf: use_ptemode 1 (dmesg.create.log:123)

This seems to be a limitation of the xen dma-buf driver. It was written for being used on ARM initially where PV is not available.

This is true and we never tried/targeted PV domains with this implementation,
so if there is a need for that someone has to take a look on the proper implementation for PV...

Quoted 8 lines

CC-ing Oleksandr Andrushchenko who is the author of that driver. He should be able to tell us what would be needed to enable PV dom0.

Depending on your use case it might be possible to use PVH dom0, but support for this mode is "experimental" only and some features are not yet working.

Well, one of the workarounds possible is to drop zero-copying use-case (this is why display backend tries to create dmu-bufs from grants passed by the guest domain and fails because of "Cannot provide dma-buf:
use_ptemode 1")
So, in this case display backend will do memory copying for the incoming frames
and won't touch DMABUF_EXP_FROM_REFS ioctl.
To do so just disable zero-copying while building the backend [1]

Quoted 3 lines

Juergen

[1] https://github.com/xen-troops/displ_be/blob/master/CMakeLists.txt#L12
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#3 lore raw

Thank you very much for all your answers.

Quoted 22 lines

Среда, 8 января 2020, 10:54 +03:00 от Oleksandr Andrushchenko < [email protected] >:

Quoted 19 lines · Jürgen Groß
Quoted 17 lines · Santucco

Hello,

I’m trying to use vdispl interface from PV OS, it doesn’t work. Configuration details:
     Xen 4.12.1
     Dom0: Linux 4.20.17-gentoo #13 SMP Sat Dec 28 11:12:24 MSK 2019 x86_64 Intel(R) Celeron(R) CPU N3050 @ 1.60GHz GenuineIntel GNU/Linux
     DomU: x86 Plan9, PV
     displ_be as a backend for vdispl and vkb

when VM starts, displ_be reports about an error:
gnttab: error: ioctl DMABUF_EXP_FROM_REFS failed: Invalid argument (displ_be.log:221)

related Dom0 output is:
[  191.579278] Cannot provide dma-buf: use_ptemode 1 (dmesg.create.log:123)

Quoted 6 lines
Quoted 2 lines

This seems to be a limitation of the xen dma-buf driver. It was written for being used on ARM initially where PV is not available.

This is true and we never tried/targeted PV domains with this implementation,
so if there is a need for that someone has to take a look on the proper implementation for PV…

Have I got your right and there is no the proper implementation :-)?

Quoted 8 lines
Quoted 8 lines

CC-ing Oleksandr Andrushchenko who is the author of that driver. He should be able to tell us what would be needed to enable PV dom0.

Depending on your use case it might be possible to use PVH dom0, but support for this mode is "experimental" only and some features are not yet working.

Quoted 8 lines

Well, one of the workarounds possible is to drop zero-copying use-case (this is why display backend tries to create dmu-bufs from grants passed by the guest domain and fails because of "Cannot provide dma-buf:
use_ptemode 1")
So, in this case display backend will do memory copying for the incoming frames
and won't touch DMABUF_EXP_FROM_REFS ioctl.
To do so just disable zero-copying while building the backend [1]


Thanks, I have just tried the workaround.  The backend has failed in an other place not corresponding with dma_buf.
Anyway it is enough to continue debugging  my frontend implementation.

Do you know how big is performance penalty in comparison with the zero-copy variant?

Does it make a sense if I make a dedicated HVM domain with linux only for the purpose of vdispl and vkbd backends? Is there a hope this approach will work?

Quoted 4 lines
Quoted 3 lines

Juergen

[1] https://github.com/xen-troops/displ_be/blob/master/CMakeLists.txt#L12


Best regards,
  Alexander Sychev

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw
Quoted 36 lines · Santucco

Thank you very much for all your answers.

    Среда, 8 января 2020, 10:54 +03:00 от Oleksandr Andrushchenko
    <[email protected]
    </[email protected]>>:
    On 1/6/20 10:38 AM, Jürgen Groß wrote:
    > On 06.01.20 08:56, Santucco wrote:
    >> Hello,
    >>
    >> I’m trying to use vdispl interface from PV OS, it doesn’t work.
    >> Configuration details:
    >>      Xen 4.12.1
    >>      Dom0: Linux 4.20.17-gentoo #13 SMP Sat Dec 28 11:12:24 MSK
    2019
    >> x86_64 Intel(R) Celeron(R) CPU N3050 @ 1.60GHz GenuineIntel
    GNU/Linux
    >>      DomU: x86 Plan9, PV
    >>      displ_be as a backend for vdispl and vkb
    >>
    >> when VM starts, displ_be reports about an error:
    >> gnttab: error: ioctl DMABUF_EXP_FROM_REFS failed: Invalid argument
    >> (displ_be.log:221)
    >>
    >> related Dom0 output is:
    >> [  191.579278] Cannot provide dma-buf: use_ptemode 1
    >> (dmesg.create.log:123)
    >
    > This seems to be a limitation of the xen dma-buf driver. It was
    written
    > for being used on ARM initially where PV is not available.
    This is true and we never tried/targeted PV domains with this
    implementation,
    so if there is a need for that someone has to take a look on the
    proper
    implementation for PV…
Quoted 1 line

Have I got your right and there is no the proper implementation :-)?

There is no

Quoted 21 lines
Quoted 7 lines

CC-ing Oleksandr Andrushchenko who is the author of that driver. He should be able to tell us what would be needed to enable PV dom0.

Depending on your use case it might be possible to use PVH dom0, but support for this mode is "experimental" only and some features

are not
> yet working.
>
Well, one of the workarounds possible is to drop zero-copying use-case (this is why display backend tries to create dmu-bufs from grants passed
by the guest domain and fails because of "Cannot provide dma-buf:
use_ptemode 1")
So, in this case display backend will do memory copying for the incoming
frames
and won't touch DMABUF_EXP_FROM_REFS ioctl.
To do so just disable zero-copying while building the backend [1]

Quoted 5 lines

Thanks, I have just tried the workaround.  The backend has failed in an other place not corresponding with dma_buf.
Anyway it is enough to continue debugging  my frontend implementation. Do you know how big is performance penalty in comparison with the zero-copy variant?

Well, it solely depends on your setup, so I cannot tell what would the numbers be in your case. Comparing to what I have doesn't make any sense to me: one should compare apples to apples

Quoted 3 lines

Does it make a sense if I make a dedicated HVM domain with linux only for the purpose of vdispl and vkbd backends? Is there a hope this approach will work?

You can try if this approach fits your design and requirements

Quoted 10 lines
Quoted 4 lines

Juergen

    [1]
    https://github.com/xen-troops/displ_be/blob/master/CMakeLists.txt#L12
    <https://urldefense.com/v3/__https://github.com/xen-troops/displ_be/blob/master/CMakeLists.txt*L12__;Iw!!GF_29dbcQIUBPA!mz3gn1wQMX2DXeNuAV-1_dI7nxFYYZOgdPiJNSFMesCz9lAzOKlwVPlddbxbcLmUO44NOy0TFA$>

Best regards,
  Alexander Sychev

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#5 lore raw

Hello again,

I have not yet made to work my drm client, so I have tried to run linux like a domU (to see how it should work), it doesn’t work too — displ_be catches SIGSEGV:

#0  0x00007f4afed1c161 in ?? () from /lib64/libc.so.6
#1  0x000055723b9c5bec in Drm::DumbDrm::copy (this=0x7f4adc000e00) at /home/santucco/tmp/xen-troops/displ_be/src/displayBackend/drm/Dumb.cpp:149
#2  0x000055723b9a8f51 in BuffersStorage::getFrameBufferAndCopy (this=0x7f4ae00010e0, fbCookie=18446612682295083264) at /home/santucco/tmp/xen-troops/displ_be/src/displayBackend/BuffersStorage.cpp:165
It tries to copy to mBuffer with non-accessible address.

For the moment I see a strange offset for mmap call of /dev/drm/card0 in the strace log — 0x100000000. Is that normal?

Any direction of which to dig will be very helpful.

Configuration details:
Xen 4.12.1 Dom0: Linux 4.20.17-gentoo #13 SMP Sat Dec 28 11:12:24 MSK 2019 x86_64 Intel(R) Celeron(R) CPU N3050 @ 1.60GHz GenuineIntel GNU/Linux
DomU: Linux 4.20.17-gentoo
last xen-troops/libxenbe and xen-troops/displ_be

Logs (dmesg, xl dmesg, displ_be, strace log of displ_be), a backtrace of gdb and kernel configs are attached.
Thanks in advance.

Quoted 29 lines · Santucco

Thank you very much for all your answers.

Среда, 8 января 2020, 10:54 +03:00 от Oleksandr Andrushchenko < [email protected]
< /[email protected] >>:

Quoted 7 lines · Jürgen Groß
Quoted 6 lines · Santucco

Hello,

I’m trying to use vdispl interface from PV OS, it doesn’t work. Configuration details:
     Xen 4.12.1
     Dom0: Linux 4.20.17-gentoo #13 SMP Sat Dec 28 11:12:24 MSK

2019

Quoted 1 line
Quoted 1 line

x86_64 Intel(R) Celeron(R) CPU N3050 @ 1.60GHz GenuineIntel

GNU/Linux

Quoted 7 lines
Quoted 7 lines

     DomU: x86 Plan9, PV
     displ_be as a backend for vdispl and vkb

when VM starts, displ_be reports about an error:
gnttab: error: ioctl DMABUF_EXP_FROM_REFS failed: Invalid argument (displ_be.log:221)

Quoted 5 lines
Quoted 3 lines

related Dom0 output is:
[  191.579278] Cannot provide dma-buf: use_ptemode 1 (dmesg.create.log:123)

This seems to be a limitation of the xen dma-buf driver. It was

written

Quoted 8 lines
Quoted 1 line

for being used on ARM initially where PV is not available.

This is true and we never tried/targeted PV domains with this implementation,
so if there is a need for that someone has to take a look on the proper
implementation for PV…

Have I got your right and there is no the proper implementation :-)?

There is no

Quoted 21 lines
Quoted 7 lines

CC-ing Oleksandr Andrushchenko who is the author of that driver. He should be able to tell us what would be needed to enable PV dom0.

Depending on your use case it might be possible to use PVH dom0, but support for this mode is "experimental" only and some features

are not

Quoted 2 lines

yet working.

Well, one of the workarounds possible is to drop zero-copying use-case (this is why display backend tries to create dmu-bufs from grants passed
by the guest domain and fails because of "Cannot provide dma-buf:
use_ptemode 1")
So, in this case display backend will do memory copying for the incoming
frames
and won't touch DMABUF_EXP_FROM_REFS ioctl.
To do so just disable zero-copying while building the backend [1]

Quoted 5 lines

Thanks, I have just tried the workaround.  The backend has failed in an other place not corresponding with dma_buf.
Anyway it is enough to continue debugging  my frontend implementation. Do you know how big is performance penalty in comparison with the zero-copy variant?

Well, it solely depends on your setup, so I cannot tell what would the numbers be in your case. Comparing to what I have doesn't make any sense to me: one should compare apples to apples

Quoted 3 lines

Does it make a sense if I make a dedicated HVM domain with linux only for the purpose of vdispl and vkbd backends? Is there a hope this approach will work?

You can try if this approach fits your design and requirements

Quoted 10 lines
Quoted 4 lines

Juergen

[1]
https://github.com/xen-troops/displ_be/blob/master/CMakeLists.txt#L12
< https://urldefense.com/v3/__https://github.com/xen-troops/displ_be/blob/master/CMakeLists.txt*L12__;Iw!!GF_29dbcQIUBPA!mz3gn1wQMX2DXeNuAV-1_dI7nxFYYZOgdPiJNSFMesCz9lAzOKlwVPlddbxbcLmUO44NOy0TFA$ >

Best regards,
  Alexander Sychev


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#6 lore raw
Quoted 15 lines · Santucco

Hello again,
I have not yet made to work my drm client, so I have tried to run linux like a domU (to see how it should work), it doesn’t work too — displ_be catches SIGSEGV:

#0  0x00007f4afed1c161 in ?? () from /lib64/libc.so.6
#1  0x000055723b9c5bec in Drm::DumbDrm::copy (this=0x7f4adc000e00) at /home/santucco/tmp/xen-troops/displ_be/src/displayBackend/drm/Dumb.cpp:149 #2  0x000055723b9a8f51 in BuffersStorage::getFrameBufferAndCopy (this=0x7f4ae00010e0, fbCookie=18446612682295083264) at /home/santucco/tmp/xen-troops/displ_be/src/displayBackend/BuffersStorage.cpp:165 It tries to copy to mBuffer with non-accessible address.
For the moment I see a strange offset for mmap call of /dev/drm/card0 in the strace log — 0x100000000. Is that normal?
Any direction of which to dig will be very helpful.

Quoted 8 lines

Configuration details:
Xen 4.12.1 Dom0: Linux 4.20.17-gentoo #13 SMP Sat Dec 28 11:12:24 MSK 2019 x86_64 Intel(R) Celeron(R) CPU N3050 @ 1.60GHz GenuineIntel GNU/Linux
DomU: Linux 4.20.17-gentoo
last xen-troops/libxenbe and xen-troops/displ_be
Logs (dmesg, xl dmesg, displ_be, strace log of displ_be), a backtrace of gdb and kernel configs are attached.
Thanks in advance.

Could you please try Dom0 kernel WITHOUT the options below:
CONFIG_XEN_GNTDEV_DMABUF=y CONFIG_XEN_GRANT_DMA_ALLOC=y

Then, just to make sure, did you build displ_be without zero-copy support?

Quoted 74 lines · Santucco
Quoted 29 lines

Thank you very much for all your answers.

Среда, 8 января 2020, 10:54 +03:00 от Oleksandr Andrushchenko <[email protected] </[email protected]>>:

Quoted 7 lines · Jürgen Groß
Quoted 6 lines · Santucco

Hello,

I’m trying to use vdispl interface from PV OS, it doesn’t work. Configuration details:
     Xen 4.12.1
     Dom0: Linux 4.20.17-gentoo #13 SMP Sat Dec 28 11:12:24 MSK

2019

Quoted 1 line
Quoted 1 line

x86_64 Intel(R) Celeron(R) CPU N3050 @ 1.60GHz GenuineIntel

GNU/Linux

Quoted 7 lines
Quoted 7 lines

     DomU: x86 Plan9, PV
     displ_be as a backend for vdispl and vkb

when VM starts, displ_be reports about an error:
gnttab: error: ioctl DMABUF_EXP_FROM_REFS failed: Invalid argument (displ_be.log:221)

Quoted 5 lines
Quoted 3 lines

related Dom0 output is:
[  191.579278] Cannot provide dma-buf: use_ptemode 1 (dmesg.create.log:123)

This seems to be a limitation of the xen dma-buf driver. It was

written

Quoted 8 lines
Quoted 1 line

for being used on ARM initially where PV is not available.

This is true and we never tried/targeted PV domains with this implementation,
so if there is a need for that someone has to take a look on the proper
implementation for PV…

Have I got your right and there is no the proper implementation :-)?

There is no

Quoted 21 lines
Quoted 7 lines

CC-ing Oleksandr Andrushchenko who is the author of that driver. He should be able to tell us what would be needed to enable PV dom0.

Depending on your use case it might be possible to use PVH dom0, but support for this mode is "experimental" only and some features

are not

Quoted 2 lines

yet working.

Well, one of the workarounds possible is to drop zero-copying use-case (this is why display backend tries to create dmu-bufs from grants passed
by the guest domain and fails because of "Cannot provide dma-buf:
use_ptemode 1")
So, in this case display backend will do memory copying for the incoming
frames
and won't touch DMABUF_EXP_FROM_REFS ioctl.
To do so just disable zero-copying while building the backend [1]

Quoted 5 lines

Thanks, I have just tried the workaround.  The backend has failed in an other place not corresponding with dma_buf.
Anyway it is enough to continue debugging  my frontend implementation. Do you know how big is performance penalty in comparison with the zero-copy variant?

Well, it solely depends on your setup, so I cannot tell what would the numbers be in your case. Comparing to what I have doesn't make any sense to me: one should compare apples to apples

Quoted 3 lines

Does it make a sense if I make a dedicated HVM domain with linux only for the purpose of vdispl and vkbd backends? Is there a hope this approach will work?

You can try if this approach fits your design and requirements

Quoted 2 lines
Quoted 2 lines
Quoted 12 lines
Quoted 4 lines
Quoted 2 lines

Juergen

[1]

https://github.com/xen-troops/displ_be/blob/master/CMakeLists.txt#L12
<https://urldefense.com/v3/__https://github.com/xen-troops/displ_be/blob/master/CMakeLists.txt*L12__;Iw!!GF_29dbcQIUBPA!gi81oZZNvWaFWUVnaZluA_mNBAItLMd4RZmnc-M_FmlpDojqeQQnS7aXSNlbo80re9uOl2wqFA$>

Quoted 1 line

<https://urldefense.com/v3/__https://github.com/xen-troops/displ_be/blob/master/CMakeLists.txt*L12__;Iw!!GF_29dbcQIUBPA!mz3gn1wQMX2DXeNuAV-1_dI7nxFYYZOgdPiJNSFMesCz9lAzOKlwVPlddbxbcLmUO44NOy0TFA$>

Quoted 3 lines

Best regards,
  Alexander Sychev

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel