Received: by 10.223.176.5 with SMTP id f5csp554635wra; Wed, 7 Feb 2018 03:51:15 -0800 (PST) X-Google-Smtp-Source: AH8x226Q3qsaTFbNkHwJzX2OBIjqGFuseWi4tUWMRIoTxappRLp5awF2d77rrWjeLrjOOYuRKXaW X-Received: by 10.101.65.9 with SMTP id w9mr4752288pgp.214.1518004275252; Wed, 07 Feb 2018 03:51:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518004275; cv=none; d=google.com; s=arc-20160816; b=KMZKp9ysP4WSmAC4VBJS6yUP2/UkskNNF5tCHPSSIfaVPa4UPDoV4Zpdl/dO3+rS00 z7ws++b6iBKQf/+SZXNnKOG8qVQYEr/CFQbDyNDM2aRpB4nwagVHzyTmtlFiVSVY2tal D8Z1WL+ke/sM7QgAMpkMhABh3++osNsfj3kcjrQi2yCwAY6d2xlwGcduH5VdUYRaXKYb R9r//VGp1eCct/p3Ce4A+KmCMElVI+gulPpoCqRECNd6pauhFQDXdOHL4SWz2G8q3Llc sVye0S4K/Ywyx4pTKd/jCyAKPbDvzgz8FoV2MpBKJ6qIrJ52+9iFLeZK7a0khaIDPshB cpbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=jAWuHe3JfahbRv7dtdVBq2HJ+531/Vq1gB4xmCIITjU=; b=Hf60uVxiU+NVImhniUpDzOFAmSaANYSacfCcrO6Tg8KbMogniDEsTWz5ko1UDPgjfM Cv8CPAZyfl/QbOqy+xdx2QUC664uAdCUVZ1zlWkfw3TvgeIkZ0jQcTV6QVcqAkxexYPo yaotPfDE7i3GzGxpNijOadEq5weQ8uO7Kr9WHqsuqJtpnK0EqM91PuXHHPGB0HHUmSv7 4LB7z3vGDOLhJXN68cwtWbawUj1KohBQi5uCTWOFO7UDaHe8AniEyAVMwQBdv8Zv2IbA 3qsbVTfZFSPTWyia6Z7D+SVX7Qykcg+X4C4kJzE2hPSTllsn4BFdl2ZEImtQlGHgf0U7 npXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t66si1031294pfj.79.2018.02.07.03.51.01; Wed, 07 Feb 2018 03:51:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753969AbeBGLtp (ORCPT + 99 others); Wed, 7 Feb 2018 06:49:45 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:51066 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753470AbeBGLto (ORCPT ); Wed, 7 Feb 2018 06:49:44 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w17Bd1NJ030799 for ; Wed, 7 Feb 2018 06:49:43 -0500 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 2fyys1bsfs-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 07 Feb 2018 06:49:43 -0500 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 7 Feb 2018 11:49:41 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 7 Feb 2018 11:49:37 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w17BnbWk49807444; Wed, 7 Feb 2018 11:49:37 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F423A4C046; Wed, 7 Feb 2018 11:43:27 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8A8614C040; Wed, 7 Feb 2018 11:43:27 +0000 (GMT) Received: from mschwideX1 (unknown [9.152.212.220]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 7 Feb 2018 11:43:27 +0000 (GMT) Date: Wed, 7 Feb 2018 12:49:35 +0100 From: Martin Schwidefsky To: Pavel Machek Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, Heiko Carstens , Christian Borntraeger , Cornelia Huck , David Hildenbrand , Greg Kroah-Hartman , Jon Masters , Marcus Meissner , Jiri Kosina , Dominik Brodowski , Alan Cox , David Woodhouse Subject: Re: [PATCH 4/6] s390: add options to change branch prediction behaviour for the kernel In-Reply-To: <20180207100252.GA31392@amd> References: <1517986811-27819-1-git-send-email-schwidefsky@de.ibm.com> <1517986811-27819-5-git-send-email-schwidefsky@de.ibm.com> <20180207100252.GA31392@amd> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 18020711-0040-0000-0000-0000042D5391 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18020711-0041-0000-0000-000020D105F4 Message-Id: <20180207124935.46406c60@mschwideX1> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-02-07_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1802070149 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 7 Feb 2018 11:02:52 +0100 Pavel Machek wrote: > On Wed 2018-02-07 08:00:09, Martin Schwidefsky wrote: > > Add the PPA instruction to the system entry and exit path to switch > > the kernel to a different branch prediction behaviour. The instructions > > are added via CPU alternatives and can be disabled with the "nospec" > > or the "nobp=0" kernel parameter. If the default behaviour selected > > with CONFIG_KERNEL_NOBP is set to "n" then the "nobp=1" parameter can be > > used to enable the changed kernel branch prediction. > > > > Acked-by: Cornelia Huck > > Signed-off-by: Martin Schwidefsky > > --- > > arch/s390/Kconfig | 17 ++++++++++++++ > > arch/s390/include/asm/processor.h | 1 + > > arch/s390/kernel/alternative.c | 23 +++++++++++++++++++ > > arch/s390/kernel/early.c | 2 ++ > > arch/s390/kernel/entry.S | 48 +++++++++++++++++++++++++++++++++++++++ > > arch/s390/kernel/ipl.c | 1 + > > arch/s390/kernel/smp.c | 2 ++ > > 7 files changed, 94 insertions(+) > > > > diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig > > index 0105ce2..d514e25 100644 > > --- a/arch/s390/Kconfig > > +++ b/arch/s390/Kconfig > > @@ -540,6 +540,23 @@ config ARCH_RANDOM > > > > If unsure, say Y. > > > > +config KERNEL_NOBP > > + def_bool n > > + prompt "Enable modified branch prediction for the kernel by default" > > + help > > + If this option is selected the kernel will switch to a modified > > + branch prediction mode if the firmware interface is available. > > + The modified branch prediction mode improves the behaviour in > > + regard to speculative execution. > > + > > + With the option enabled the kernel parameter "nobp=0" or "nospec" > > + can be used to run the kernel in the normal branch prediction mode. > > + > > + With the option disabled the modified branch prediction mode is > > + enabled with the "nobp=1" kernel parameter. > > + > > + If unsure, say N. > > + > > This could use some improvement. > > Afaict the config option only changes the default behaviour? Do we > need the option in such case? (CONFIG_CMDLINE_APPEND can be useful to > avoid some options). # git grep CMDLINE_APPEND returns nothing. What are you referring to? The idea of this config option is that a distributor can decide what default behaviour the system should have if no command line parameter is specified. > Plus, it is not clear what "modified branch prediction mode is" and if > "improves behaviour" means "faster" or "safer". Naturally "improves behaviour in regard to speculative execution" is indicating that the system is safer. In general that means slower as well but as always it depends. What exactly is done is up to the machine. -- blue skies, Martin. "Reality continues to ruin my life." - Calvin.