Skip to contentSkip to conversation

do_domctl and EAGAIN

DISCUSSION Juergen Gross 2 participants 9 messages Apr 7, 2009

lore
Share & tools
lore
#0 lore raw

Hi,

certain domctl hypercalls (and possibly others as well) might fail with errno EAGAIN. This case seems to be tested only in very few places, e.g. in xc_domain_destroy.

Is there any reason why this case isn't handled in do_domctl? Shouldn't EINTR be handled as well?

The other solution would be to have two versions of do_domctl, one of them looping in case of EAGAIN or EINTR.

I suspect this lack of errno-testing could lead to very sporadic failures...

Juergen

Signature · 5 lines
Juergen Gross                 Principal Developer Operating Systems
TSP ES&S SWE OS6                       Telephone: +49 (0) 89 636 47950
Fujitsu Technolgy Solutions               e-mail: [email protected]
Otto-Hahn-Ring 6                        Internet: ts.fujitsu.com
D-81739 Muenchen                 Company details: ts.fujitsu.com/imprint.html
#1 lore raw

Only DOMCTL_destroydomain returns EAGAIN. No domctl returns EINTR.

-- Keir

Quoted 16 lines · Juergen Gross

Hi,

certain domctl hypercalls (and possibly others as well) might fail with errno EAGAIN. This case seems to be tested only in very few places, e.g. in xc_domain_destroy.

Is there any reason why this case isn't handled in do_domctl? Shouldn't EINTR be handled as well?

The other solution would be to have two versions of do_domctl, one of them looping in case of EAGAIN or EINTR.

I suspect this lack of errno-testing could lead to very sporadic failures...

Juergen

#2 lore raw
Quoted 1 line · Keir Fraser

Only DOMCTL_destroydomain returns EAGAIN. No domctl returns EINTR.

do_domctl uses ioctl.
ioctl can return EINTR if a signal is caught.

Other hypercalls do return EAGAIN.

Juergen

Quoted 18 lines

-- Keir

Quoted 13 lines · Juergen Gross

Hi,

certain domctl hypercalls (and possibly others as well) might fail with errno EAGAIN. This case seems to be tested only in very few places, e.g. in xc_domain_destroy.

Is there any reason why this case isn't handled in do_domctl? Shouldn't EINTR be handled as well?

The other solution would be to have two versions of do_domctl, one of them looping in case of EAGAIN or EINTR.

I suspect this lack of errno-testing could lead to very sporadic failures...

Signature · 5 lines
Juergen Gross                 Principal Developer Operating Systems
TSP ES&S SWE OS6                       Telephone: +49 (0) 89 636 47950
Fujitsu Technolgy Solutions               e-mail: [email protected]
Otto-Hahn-Ring 6                        Internet: ts.fujitsu.com
D-81739 Muenchen                 Company details: ts.fujitsu.com/imprint.html
#3 lore raw
Quoted 7 lines · Juergen Gross
Quoted 1 line · Keir Fraser

Only DOMCTL_destroydomain returns EAGAIN. No domctl returns EINTR.

do_domctl uses ioctl.
ioctl can return EINTR if a signal is caught.

Other hypercalls do return EAGAIN.

Which ones?

-- Keir

#4 lore raw
Quoted 10 lines · Keir Fraser
Quoted 6 lines · Juergen Gross
Quoted 1 line · Keir Fraser

Only DOMCTL_destroydomain returns EAGAIN. No domctl returns EINTR.

do_domctl uses ioctl.
ioctl can return EINTR if a signal is caught.

Other hypercalls do return EAGAIN.

Which ones?

XEN_SYSCTL_pm_op (this one is tested by caller)
xenstore calls (tested by caller)
mmuext_op (NOT always checked by caller)

Juergen

Signature · 5 lines
Juergen Gross                 Principal Developer Operating Systems
TSP ES&S SWE OS6                       Telephone: +49 (0) 89 636 47950
Fujitsu Technolgy Solutions               e-mail: [email protected]
Otto-Hahn-Ring 6                        Internet: ts.fujitsu.com
D-81739 Muenchen                 Company details: ts.fujitsu.com/imprint.html
#5 lore raw
Quoted 1 line · Juergen Gross

XEN_SYSCTL_pm_op (this one is tested by caller)

Yes, and indeed has to be checked by the caller, rather than hidden, since it's an odd EAGAIN-with-side-effects.

Quoted 1 line

xenstore calls (tested by caller)

Not really hypercalls as such.

Quoted 1 line

mmuext_op (NOT always checked by caller)

Nah, that doesn't return EINTR. EAGAIN/EINTR is used a lot in Xen's mm.c, but shouldn't leak into hypercall return values. That'd be a non-backward-compatible bug.

-- Keir

#6 lore raw
In reply to Juergen Gross
Quoted 5 lines · Juergen Gross
Quoted 1 line · Keir Fraser

Only DOMCTL_destroydomain returns EAGAIN. No domctl returns EINTR.

do_domctl uses ioctl.
ioctl can return EINTR if a signal is caught.

Our privcmd hypercall ioctl() is non-blocking and hence I don't think can return EINTR. In fact ioctl() is used in loads of places throughout our toolstack and in qemu, and I don't think EINTR is checked by any caller, nor is EINTR mentioned in the ioctl man page.

-- Keir

#7 lore raw
Quoted 11 lines · Keir Fraser
Quoted 4 lines · Juergen Gross
Quoted 1 line · Keir Fraser

Only DOMCTL_destroydomain returns EAGAIN. No domctl returns EINTR.

do_domctl uses ioctl.
ioctl can return EINTR if a signal is caught.

Our privcmd hypercall ioctl() is non-blocking and hence I don't think can return EINTR. In fact ioctl() is used in loads of places throughout our toolstack and in qemu, and I don't think EINTR is checked by any caller, nor is EINTR mentioned in the ioctl man page.

On my system the ioctl man page does mention it:

ERRORS
Under the following general conditions, ioctl() shall fail if:

EBADF The fildes argument is not a valid open file descriptor.

EINTR A signal was caught during the ioctl() operation.

In the non-blocking case this might be irrelevant. Are you sure this is no issue in any case?

Juergen

Signature · 5 lines
Juergen Gross                 Principal Developer Operating Systems
TSP ES&S SWE OS6                       Telephone: +49 (0) 89 636 47950
Fujitsu Technolgy Solutions               e-mail: [email protected]
Otto-Hahn-Ring 6                        Internet: ts.fujitsu.com
D-81739 Muenchen                 Company details: ts.fujitsu.com/imprint.html
#8 lore raw
Quoted 7 lines · Juergen Gross
Quoted 4 lines

Our privcmd hypercall ioctl() is non-blocking and hence I don't think can return EINTR. In fact ioctl() is used in loads of places throughout our toolstack and in qemu, and I don't think EINTR is checked by any caller, nor is EINTR mentioned in the ioctl man page.

In the non-blocking case this might be irrelevant. Are you sure this is no issue in any case?

Yes, our ioctls are all non-blocking (or at least, they don't interruptibly block -- they might block due to paging, memory allocations, and the like, but that's never visible to userspace).

-- Keir