From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x227DE9s0Uvxuop5k54h+h6RwpvSdY+zgiSBa5d/OylwlEkjJOQs7LNun30468ynLt2/NYEPC ARC-Seal: i=1; a=rsa-sha256; t=1517002567; cv=none; d=google.com; s=arc-20160816; b=APFpsjHb/nVnorx/UvVoYAIPZG2VEynyG4/Xz+1vD3JWT5Rqo1m4DHjTQuK3O41oeQ CHZ1tpdX+eeJ+y7rQccaPDoF3aD067y3d3tqXm4E6CK+KkloaKtxLKGZyoL3pen/OCHJ dG3bvVB6MGNKolpfeHevS6xJTyqulh2LgH7/Uae5+WUdQosSSCkOEpqI4GLuV9/k4m8H 04Qna+SLZOtXyYSD4x4tWlJNe68gA2zGqn8p3kQUyNLs87V2OvYLRSOW/u+MrTjcegLO MgVdWCEYFEuSiel3C5Tk6y/VBtQ3LwR5kodsQ2GAZhmluxyNflBvGQ1IH/8HHxIaQ9Rb 0VIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:to:subject :arc-authentication-results; bh=/KFB6givQdIbeay+Qgsqr69y75tdKCStm9lIunVQlxE=; b=Ru0VLK2ReCc0so3jIi+ekUH03pXFwOSwNcTHpOfmyybA5N29BJAaz3t0Xn4DYZcY18 wCIX3547uvRDktstlVD2Ik3dOMvBJBZD0gFSQTwlUSFQJSPAEPOxgOoDXKrFDNPK6QGn gJgnmCKPPVk2NodBnmAkCed+lXUIacidUkLJ6bhodDWAUGkV7pSLVPW86fF+sa1OwzDW pK9/IeyB1Zxbg5AAO/CJBwET2ikW+vfLeta/lI6vtiBeS08HVtNWtTETus/eoqle1P3e J83aqznZVSKfXg9QLJ08ZYOxvHz+vcTnpzsAdZhe8Dn+DAkN9HKVr7Z4gncL90BIyZo/ temA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of tim.c.chen@linux.intel.com designates 192.55.52.120 as permitted sender) smtp.mailfrom=tim.c.chen@linux.intel.com Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of tim.c.chen@linux.intel.com designates 192.55.52.120 as permitted sender) smtp.mailfrom=tim.c.chen@linux.intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,418,1511856000"; d="scan'208";a="13770990" Subject: Re: [PATCH v5 7/7] x86/speculation: Add basic IBPB (Indirect Branch Prediction Barrier) support To: David Woodhouse , arjan@linux.intel.com, tglx@linutronix.de, karahmed@amazon.de, x86@kernel.org, linux-kernel@vger.kernel.org, bp@alien8.de, peterz@infradead.org, pbonzini@redhat.com, ak@linux.intel.com, torvalds@linux-foundation.org, gregkh@linux-foundation.org, dave.hansen@intel.com, gnomes@lxorguk.ukuu.org.uk, ashok.raj@intel.com, mingo@kernel.org References: <1516896855-7642-1-git-send-email-dwmw@amazon.co.uk> <1516896855-7642-8-git-send-email-dwmw@amazon.co.uk> From: Tim Chen Message-ID: <85fc729e-6ff6-3a13-481c-2e0e11407225@linux.intel.com> Date: Fri, 26 Jan 2018 13:36:05 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: <1516896855-7642-8-git-send-email-dwmw@amazon.co.uk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1590581671523311714?= X-GMAIL-MSGID: =?utf-8?q?1590692484354959418?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: On 01/25/2018 08:14 AM, David Woodhouse wrote: > > diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h > index 4ad4108..34e384c 100644 > --- a/arch/x86/include/asm/nospec-branch.h > +++ b/arch/x86/include/asm/nospec-branch.h > @@ -218,5 +218,18 @@ static inline void vmexit_fill_RSB(void) > #endif > } > > +static inline void indirect_branch_prediction_barrier(void) > +{ > + asm volatile(ALTERNATIVE("", > + "movl %[msr], %%ecx\n\t" > + "movl %[val], %%eax\n\t" > + "movl $0, %%edx\n\t" > + "wrmsr", > + X86_FEATURE_IBPB) > + : : [msr] "i" (MSR_IA32_PRED_CMD), > + [val] "i" (PRED_CMD_IBPB) > + : "eax", "ecx", "edx", "memory"); With Peter's fixing of paravirt's indirect call for wrmsr, (https://patchwork.kernel.org/patch/10173547/) we don't have to worry about indirect call in wrmsr anymore. Can we use regular wrmsr here? It will make IBPB tracing straightforward using the MSR tracepoints. Tim