Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1067266imu; Thu, 20 Dec 2018 09:33:09 -0800 (PST) X-Google-Smtp-Source: AFSGD/VHpa3m0txDo0jk1qEM8qAmQ9pfO7Kac8q/L7vK23uUG90w5RrhJAX1UPFeevYM5OjYDcKc X-Received: by 2002:a63:78cd:: with SMTP id t196mr23912317pgc.62.1545327189759; Thu, 20 Dec 2018 09:33:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545327189; cv=none; d=google.com; s=arc-20160816; b=bTt8/hzvcjg6GS/906rqH+Mr45u215WTAnX6EIrOkgyaK8iP3bSq/HGd6C3ROlns+g E9EsOWX9i4eH+rfnT2VzU4hMF73DF4mo0wUK6ukMo2jgQQvXJttbaVO3ZMRiavT+1sBt zsvEMe71lyLq/7ziGEGDVDfjQqZAqZ0aVQpZeS2HRBMmHSuUZxx+H2PNIo8dKJ+vgsnj JQvMQfddntNP08GDN5IfbyBYzxKR09F4EyOx5IaP2yyvNB57X0U1o0U0kZFtwoJyo0fB ENjhoEytogOylcIrveINBKqfJz/dusJtimFM9s7j8l+3dQtBZUKT3gIfNW/lCl8w4tKc DhWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=E409qkGvU0+oz8zRAjLHGwJn04bj/IJ4H9mZRKRHhXI=; b=Dua9WSxaeciKlTJDkGIiYQviM1eEr4ItOXdOLYWV1qCyVuUP/lxQupZH5NlDA+dB1j WWtYECydQuvyI2KGKHbVkpLr3+O6mF8tr00SYpviRWMSbAwAD3SO2Kq+8tscbGkTc/jN C5MLRf/Wa9YJzEnCfdT+BFVIu4jXVD9zlvu9eZLG2TJ4ksHr28scgD44aAtOqBNl0f/x DqEmORZ7jvBvgyxmDDNVMP56geMOPm1XS2/D/DmSIaP0K6jETD8tFCY/DZ6fKn0vvaYz vh4jRwXKxSjKP0J+qokzmDNiJ0/RQrPoQ+cy2n4pp4igtX1HwCnsvMXbsi2hClKd0s+w mT8Q== 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 g32si17236222pgg.400.2018.12.20.09.32.53; Thu, 20 Dec 2018 09:33:09 -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 S2387811AbeLTRbj (ORCPT + 99 others); Thu, 20 Dec 2018 12:31:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41030 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387543AbeLTRbj (ORCPT ); Thu, 20 Dec 2018 12:31:39 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EEE383C2CDB; Thu, 20 Dec 2018 17:31:38 +0000 (UTC) Received: from vitty.brq.redhat.com.redhat.com (unknown [10.43.2.155]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 587F260DB7; Thu, 20 Dec 2018 17:31:36 +0000 (UTC) From: Vitaly Kuznetsov To: Borislav Petkov , Reinette Chatre , Babu Moger Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Fenghua Yu , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , =?utf-8?Q?Jan_H_=2E?= =?utf-8?Q?_Sch=C3=B6nherr?= , David Duncan Subject: Re: [PATCH] x86/intel_rdt: use rdmsr_safe() to workaround AWS host issue In-Reply-To: <20181220161722.GD31403@zn.tnic> References: <20181220134046.7916-1-vkuznets@redhat.com> <20181220161722.GD31403@zn.tnic> Date: Thu, 20 Dec 2018 18:31:34 +0100 Message-ID: <87bm5g2jgp.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 20 Dec 2018 17:31:39 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Borislav Petkov writes: > On Thu, Dec 20, 2018 at 02:40:46PM +0100, Vitaly Kuznetsov wrote: >> 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) >> -- > > Does the below hunk work too? > Yes, it does, thanks! -- Vitaly