Received: by 10.223.176.5 with SMTP id f5csp3442219wra; Mon, 29 Jan 2018 13:14:27 -0800 (PST) X-Google-Smtp-Source: AH8x227VSY96CioH7Fz58wJ4tUmDarkBareFGlN5SGnslWD7T/JdrTQpkRYiirtg0XXJlVE6rQkt X-Received: by 2002:a17:902:bd47:: with SMTP id b7-v6mr22939122plx.300.1517260467833; Mon, 29 Jan 2018 13:14:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517260467; cv=none; d=google.com; s=arc-20160816; b=O8ruQBDfrtyU7kgBhRSbC8zV3bJAgXitPxg6J9bu/y02nuvViuwPMjIp+Dq1Df/NIo 7Z8875o37m3O5lxBQEeB/f9qI4tK0Z5Lc4ajc1vRy7qqYBR4An6LtRgM+eTnxPsgvsYx KVxvY26ArM3l6QPKhMWsbFxL+3es3q82BS8/n4t9YVH0ExmeU7Z/G7QrvPwuDSWbWj5U a+IAASnN11uv+oGgcYqRfAaoOTlVmukP0jv0NDPkxRu8mm7gMECjrFe6xCq98wEMa/VL tr6vOpsePT6RBszM+dmxeaq740HxkS9Y1FSvzUMd4d5p9pZK5gbpdVzIm/RQYtYpfDf5 88Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=tX26Ikug4Kl+BrWpwJCD/zSkhCiI0ufN+lAtPjV/0fI=; b=BS2mhPh671mxQiPPQqUyWcDJt68pRiwq2k1njkC6PqNhVvVTRojFwXkLx1tmP7pSei wT9jcs/stKYIg7/98kT7FKUdzu7f8rdntnFb2m7jHwJni78HfU+KLSzuL/05DAoc9lTQ nTTL6doFpeorx+iarfr9KcgQcUuUBbV2gmDh2/X8RIu9AEM7ZcNjT4smQNKO5zeEdnPz lMWEt+r8uR0wan3YOUopgUq5IF+kKH3HjJ9IOIrVYirYhXa+UfNCZbnfUdttFSvBfY5u wUiXXHCaOQiYsmaNdfCIwV5Z8g3GwI1Chry2Ns91lBLZlHXNXGmBa/7E2tke/jeSYKQq nC0w== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bb5-v6si7328087plb.93.2018.01.29.13.14.13; Mon, 29 Jan 2018 13:14:27 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752379AbeA2VNh (ORCPT + 99 others); Mon, 29 Jan 2018 16:13:37 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:44684 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752437AbeA2UFE (ORCPT ); Mon, 29 Jan 2018 15:05:04 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 685712EF1; Mon, 29 Jan 2018 13:01:18 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Janakarajan Natarajan , Thomas Gleixner , Davidlohr Bueso Subject: [PATCH 4.4 14/74] Prevent timer value 0 for MWAITX Date: Mon, 29 Jan 2018 13:56:19 +0100 Message-Id: <20180129123848.227806021@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123847.507563674@linuxfoundation.org> References: <20180129123847.507563674@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Janakarajan Natarajan commit 88d879d29f9cc0de2d930b584285638cdada6625 upstream. Newer hardware has uncovered a bug in the software implementation of using MWAITX for the delay function. A value of 0 for the timer is meant to indicate that a timeout will not be used to exit MWAITX. On newer hardware this can result in MWAITX never returning, resulting in NMI soft lockup messages being printed. On older hardware, some of the other conditions under which MWAITX can exit masked this issue. The AMD APM does not currently document this and will be updated. Please refer to http://marc.info/?l=kvm&m=148950623231140 for information regarding NMI soft lockup messages on an AMD Ryzen 1800X. This has been root-caused as a 0 passed to MWAITX causing it to wait indefinitely. This change has the added benefit of avoiding the unnecessary setup of MONITORX/MWAITX when the delay value is zero. Signed-off-by: Janakarajan Natarajan Link: http://lkml.kernel.org/r/1493156643-29366-1-git-send-email-Janakarajan.Natarajan@amd.com Signed-off-by: Thomas Gleixner Signed-off-by: Davidlohr Bueso Signed-off-by: Greg Kroah-Hartman --- arch/x86/lib/delay.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/arch/x86/lib/delay.c +++ b/arch/x86/lib/delay.c @@ -93,6 +93,13 @@ static void delay_mwaitx(unsigned long _ { u64 start, end, delay, loops = __loops; + /* + * Timer value of 0 causes MWAITX to wait indefinitely, unless there + * is a store on the memory monitored by MONITORX. + */ + if (loops == 0) + return; + start = rdtsc_ordered(); for (;;) {