Skip to contentSkip to conversation

Proper location for Linux error code (-EPROBE_DEFER) in Xen

Xen-devel Oleksandr 4 participants 9 messages Aug 1, 2019 – Aug 2, 2019

lore
Share & tools
lore

Oleksandr

author
#0 lore raw

Hello all.

What is the proper location to place Linux error code (-EPROBE_DEFER) in Xen?
https://elixir.bootlin.com/linux/v5.3-rc2/source/include/linux/errno.h#L19

...
Although that error is going to be used by Arm code the first, I feel it should be somewhere in common place as it is not Arm specific.
I was thinking to place it to xen/include/public/errno.h and guard with #ifdef __XEN__ to hide from userspace, but not sure it is a good idea, since it looks like not a POSIX one to be in that header...

Signature · 9 lines
Regards,

Oleksandr Tyshchenko


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 6 lines · Oleksandr

Hello all.

What is the proper location to place Linux error code (-EPROBE_DEFER) in Xen?
https://elixir.bootlin.com/linux/v5.3-rc2/source/include/linux/errno.h#L19

Quoted 6 lines

...
Although that error is going to be used by Arm code the first, I feel it should be somewhere in common place as it is not Arm specific.
I was thinking to place it to xen/include/public/errno.h and guard with #ifdef __XEN__ to hide from userspace, but not sure it is a good idea, since it looks like not a POSIX one to be in that header...

Hello,

I think it would help if you describe why such error code is needed by Xen and how it would be used.

Thanks, Roger.

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

author
#2 lore raw
Quoted 2 lines

Hello,

Hi, Roger

Quoted 2 lines

I think it would help if you describe why such error code is needed by Xen and how it would be used.

 This is needed for the upcoming V2 of the IPMMU driver (ARM) [1] which may request deferred probing (returns -EPROBE_DEFER) depending on what device will be probed the first (Root device must be registered before Cache devices. If not the case, driver will deny further Cache device probes until Root device is registered).

As we can't guarantee a fixed pre-defined order for the device nodes in DT, we need to be ready for the situation where devices being probed in "any" order. So, framework (drivers/passthrough/arm/iommu.c) will be modified a bit to be able to handle -EPROBE_DEFER returning by driver.

[1] https://lists.xenproject.org/archives/html/xen-devel/2017-07/msg02679.html

Signature · 9 lines
Regards,

Oleksandr Tyshchenko


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
author
#3 lore raw
Quoted 14 lines · Oleksandr
Quoted 2 lines

Hello,

Hi, Roger

Quoted 2 lines

I think it would help if you describe why such error code is needed by Xen and how it would be used.

 This is needed for the upcoming V2 of the IPMMU driver (ARM) [1] which may request deferred probing (returns -EPROBE_DEFER) depending on what device will be probed the first (Root device must be registered before Cache devices. If not the case, driver will deny further Cache device probes until Root device is registered).

Quoted 4 lines

As we can't guarantee a fixed pre-defined order for the device nodes in DT, we need to be ready for the situation where devices being probed in "any" order. So, framework (drivers/passthrough/arm/iommu.c) will be modified a bit to be able to handle -EPROBE_DEFER returning by driver.

[1] https://lists.xenproject.org/archives/html/xen-devel/2017-07/msg02679.html

Sorry, I provided wrong link.

The correct link should be:

https://patchew.org/Xen/[email protected]/

Quoted 3 lines
Signature · 9 lines
Regards,

Oleksandr Tyshchenko


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#4 lore raw
In reply to Oleksandr
Quoted 7 lines · Oleksandr

 This is needed for the upcoming V2 of the IPMMU driver (ARM) [1] which may request deferred probing (returns -EPROBE_DEFER) depending on what device will be probed the first (Root device must be registered before Cache devices. If not the case, driver will deny further Cache device probes until Root device is registered).

As we can't guarantee a fixed pre-defined order for the device nodes in DT, we need to be ready for the situation where devices being probed in "any" order. So, framework (drivers/passthrough/arm/iommu.c) will be modified a bit to be able to handle -EPROBE_DEFER returning by driver.

I'm sure this can be had without introducing a new error code.

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

author
#5 lore raw

On 01.08.19 17:34, Jan Beulich wrote:

Hi Jan

Quoted 9 lines · Oleksandr
Quoted 7 lines

 This is needed for the upcoming V2 of the IPMMU driver (ARM) [1] which may request deferred probing (returns -EPROBE_DEFER) depending on what device will be probed the first (Root device must be registered before Cache devices. If not the case, driver will deny further Cache device probes until Root device is registered).

As we can't guarantee a fixed pre-defined order for the device nodes in DT, we need to be ready for the situation where devices being probed in "any" order. So, framework (drivers/passthrough/arm/iommu.c) will be modified a bit to be able to handle -EPROBE_DEFER returning by driver.

I'm sure this can be had without introducing a new error code.

By reusing existing one (EAGAIN comes to mind)?

Quoted 2 lines

Jan

Signature · 9 lines
Regards,

Oleksandr Tyshchenko


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#6 lore raw
Quoted 7 lines · Oleksandr
Quoted 6 lines · Jan Beulich
Quoted 5 lines · Oleksandr

   This is needed for the upcoming V2 of the IPMMU driver (ARM) [1] which may request deferred probing (returns -EPROBE_DEFER) depending on what device will be probed the first (Root device must be registered before Cache devices. If not the case, driver will deny further Cache device probes until Root device is registered).

Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

As we can't guarantee a fixed pre-defined order for the device nodes in DT, we need to be ready for the situation where devices being probed in "any" order. So, framework (drivers/passthrough/arm/iommu.c) will be modified a bit to be able to handle -EPROBE_DEFER returning by driver.

I'm sure this can be had without introducing a new error code.

By reusing existing one (EAGAIN comes to mind)?

For example. Or by using some positive value instead of the (negative) errno.h ones.

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

author
#7 lore raw
Quoted 8 lines · Jan Beulich
Quoted 7 lines · Oleksandr
Quoted 6 lines · Jan Beulich
Quoted 5 lines · Oleksandr

   This is needed for the upcoming V2 of the IPMMU driver (ARM) [1] which may request deferred probing (returns -EPROBE_DEFER) depending on what device will be probed the first (Root device must be registered before Cache devices. If not the case, driver will deny further Cache device probes until Root device is registered).

Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines

As we can't guarantee a fixed pre-defined order for the device nodes in DT, we need to be ready for the situation where devices being probed in "any" order. So, framework (drivers/passthrough/arm/iommu.c) will be modified a bit to be able to handle -EPROBE_DEFER returning by driver.

I'm sure this can be had without introducing a new error code.

By reusing existing one (EAGAIN comes to mind)?

For example. Or by using some positive value instead of the (negative) errno.h ones.

Actually, why not? Thank you.

We could find common ground on what driver's init callback should return if driver wants to request deferred probing and document this behavior in device_init usage. I would use EAGAIN, but I am open to other options here.

Julien, what do you think?

Signature · 9 lines
Regards,

Oleksandr Tyshchenko


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

Hi Oleksandr,

Quoted 17 lines · Oleksandr
Quoted 8 lines · Jan Beulich
Quoted 7 lines · Oleksandr
Quoted 6 lines · Jan Beulich
Quoted 5 lines · Oleksandr

    This is needed for the upcoming V2 of the IPMMU driver (ARM) [1] which may request deferred probing (returns -EPROBE_DEFER) depending on what device will be probed the first (Root device must be registered before Cache devices. If not the case, driver will deny further Cache device probes until Root device is registered).

Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines

As we can't guarantee a fixed pre-defined order for the device nodes in DT, we need to be ready for the situation where devices being probed in "any" order. So, framework (drivers/passthrough/arm/iommu.c) will be modified a bit to be able to handle -EPROBE_DEFER returning by driver.

I'm sure this can be had without introducing a new error code.

By reusing existing one (EAGAIN comes to mind)?

For example. Or by using some positive value instead of the (negative) errno.h ones.

Quoted 6 lines

Actually, why not? Thank you.

We could find common ground on what driver's init callback should return if driver wants to request deferred probing and document this behavior in device_init usage. I would use EAGAIN, but I am open to other options here.

Julien, what do you think?

I don't have any particular opinion as long as the errno cannot be used for something else in that code path.

Cheers,

Signature · 6 lines
Julien Grall

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