linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Anton Blanchard <anton@au1.ibm.com>
Cc: Alexander Graf <agraf@suse.de>,
	Alexey Kardashevskiy <aik@ozlabs.ru>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Paul Mackerras <paulus@samba.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Michael Neuling <mikey@neuling.org>,
	linuxppc-dev@lists.ozlabs.org, qemu-devel@nongnu.org,
	qemu-ppc@nongnu.org
Subject: Re: [PATCH 2/2] spapr: Better handling of ibm,pa-features TM bit
Date: Wed, 8 Jun 2016 12:26:02 +1000	[thread overview]
Message-ID: <20160608022602.GU9226@voom.fritz.box> (raw)
In-Reply-To: <20160607223210.2b1b42ae@kryten>

[-- Attachment #1: Type: text/plain, Size: 2865 bytes --]

On Tue, Jun 07, 2016 at 10:32:10PM +1000, Anton Blanchard wrote:
> From: Anton Blanchard <anton@samba.org>
> 
> There are a few issues with our handling of the ibm,pa-features
> TM bit:
> 
> - We don't support transactional memory in PR KVM, so don't tell
>   the OS that we do.
> 
> - In full emulation we have a minimal implementation of TM that always
>   fails, so for performance reasons lets not tell the OS that we
>   support it either.
> 
> - In HV KVM mode, we should mirror the host TM enabled state by
>   looking at the AT_HWCAP2 bit.
> 
> Signed-off-by: Anton Blanchard <anton@samba.org>

So, we certainly need a change like this.  I'm not entirely happy with
the current implementation though.

> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 0636642..c403fbb 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -620,7 +620,7 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset,
>          0xf6, 0x1f, 0xc7, 0xc0, 0x80, 0xf0,
>          0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
>          0x00, 0x00, 0x00, 0x00, 0x80, 0x00,
> -        0x80, 0x00, 0x80, 0x00, 0x80, 0x00 };
> +        0x80, 0x00, 0x80, 0x00, 0x00, 0x00 };
>      uint8_t *pa_features;
>      size_t pa_size;
>  
> @@ -697,6 +697,19 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset,
>      } else /* env->mmu_model == POWERPC_MMU_2_07 */ {
>          pa_features = pa_features_207;
>          pa_size = sizeof(pa_features_207);
> +
> +#ifdef CONFIG_KVM
> +        /* Only enable TM in HV KVM mode */
> +        if (kvm_enabled() &&
> +            !kvm_vm_check_extension(cs->kvm_state, KVM_CAP_PPC_GET_PVINFO)) {
> +            unsigned long hwcap2 = qemu_getauxval(AT_HWCAP2);
> +
> +            /* Guest should inherit host TM enabled bit */
> +            if (hwcap2 & PPC_FEATURE2_HAS_HTM) {
> +                pa_features[24] |= 0x80;
> +            }
> +        }
> +#endif

So first, I think this stanza wants to move into target-ppc/kvm.c -
maybe a kvm_filter_pa_features() call or something.

Second, although using PVINFO to determine if we have HV KVM is a
standard trick, we don't want to use it as our first option.  We
really want to introduce an actual KVM CAP flag for TM support, then
fall back to checking PVINFO if we can't use that.

I wonder if we actually want to just blanket disable TM in one patch -
since it doesn't work at all with PR KVM, and "works" only in the most
rules-lawyering and useless way on TCG.  Then re-enable it on HV KVM
in a second patch.

>      }
>      if (env->ci_large_pages) {
>          pa_features[3] |= 0x20;
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-06-08  2:26 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-04  6:44 PR KVM and TM issues Anton Blanchard
2016-04-04  7:00 ` Alexey Kardashevskiy
2016-04-04 10:43   ` Anton Blanchard
2016-04-04 11:09     ` [PATCH] spapr: Don't set the TM ibm,pa-features bit in PR KVM mode Anton Blanchard
2016-04-04 11:13       ` [PATCH] spapr: Don't set the TM ibm, pa-features " Alexander Graf
2016-04-30  0:48         ` [PATCH v2] spapr: Don't set the TM ibm,pa-features " Anton Blanchard
2016-05-02  9:36           ` [Qemu-devel] [PATCH v2] spapr: Don't set the TM ibm, pa-features " haris iqbal
2016-05-27  4:52           ` David Gibson
2016-06-07 12:28           ` [PATCH 1/2] Add PowerPC AT_HWCAP2 definitions Anton Blanchard
2016-06-07 12:32             ` [PATCH 2/2] spapr: Better handling of ibm,pa-features TM bit Anton Blanchard
2016-06-08  2:26               ` David Gibson [this message]
2016-07-05  5:19                 ` [PATCH 0/3] Rework spapr: Better handling of ibm, pa-features " Sam Bobroff
2016-07-05  5:19                   ` [PATCH 1/3] spapr: Disable ibm, pa-features HTM bit Sam Bobroff
2016-07-05  5:51                     ` David Gibson
2016-07-05  5:19                   ` [PATCH 2/3] Add KVM_CAP_PPC_HTM to linux/kvm.h Sam Bobroff
2016-07-05  6:05                     ` David Gibson
2016-07-06  4:41                       ` Sam Bobroff
2016-07-06  5:09                         ` David Gibson
2016-07-05  5:19                   ` [PATCH 3/3] spapr: Set ibm, pa-features HTM from KVM_CAP_PPC_HTM Sam Bobroff
2016-07-05  6:52                     ` David Gibson
2016-07-06  5:35                   ` [PATCH v2 0/3] Rework spapr: Better handling of ibm, pa-features TM bit Sam Bobroff
2016-07-06  5:35                     ` [PATCH v2 1/3] spapr: Disable ibm, pa-features HTM bit Sam Bobroff
2016-07-07  4:38                       ` David Gibson
2016-07-06  5:35                     ` [PATCH v2 2/3] Add KVM_CAP_PPC_HTM to linux/kvm.h Sam Bobroff
2016-07-07  4:38                       ` David Gibson
2016-07-06  5:35                     ` [PATCH v2 3/3] spapr: Set ibm, pa-features HTM from KVM_CAP_PPC_HTM Sam Bobroff
2016-07-07  4:39                       ` David Gibson
2016-06-08  2:19             ` [PATCH 1/2] Add PowerPC AT_HWCAP2 definitions David Gibson
2016-04-05  2:12       ` [PATCH] spapr: Don't set the TM ibm,pa-features bit in PR KVM mode Paul Mackerras
2016-04-05  4:09         ` David Gibson
2016-04-05  7:33           ` Alexey Kardashevskiy
2016-04-04 11:11     ` [PATCH] powerpc: Clear user CPU feature bits if TM is disabled at runtime Anton Blanchard
2016-04-05  0:52       ` David Gibson
2016-04-05  9:35       ` Michael Ellerman
2016-04-05  9:56         ` Benjamin Herrenschmidt
2016-04-05 22:40           ` Michael Ellerman
2016-04-15  2:06       ` [PATCH 1/3] powerpc: scan_features() updates incorrect bits Anton Blanchard
2016-04-15 14:27         ` [1/3] " Michael Ellerman
2016-04-18  4:40           ` Michael Ellerman
2016-04-18  4:16         ` Michael Ellerman
2016-04-18 10:36         ` [PATCH v2 1/3] powerpc: scan_features() updates incorrect bits for REAL_LE Michael Ellerman
2016-04-19 10:09           ` [v2, " Michael Ellerman
2016-04-15  2:07       ` [PATCH 2/3] powerpc: Update cpu_user_features2 in scan_features() Anton Blanchard
2016-04-19 10:09         ` [2/3] " Michael Ellerman
2016-04-15  2:08       ` [PATCH 3/3] powerpc: Update TM user feature bits " Anton Blanchard
2016-04-19 10:09         ` [3/3] " Michael Ellerman
2016-04-04 11:09   ` PR KVM and TM issues Michael Neuling
2016-04-05  7:29     ` Alexey Kardashevskiy

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=20160608022602.GU9226@voom.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=agraf@suse.de \
    --cc=aik@ozlabs.ru \
    --cc=anton@au1.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mikey@neuling.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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).