[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] powerpc: Clear user CPU feature bits if TM is d
From: |
David Gibson |
Subject: |
Re: [Qemu-devel] [PATCH] powerpc: Clear user CPU feature bits if TM is disabled at runtime |
Date: |
Tue, 5 Apr 2016 10:52:30 +1000 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
On Mon, Apr 04, 2016 at 09:11:12PM +1000, Anton Blanchard wrote:
> In check_cpu_pa_features() we check a number of bits in the
> ibm,pa-features array and set and clear CPU features based on what
> we find. One of these bits is CPU_FTR_TM, the transactional memory
> feature bit.
>
> If this does disable TM at runtime, then we need to tell userspace
> about it by clearing the user CPU feature bits.
>
> Without this patch userspace processes will think they can execute
> TM instructions and get killed when they try.
>
> Signed-off-by: Anton Blanchard <address@hidden>
Reviewed-by: David Gibson <address@hidden>
> Cc: address@hidden
> ---
>
> Michael I've added stable here because I'm seeing this on a number
> of distros and would like to get it backported, but I'll leave it up
> to you if it should go there.
>
> diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
> index f98be83..98c6c86 100644
> --- a/arch/powerpc/kernel/setup_64.c
> +++ b/arch/powerpc/kernel/setup_64.c
> @@ -822,4 +822,18 @@ static int __init disable_hardlockup_detector(void)
> return 0;
> }
> early_initcall(disable_hardlockup_detector);
> +
> +static int __init update_cpu_user_features(void)
> +{
> + /*
> + * Firmware might have disabled TM by clearing the relevant
> + * bit in the ibm,pa-features array. In this case we need to
> + * tell userspace.
> + */
> + if (!cpu_has_feature(CPU_FTR_TM))
> + cur_cpu_spec->cpu_user_features2 &=
> ~(PPC_FEATURE2_HTM|PPC_FEATURE2_HTM_NOSC);
> +
> + return 0;
> +}
> +early_initcall(update_cpu_user_features);
> #endif
>
--
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
signature.asc
Description: PGP signature
- Re: [Qemu-devel] PR KVM and TM issues, Anton Blanchard, 2016/04/04
- [Qemu-devel] [PATCH] powerpc: Clear user CPU feature bits if TM is disabled at runtime, Anton Blanchard, 2016/04/04
- [Qemu-devel] [PATCH 1/3] powerpc: scan_features() updates incorrect bits, Anton Blanchard, 2016/04/14
- Re: [Qemu-devel] [1/3] powerpc: scan_features() updates incorrect bits, Michael Ellerman, 2016/04/18
- [Qemu-devel] [PATCH v2 1/3] powerpc: scan_features() updates incorrect bits for REAL_LE, Michael Ellerman, 2016/04/18
- Re: [Qemu-devel] [v2, 1/3] powerpc: scan_features() updates incorrect bits for REAL_LE, Michael Ellerman, 2016/04/19
[Qemu-devel] [PATCH 2/3] powerpc: Update cpu_user_features2 in scan_features(), Anton Blanchard, 2016/04/14