* return value checking on multicalls
@ 2007-03-14 15:55 Jan Beulich
2007-03-14 16:00 ` Keir Fraser
2007-03-14 16:45 ` Jeremy Fitzhardinge
0 siblings, 2 replies; 5+ messages in thread
From: Jan Beulich @ 2007-03-14 15:55 UTC (permalink / raw)
To: xen-devel
Many places currently don't even check HYPERVISOR_multicall()'s return
value, not to speak of checking the individual status codes. Would it be
acceptable to add an argument to this function to request to either fold
all status values into a global success code, or to force BUG_ON() each
individual status. Or should I rather add a new function with described
behavior? Or are there other suggestions?
Thanks, Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: return value checking on multicalls
2007-03-14 15:55 return value checking on multicalls Jan Beulich
@ 2007-03-14 16:00 ` Keir Fraser
2007-03-14 16:45 ` Jeremy Fitzhardinge
1 sibling, 0 replies; 5+ messages in thread
From: Keir Fraser @ 2007-03-14 16:00 UTC (permalink / raw)
To: Jan Beulich, xen-devel
On 14/3/07 15:55, "Jan Beulich" <jbeulich@novell.com> wrote:
> Many places currently don't even check HYPERVISOR_multicall()'s return
> value, not to speak of checking the individual status codes. Would it be
> acceptable to add an argument to this function to request to either fold
> all status values into a global success code, or to force BUG_ON() each
> individual status. Or should I rather add a new function with described
> behavior? Or are there other suggestions?
I think a separate function would be neater, but I'm not sure what you'd
call it. :-) The general idea seems a good one.
-- Keir
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: return value checking on multicalls
2007-03-14 15:55 return value checking on multicalls Jan Beulich
2007-03-14 16:00 ` Keir Fraser
@ 2007-03-14 16:45 ` Jeremy Fitzhardinge
2007-03-14 16:58 ` Jan Beulich
1 sibling, 1 reply; 5+ messages in thread
From: Jeremy Fitzhardinge @ 2007-03-14 16:45 UTC (permalink / raw)
To: Jan Beulich; +Cc: xen-devel
Jan Beulich wrote:
> Many places currently don't even check HYPERVISOR_multicall()'s return
> value, not to speak of checking the individual status codes. Would it be
> acceptable to add an argument to this function to request to either fold
> all status values into a global success code, or to force BUG_ON() each
> individual status. Or should I rather add a new function with described
> behavior? Or are there other suggestions?
>
In the xen-pvops tree I made a general-purpose hypercall batching
mechanism, so that there's only one place which needs to check the
multicall return. Its interface is:
/* Multicalls */
struct multicall_space
{
struct multicall_entry *mc;
void *args;
};
/* Allocate room for a multicall and its args */
struct multicall_space xen_mc_entry(size_t args);
/* Flush all pending multicalls */
void xen_mc_flush(void);
/* Issue a multicall if we're not in lazy mode */
static inline void xen_mc_issue(void)
{
if (xen_get_lazy_mode() == PARAVIRT_LAZY_NONE)
xen_mc_flush();
}
xen_mc_flush() just BUGs if either the multicall hypercall itself fails,
or any of the constituent hypercalls.
J
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: return value checking on multicalls
2007-03-14 16:45 ` Jeremy Fitzhardinge
@ 2007-03-14 16:58 ` Jan Beulich
2007-03-14 17:02 ` Jeremy Fitzhardinge
0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2007-03-14 16:58 UTC (permalink / raw)
To: Jeremy Fitzhardinge; +Cc: xen-devel
>>> Jeremy Fitzhardinge <jeremy@goop.org> 14.03.07 17:45 >>>
>Jan Beulich wrote:
>> Many places currently don't even check HYPERVISOR_multicall()'s return
>> value, not to speak of checking the individual status codes. Would it be
>> acceptable to add an argument to this function to request to either fold
>> all status values into a global success code, or to force BUG_ON() each
>> individual status. Or should I rather add a new function with described
>> behavior? Or are there other suggestions?
>
>In the xen-pvops tree I made a general-purpose hypercall batching
>mechanism, so that there's only one place which needs to check the
>multicall return. Its interface is:
>
>/* Multicalls */
>struct multicall_space
>{
> struct multicall_entry *mc;
> void *args;
>};
>
>/* Allocate room for a multicall and its args */
>struct multicall_space xen_mc_entry(size_t args);
>
>/* Flush all pending multicalls */
>void xen_mc_flush(void);
>
>/* Issue a multicall if we're not in lazy mode */
>static inline void xen_mc_issue(void)
>{
> if (xen_get_lazy_mode() == PARAVIRT_LAZY_NONE)
> xen_mc_flush();
>}
>
>
>xen_mc_flush() just BUGs if either the multicall hypercall itself fails,
>or any of the constituent hypercalls.
Hmm, that doesn't seem to fit all cases. There are hypercalls that
return non-errno-like values, and you shouldn't make any
assumptions about these.
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: return value checking on multicalls
2007-03-14 16:58 ` Jan Beulich
@ 2007-03-14 17:02 ` Jeremy Fitzhardinge
0 siblings, 0 replies; 5+ messages in thread
From: Jeremy Fitzhardinge @ 2007-03-14 17:02 UTC (permalink / raw)
To: Jan Beulich; +Cc: xen-devel
Jan Beulich wrote:
> Hmm, that doesn't seem to fit all cases. There are hypercalls that
> return non-errno-like values, and you shouldn't make any
> assumptions about these.
It's been a nice simplification in my work, but I haven't used it with
anything where success > 0, or where I've even cared about results other
than failure. And the advantage is that the incremental effort of
batching a series of calls is very small.
I just thought it might be useful. Perhaps the interface could be
extended to be more useful in the cases you're looking at.
J
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-03-14 17:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-14 15:55 return value checking on multicalls Jan Beulich
2007-03-14 16:00 ` Keir Fraser
2007-03-14 16:45 ` Jeremy Fitzhardinge
2007-03-14 16:58 ` Jan Beulich
2007-03-14 17:02 ` Jeremy Fitzhardinge
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.