public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Vitaly Kuznetsov <vkuznets@redhat.com>,
	Reinette Chatre <reinette.chatre@intel.com>,
	Babu Moger <Babu.Moger@amd.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	"Fenghua Yu" <fenghua.yu@intel.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Ingo Molnar" <mingo@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Jan H . Schönherr" <jschoenh@amazon.de>,
	"David Duncan" <davdunc@amazon.com>
Subject: Re: [PATCH] x86/intel_rdt: use rdmsr_safe() to workaround AWS host issue
Date: Thu, 20 Dec 2018 17:17:22 +0100	[thread overview]
Message-ID: <20181220161722.GD31403@zn.tnic> (raw)
In-Reply-To: <20181220134046.7916-1-vkuznets@redhat.com>

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 <vkuznets@redhat.com>
> ---
>  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?

Reinette, Babu: is there any reason for rdt_init_res_defs() and
check_quirks() to run before get_rdt_resources() which looks at CPUID
bits?

If not, we need to do something like below, for guests.

Thx.

---
diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
index c3a9dc63edf2..64cb0fb31862 100644
--- a/arch/x86/kernel/cpu/resctrl/core.c
+++ b/arch/x86/kernel/cpu/resctrl/core.c
@@ -969,17 +969,13 @@ static int __init resctrl_late_init(void)
 	struct rdt_resource *r;
 	int state, ret;
 
-	/*
-	 * Initialize functions(or definitions) that are different
-	 * between vendors here.
-	 */
+	if (!get_rdt_resources())
+		return -ENODEV;
+
 	rdt_init_res_defs();
 
 	check_quirks();
 
-	if (!get_rdt_resources())
-		return -ENODEV;
-
 	rdt_init_padding();
 
 	state = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,



-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

  reply	other threads:[~2018-12-20 16:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-20 13:40 [PATCH] x86/intel_rdt: use rdmsr_safe() to workaround AWS host issue Vitaly Kuznetsov
2018-12-20 16:17 ` Borislav Petkov [this message]
2018-12-20 17:31   ` Vitaly Kuznetsov
     [not found]   ` <51dcb13a-4751-47f5-1e01-f6731a2c6f3c@intel.com>
     [not found]     ` <20521afe-09af-7acf-6f32-3f6e9a971091@intel.com>
2019-01-09 11:39       ` Borislav Petkov
2019-01-09 12:09         ` Vitaly Kuznetsov
2019-01-09 12:14           ` Borislav Petkov
2019-01-09 18:41             ` Tony Luck
2019-01-10 10:32               ` Vitaly Kuznetsov
2019-01-10 10:53                 ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181220161722.GD31403@zn.tnic \
    --to=bp@alien8.de \
    --cc=Babu.Moger@amd.com \
    --cc=davdunc@amazon.com \
    --cc=fenghua.yu@intel.com \
    --cc=hpa@zytor.com \
    --cc=jschoenh@amazon.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=reinette.chatre@intel.com \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox