Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1232397imu; Thu, 20 Dec 2018 12:30:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/UWV6DX9J8SxhAL2vfkP0JbYaY35Ads0WzBQt++SVFmqNfpcGGdpPXlxAaMpz6vLb4SaHga X-Received: by 2002:a63:f412:: with SMTP id g18mr21350506pgi.262.1545337818475; Thu, 20 Dec 2018 12:30:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545337818; cv=none; d=google.com; s=arc-20160816; b=GP/qIeN9DBb+0P26Vskv4hkVsc2qBoqrY8PVqV4FahqkipXn8r0Op1/Fr5klplrS0q QZZ/4evnVAkShG4KYYyrSK9j7eNfS2hfaX35M8iuG3dx6L4J2mkXAEVbtANoLL2Vu2uS uX2Mh/M38xZWtVpYTOAppvkVI0ckkYiPcQChTK4KcGJb+J+hrlnlRumbFGb+TqWtfG5z ljoFhL2am7391uAwJBpNKzIdEdvX0q+FJGjkqQbppctAKPsuofNu7g34OX04ozuhFHFH jBxAELbNEb9/KrmXy/yYeUHEdkgMQ/1Hqb/eDcMwWcE2jCEHjtPNjOtaK25mbFgTR3Rt m/nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=7gIHMmTJdU/Rsd6pXU57Ykrn1eHixtWRi+dj/zbn2Mo=; b=XMoQHFSll7mAAcEiRuCmRgSwuHJcoNrPg7IVG2sdfgoqyhm6nEd3zgO20dy7tcIbhN vtqZpMtDyQlJ7lxMEVt4LhocDIS7BzJWu+mB6s0gWmraQcQq5HywyZhWs9jhQsUVKeQ5 xU59Gj/OXeKdfqn80YUKUutd12y3FTG5wgp4aXxMs99APB2MviPHYU/zeR/w+nYoBPMx S5iBff7L2IP1lpHU0sGRX8J+9Pv2dWsrgEllCARkpJLOr5XxL39/YREpT2mUYCCyeGrG pCTwRTaGxu+YyNsqgU8Ti8JcsTYCOXONiWvszQks1OKP0j4mpq1fXxmarsO3XkdDRxKi iAmw== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 4si20058889pfg.280.2018.12.20.12.30.01; Thu, 20 Dec 2018 12:30:18 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732671AbeLTNku (ORCPT + 99 others); Thu, 20 Dec 2018 08:40:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46068 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729096AbeLTNku (ORCPT ); Thu, 20 Dec 2018 08:40:50 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 62410A0E66; Thu, 20 Dec 2018 13:40:50 +0000 (UTC) Received: from vitty.brq.redhat.com (unknown [10.43.2.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01FCE2A19D; Thu, 20 Dec 2018 13:40:47 +0000 (UTC) From: Vitaly Kuznetsov To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Fenghua Yu , Reinette Chatre , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , =?UTF-8?q?Jan=20H=20=2E=20Sch=C3=B6nherr?= , David Duncan Subject: [PATCH] x86/intel_rdt: use rdmsr_safe() to workaround AWS host issue Date: Thu, 20 Dec 2018 14:40:46 +0100 Message-Id: <20181220134046.7916-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 20 Dec 2018 13:40:50 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It was found that AWS x1 instances (Xen-based) lack xen.git commit 1f1d183d4900 (x86/HVM: don't give the wrong impression of WRMSR succeeding) and because of that the wrmsr_safe() check in cache_alloc_hsw_probe() doesn't help: the consequent rdmsr() blows up with unchecked MSR access error: RDMSR from 0xc90 at rIP: 0xffffffff88c5bba3 (native_read_msr+0x3/0x30) The issue should definitely get fixed on AWS side. We can, however, simply workaround this in Linux and live happily after. Signed-off-by: Vitaly Kuznetsov --- arch/x86/kernel/cpu/intel_rdt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/intel_rdt.c b/arch/x86/kernel/cpu/intel_rdt.c index 44272b7107ad..0acee6cd07a8 100644 --- a/arch/x86/kernel/cpu/intel_rdt.c +++ b/arch/x86/kernel/cpu/intel_rdt.c @@ -213,7 +213,8 @@ static inline void cache_alloc_hsw_probe(void) if (wrmsr_safe(IA32_L3_CBM_BASE, max_cbm, 0)) return; - rdmsr(IA32_L3_CBM_BASE, l, h); + if (rdmsr_safe(IA32_L3_CBM_BASE, &l, &h)) + return; /* If all the bits were set in MSR, return success */ if (l != max_cbm) -- 2.19.2