From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: ACJfBovFirFUYSfYQbK6wiIfFf71T1rLm43wqLgiDbKhq1ADEbi3jcg6hzx36Cz8Q2sCfhzOAOf/ ARC-Seal: i=1; a=rsa-sha256; t=1516337647; cv=none; d=google.com; s=arc-20160816; b=NWo+TTg1TmEYD6VrdsU+g0OjOwbXYcwQL8RtnciLMJzay4Wq8Ovvs5TTOG0YegjEKt gqVl83gkHZglcVWXM1JHNVvovS0ieYibTIvM5+LebKcgUIpHGBcwntmryMRXqnppwUlJ 5S0cwDdyeUK3/LZvXT4i1FbCLq8bcLDsxkeCU4uKiPJcP4cwK3sZM9k/YL4/OytLUYkC vDuib2ITw9xWCv0x1VivJFMlmu2PsRB+FYUeG/48/yAnS00Tq0Hk6hq5iBLfxa/vSeNh EpxM4FmwXl6kw/SuGt2mwgBEp7eaONqKwl6OyYBD0edhphJM9TfhsmTt2aaYcYs2VuVO 06QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:content-transfer-encoding:in-reply-to:mime-version :user-agent:date:from:references:cc:to:subject :arc-authentication-results; bh=b01XGpDd8vZa2qrjuGvYRbuKSg1j4JF4eTKkuYU+rtE=; b=KKAJ6RDs6Z0MtmbdRGbNDgIhJk3ceQMwKOS0V8CGQ6FEiZ41opSJ2zPp1RjOcyZPFQ 3cYPj+Q2E2k0qPVvxXFUWtVGrHozfrjjQ0PmwCEj2eYa+PtedrNL7o7QVr1jOmgDEx5u 83uLRETUmEV8GAgkygkDiKFMhR0uC5Mh2VUok8TW87Fr+w+XBx9VTjsgnrpYM73w20In Y7Cg+v9e68sDi/c7ad39e8CU7AIck7Z6AeVVVoq+UlgUX8DjBTv0DGZMu6M52Err+xmJ hXY9zZ0XnnseZTbwi5Ta9RGRPYTSO1eGXtnTnkQXliH5IuMO2z+c6D7Xn3I/YY+bqDP9 clBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of haoqf@linux.vnet.ibm.com) smtp.mailfrom=haoqf@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of haoqf@linux.vnet.ibm.com) smtp.mailfrom=haoqf@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Subject: Re: [PATCH 3/6] s390: add options to change branch prediction behaviour for the kernel To: Martin Schwidefsky , linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org Cc: Heiko Carstens , Paolo Bonzini , Cornelia Huck , Greg Kroah-Hartman , Jon Masters , Marcus Meissner , Jiri Kosina References: <1516182519-10623-1-git-send-email-schwidefsky@de.ibm.com> <1516182519-10623-4-git-send-email-schwidefsky@de.ibm.com> From: QingFeng Hao Date: Fri, 19 Jan 2018 12:53:40 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <1516182519-10623-4-git-send-email-schwidefsky@de.ibm.com> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 18011904-0036-0000-0000-000002AF0EF2 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008404; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000247; SDB=6.00977120; UDB=6.00495390; IPR=6.00757042; BA=6.00005782; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00019121; XFM=3.00000015; UTC=2018-01-19 04:54:04 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18011904-0037-0000-0000-0000430AD09F Message-Id: <4f27802d-9cdd-ed59-f892-92803f9a4986@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-19_01:,, 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=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1801190057 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1589832613617096388?= X-GMAIL-MSGID: =?utf-8?q?1589995265390052169?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: ÔÚ 2018/1/17 17:48, Martin Schwidefsky дµÀ: > 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: Christian Borntraeger > 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 | 50 ++++++++++++++++++++++++++++++++++++++- > arch/s390/kernel/ipl.c | 1 + > arch/s390/kernel/smp.c | 2 ++ > 7 files changed, 95 insertions(+), 1 deletion(-) > > diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig > index 829c679..a818644 100644 > --- a/arch/s390/Kconfig > +++ b/arch/s390/Kconfig > @@ -541,6 +541,23 @@ config ARCH_RANDOM > > If unsure, say Y. > > +config KERNEL_NOBP Just a question that can we add the control in proc system to enable/disable the facilities for the whole system by default? Each process can still overwrite the default setting. This may provide more flexibility for the operator to choose and debug as well without rebooting the system. e.g. echo 0 > /sys/kernel/debug/s390x/ibpb_enabled Ref: https://access.redhat.com/articles/3311301 > + 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. > + > endmenu [...] -- Regards QingFeng Hao