On 12/11/2021 09:57, Jan Beulich wrote:
On 11.11.2021 18:57, Andrew Cooper wrote:
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1234,15 +1234,18 @@ int vcpu_unpause_by_systemcontroller(struct vcpu *v)
return 0;
}
-static void do_domain_pause(struct domain *d,
- void (*sleep_fn)(struct vcpu *v))
+static void _domain_pause(struct domain *d, bool sync /* or nosync */)
{
struct vcpu *v;
atomic_inc(&d->pause_count);
- for_each_vcpu( d, v )
- sleep_fn(v);
+ if ( sync )
+ for_each_vcpu ( d, v )
+ vcpu_sleep_sync(v);
+ else
+ for_each_vcpu ( d, v )
+ vcpu_sleep_nosync(v);
Is this really better (for whichever reason) than
for_each_vcpu ( d, v )
{
if ( sync )
vcpu_sleep_sync(v);
else
vcpu_sleep_nosync(v);
}
?
Yes. For cases where it can't be optimised out via constant
propagation, it removes a conditional branch from the middle of a loop.
I forget what the name for the compiler pass which does this is, but it
makes a big difference given the way that L0 instruction caches and
loop-stream-detectors/etc are build.
~Andrew