From: Andrea Bolognani <abologna@redhat.com>
To: Suraj Jitindar Singh <sjitindarsingh@gmail.com>, qemu-ppc@nongnu.org
Cc: paulus@ozlabs.org, qemu-devel@nongnu.org, david@gibson.dropbear.id.au
Subject: Re: [Qemu-devel] [Qemu-ppc] [QEMU-PPC] [RFC 1/3] hw/ppc/spapr_caps: Rework spapr_caps to use uint8 internal representation
Date: Tue, 09 Jan 2018 13:07:01 +0100 [thread overview]
Message-ID: <1515499621.3287.17.camel@redhat.com> (raw)
In-Reply-To: <20180109092103.18458-2-sjitindarsingh@gmail.com>
On Tue, 2018-01-09 at 20:21 +1100, Suraj Jitindar Singh wrote:
[...]
> +static void cap_htm_allow(sPAPRMachineState *spapr, uint8_t val, Error **errp)
> +{
> + if (!val) {
> + /* TODO: We don't support disabling htm yet */
> + return;
> + }
> if (tcg_enabled()) {
> error_setg(errp,
> - "No Transactional Memory support in TCG, try cap-htm=off");
> + "No Transactional Memory support in TCG, try cap-htm=0");
> } else if (kvm_enabled() && !kvmppc_has_cap_htm()) {
> error_setg(errp,
> -"KVM implementation does not support Transactional Memory, try cap-htm=off"
> +"KVM implementation does not support Transactional Memory, try cap-htm=0"
> );
> }
> }
Changing the command-line interface from off/on to 0/1 seems
unnecessary, given that broken/workaround/fixed are used for the
capabilities you introduce later in the series. off/on look much
better IMHO.
[...]
> -static bool spapr_caps_needed(void *opaque)
> -{
> - sPAPRMachineState *spapr = opaque;
> -
> - return (spapr->forced_caps.mask != 0) || (spapr->forbidden_caps.mask != 0);
> -}
> -
> /* This has to be called from the top-level spapr post_load, not the
> * caps specific one. Otherwise it wouldn't be called when the source
> * caps are all defaults, which could still conflict with overridden
> * caps on the destination */
> int spapr_caps_post_migration(sPAPRMachineState *spapr)
> {
> - uint64_t allcaps = 0;
> int i;
> bool ok = true;
> sPAPRCapabilities dstcaps = spapr->effective_caps;
> sPAPRCapabilities srccaps;
>
> srccaps = default_caps_with_cpu(spapr, first_cpu);
> - srccaps.mask |= spapr->mig_forced_caps.mask;
> - srccaps.mask &= ~spapr->mig_forbidden_caps.mask;
> + for (i = 0; i < SPAPR_CAP_NUM; i++) {
> + if (spapr->mig_caps.caps[i] & SPAPR_CAP_CMD_LINE) {
> + srccaps.caps[i] = spapr->mig_caps.caps[i] & ~SPAPR_CAP_CMD_LINE;
> + }
> + }
>
> - for (i = 0; i < ARRAY_SIZE(capability_table); i++) {
> + for (i = 0; i < SPAPR_CAP_NUM; i++) {
> sPAPRCapabilityInfo *info = &capability_table[i];
>
> - allcaps |= info->flag;
> -
> - if ((srccaps.mask & info->flag) && !(dstcaps.mask & info->flag)) {
> - error_report("cap-%s=on in incoming stream, but off in destination",
> - info->name);
> + if (srccaps.caps[i] > dstcaps.caps[i]) {
> + error_report("cap-%s higher level (%d) in incoming stream than on destination (%d)",
> + info->name, srccaps.caps[i], dstcaps.caps[i]);
> ok = false;
> }
>
> - if (!(srccaps.mask & info->flag) && (dstcaps.mask & info->flag)) {
> - warn_report("cap-%s=off in incoming stream, but on in destination",
> - info->name);
> + if (srccaps.caps[i] < dstcaps.caps[i]) {
> + warn_report("cap-%s lower level (%d) in incoming stream than on destination (%d)",
> + info->name, srccaps.caps[i], dstcaps.caps[i]);
> }
> }
These numeric comparisons make me feel very uneasy :)
What if we need to add more possible values down the line? Should
there be at least some room between existing values to avoid painting
ourselves in a corner? Eg. instead of using 0/1/2 use 20/40/60...
You clearly know more about the problem than I do, so feel free to
dismiss all of the above... I thought I would bring up my worries
just in case :)
--
Andrea Bolognani / Red Hat / Virtualization
next prev parent reply other threads:[~2018-01-09 12:07 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-09 9:21 [Qemu-devel] [QEMU-PPC] [RFC 0/3] target/ppc: Rework spapr_caps Suraj Jitindar Singh
2018-01-09 9:21 ` [Qemu-devel] [QEMU-PPC] [RFC 1/3] hw/ppc/spapr_caps: Rework spapr_caps to use uint8 internal representation Suraj Jitindar Singh
2018-01-09 11:13 ` [Qemu-devel] [Qemu-ppc] " Murilo Opsfelder Araújo
2018-01-10 0:21 ` Suraj Jitindar Singh
2018-01-09 12:07 ` Andrea Bolognani [this message]
2018-01-10 0:19 ` Suraj Jitindar Singh
2018-01-10 2:51 ` David Gibson
2018-01-10 4:13 ` [Qemu-devel] " David Gibson
2018-01-12 2:19 ` Suraj Jitindar Singh
2018-01-09 9:21 ` [Qemu-devel] [QEMU-PPC] [RFC 2/3] hw/spapr/spapr_caps: Add new caps safe_[cache/bounds_check/indirect_branch] Suraj Jitindar Singh
2018-01-09 11:15 ` [Qemu-devel] [Qemu-ppc] " Murilo Opsfelder Araújo
2018-01-10 0:25 ` Suraj Jitindar Singh
2018-01-09 12:02 ` [Qemu-devel] " joserz
2018-01-10 0:23 ` Suraj Jitindar Singh
2018-01-10 4:54 ` David Gibson
2018-01-09 9:21 ` [Qemu-devel] [QEMU-PPC] [RFC 3/3] target/ppc: Add H-Call H_GET_CPU_CHARACTERISTICS Suraj Jitindar Singh
2018-01-09 11:19 ` [Qemu-devel] [Qemu-ppc] " Murilo Opsfelder Araújo
2018-01-10 0:26 ` Suraj Jitindar Singh
2018-01-10 5:02 ` [Qemu-devel] " David Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1515499621.3287.17.camel@redhat.com \
--to=abologna@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=paulus@ozlabs.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=sjitindarsingh@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).