From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x224EtCBmgo9ddkFkiIVDtNkYn2/D+edOO+3OKIPr+YP1nsU1TaMToYJ5KTqQKiPzZHZ6fCxq ARC-Seal: i=1; a=rsa-sha256; t=1517256399; cv=none; d=google.com; s=arc-20160816; b=K+KiM8MrtPJAkg3t9W7vDqb033iqQy9Ac/I5wVrp3KrLKMeDSezcS/zHKRPe3kpQlU 50e4RkxkpWiQVtP1vVxOA5m2TVSnJt8d9+kdln0X0hRCkpwH/iNEeKe+6iyHU1uhebIh liQMDmnPHOMFc7JPnHN+liqhaD85oEkTFeldLO/4qNoRFZH/lewUymhSWAnNaD7jVh2u Z+mMkSrPXxs0VAnKtmms1jozWsARiWfcsUVuvrLOCCn8q/+MYNi52PastUBhW7CCPD8P C5YDhW5RYW+L8ocNyv++yZZprKVAG3SIVKE+1KoFua2eReI/VKn7qp55DaOtf5iSKrD+ IyZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=ecYGfw8zovGK4A61xKfqnoUHMBagT9qjaCmrwstnHKc=; b=Y5AKEB1jgwOhkvOs11veevn97aiSMn4LEi3q5ZbWIjhBp5BHDSKbYiO9LaY+DsfKvY pyxANvuB8B2rKKWb+op3HO7+I6x70Ls+c/rWjZzqpFBtEfMme7yO1PBCxkwabRkMWK/q 0rAhDLm4/IUJGU/NsXIGBd46+8OupA/l7T92Ikv/mzpRHcK5fV5b0EhkvHX3CBCxsL+1 tJBdokD3P2OuuKhxUiynER1uq+ufHe1MXf2ehhkpTH/E0a9NFwqrfQbTObAY5tUYSW67 KWf36D2VgbzqN/eSXvPrdwVhpGZgXNbAPVMuyofyGhYSPwPcB4Xn6NeyLrenuqAu/c7c ZC4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org 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.9 10/66] Prevent timer value 0 for MWAITX Date: Mon, 29 Jan 2018 13:56:34 +0100 Message-Id: <20180129123840.369359665@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123839.842860149@linuxfoundation.org> References: <20180129123839.842860149@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1590958547022316582?= X-GMAIL-MSGID: =?utf-8?q?1590958645985970125?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.9-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 (;;) {