Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp45951imm; Tue, 24 Jul 2018 13:43:33 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfZE1tfVpTNCH0SC+9oKdGKI/RSmPSTWMzHQZjemX+Nze2K8ehSuP93COmi7pCznIE455Q7 X-Received: by 2002:a17:902:683:: with SMTP id 3-v6mr18478936plh.291.1532465013474; Tue, 24 Jul 2018 13:43:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532465013; cv=none; d=google.com; s=arc-20160816; b=OyIY9VMLnwj/XiQYkg7Se6soH/CInrpI/uQYnO7Rg5KDB3TqKZBIkcc9/qzjDyK6bV pieHqfdQQ/MeCmDg9NPfsgbbjsshkickg0WcoBlrFHF2YQ56Ni5GYcH5BX5Ln5bwyZI7 p1Z/5g3rsjok8hmxkYlqD6whLJlBYQpGmj8WAAZzc9IXvbJoJVs1czZTohLPiAjL5xzx 5MKEb+7XEoA63xYknysXrJZ4N9UTScrgSztF3c3zA2KXDyW/eeS7maCR9RBYClGDoxDI 5GP0Pw9aBfiCdLGQ4MfZb0ifS2mAQKBcKia33t6uJ/6Vd5x+fh9yVxO4EOG2aO+lWR7k f/Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=zNfIgyRKW1JBpceoVCfBCb/77DoF1/x2+kc1NtsAy8Q=; b=jtY2071+Q2LP6ul+VVpHaQR1GvRzfKJ4dvZcWwt6f0UfgOKgzTmAkew7EMOUDlmlkj Pr/JZbrF80260tuhYf7+JQjzpAK4swjWtbqdab+TO4rYAPKTI74fwAKmXLA0lPTdGdI1 Aa1GBBxR/px9FO2dsoXZ4qK0Np78ktH5uu/eUKl8Vzdv4ocS8oDD5SbjkN8+FvHiDMPo 4fNoKptnihXz1kPnOmPvMTvj6PrCqOyMplDzMFl8f9xwNTDx065CRLZc5JfmwLShHanm xdZPOT43NFs68biR7dKjP/nPf3eMAjqtv9e5/8p2UyNOXmAiXI/o8ESbk4zUmu3twUqt PRKQ== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c14-v6si12674629pfl.319.2018.07.24.13.43.18; Tue, 24 Jul 2018 13:43:33 -0700 (PDT) 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388863AbeGXVtJ (ORCPT + 99 others); Tue, 24 Jul 2018 17:49:09 -0400 Received: from mga17.intel.com ([192.55.52.151]:42508 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388721AbeGXVtJ (ORCPT ); Tue, 24 Jul 2018 17:49:09 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jul 2018 13:40:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,399,1526367600"; d="scan'208";a="74172845" Received: from rchatre-s.jf.intel.com ([10.54.70.76]) by fmsmga004.fm.intel.com with ESMTP; 24 Jul 2018 13:40:30 -0700 From: Reinette Chatre To: tglx@linutronix.de, fenghua.yu@intel.com, tony.luck@intel.com, vikas.shivappa@linux.intel.com Cc: gavin.hindman@intel.com, jithu.joseph@intel.com, dave.hansen@intel.com, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org, Reinette Chatre Subject: [RFC PATCH 5/7] x86/intel_rdt: Trigger pseudo-lock restore after wbinvd call Date: Tue, 24 Jul 2018 13:40:16 -0700 Message-Id: X-Mailer: git-send-email 2.17.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The wbinvd instruction would evict all pseudo-locked data from a pseudo-locked region within the hierarchy where the wbinvd instruction was run. The expectation is that a platform with pseudo-locked regions should not run code depending on the wbinvd instruction after the pseudo-locked regions are created. If the wbinvd instruction is run it is an unexpected and serious event that needs to be highlighted to the user to trigger an audit of the software. At the same time the pseudo-locked regions need to be restored. Since wbinvd instructions may be called from anywhere in kernel the instruction itself is modified to trigger pseudo-locked region restoration after the instruction is run. As they are moved the assembly calls of the wbinvd instructions are modified to address the checkpatch complaint of required spaces around the ':'. Suggested-by: Dave Hansen Signed-off-by: Reinette Chatre --- arch/x86/include/asm/special_insns.h | 13 ++++++++++++- arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/special_insns.h b/arch/x86/include/asm/special_insns.h index 317fc59b512c..01ff02eb0e5c 100644 --- a/arch/x86/include/asm/special_insns.h +++ b/arch/x86/include/asm/special_insns.h @@ -15,6 +15,9 @@ * use a variable and mimic reads and writes to it to enforce serialization */ extern unsigned long __force_order; +#ifdef CONFIG_INTEL_RDT +void intel_rdtgroup_pseudo_lock_restore_all(void); +#endif static inline unsigned long native_read_cr0(void) { @@ -131,7 +134,15 @@ static inline void __write_pkru(u32 pkru) static inline void native_wbinvd(void) { - asm volatile("wbinvd": : :"memory"); + asm volatile("wbinvd" : : : "memory"); +#ifdef CONFIG_INTEL_RDT + intel_rdtgroup_pseudo_lock_restore_all(); +#endif +} + +static inline void native_wbinvd_only(void) +{ + asm volatile("wbinvd" : : : "memory"); } extern asmlinkage void native_load_gs_index(unsigned); diff --git a/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c b/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c index d395e6982467..298ac2b34089 100644 --- a/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c +++ b/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c @@ -477,7 +477,7 @@ static int pseudo_lock_fn(void *_rdtgrp) * increase likelihood that allocated cache portion will be filled * with associated memory. */ - native_wbinvd(); + native_wbinvd_only(); /* * Always called with interrupts enabled. By disabling interrupts -- 2.17.0