|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 7/9] x86: Merge xc_cpu_policy's cpuid and msr objects
On 29.03.2023 22:51, Andrew Cooper wrote:
> /* Sanity test various invariants we expect in the default/max policies. */
> static void test_guest_policies(const struct xc_cpu_policy *max,
> const struct xc_cpu_policy *def)
> {
> - const struct cpuid_policy *cm = &max->cpuid;
> - const struct cpuid_policy *cd = &def->cpuid;
> - const struct msr_policy *mm = &max->msr;
> - const struct msr_policy *md = &def->msr;
> + const struct cpu_policy *m = &max->policy;
> + const struct cpu_policy *d = &def->policy;
Looks like you could reduce code churn by keeping "cm" and "cd" as the
names, which would also be consistent with you continuing to use "cp"
in hypervisor code.
Jan
> dump_tsx_details(max, "Max:");
> dump_tsx_details(def, "Def:");
>
> - if ( ((cm->feat.raw[0].d | cd->feat.raw[0].d) &
> + if ( ((m->feat.raw[0].d | d->feat.raw[0].d) &
> (bitmaskof(X86_FEATURE_TSX_FORCE_ABORT) |
> bitmaskof(X86_FEATURE_RTM_ALWAYS_ABORT) |
> bitmaskof(X86_FEATURE_SRBDS_CTRL))) ||
> - ((mm->arch_caps.raw | md->arch_caps.raw) & ARCH_CAPS_TSX_CTRL) )
> + ((m->arch_caps.raw | d->arch_caps.raw) & ARCH_CAPS_TSX_CTRL) )
> fail(" Xen-only TSX controls offered to guest\n");
>
> switch ( rtm_behaviour )
> {
> case RTM_UD:
> - if ( (cm->feat.raw[0].b | cd->feat.raw[0].b) &
> + if ( (m->feat.raw[0].b | d->feat.raw[0].b) &
> (bitmaskof(X86_FEATURE_HLE) | bitmaskof(X86_FEATURE_RTM)) )
> fail(" HLE/RTM offered to guests despite not being
> available\n");
> break;
>
> case RTM_ABORT:
> - if ( cd->feat.raw[0].b &
> + if ( d->feat.raw[0].b &
> (bitmaskof(X86_FEATURE_HLE) | bitmaskof(X86_FEATURE_RTM)) )
> fail(" HLE/RTM offered to guests by default despite not being
> usable\n");
> break;
>
> case RTM_OK:
> - if ( !cm->feat.rtm || !cd->feat.rtm )
> + if ( !m->feat.rtm || !d->feat.rtm )
> fail(" RTM not offered to guests despite being available\n");
> break;
> }
>
> - if ( cd->feat.hle )
> + if ( d->feat.hle )
> fail(" Fail: HLE offered in default policy\n");
> }
>
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |