Received: by 10.223.185.116 with SMTP id b49csp1045155wrg; Fri, 16 Feb 2018 11:23:47 -0800 (PST) X-Google-Smtp-Source: AH8x226VFQiZvlZIH3SEKOhkBAUXqF8MonBCm0XzDNN09+uYBn33INigQQ6916iBsu6CTfE9aQYq X-Received: by 2002:a17:902:bc41:: with SMTP id t1-v6mr6840325plz.436.1518809027283; Fri, 16 Feb 2018 11:23:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518809027; cv=none; d=google.com; s=arc-20160816; b=DCSSdzO607tZ0g/Rs7z8JJwJ07gQdG69LrAa418yXWSJq+PGW3dul/c9Wajlg1jQIZ gzy1mHjSnI9hm2X+8EgqFUlLC2L+bpoa10GSg/7OBVSiNrIGvlwDLNUFdJY2NTf/szhw X8HZyKtkBqksQe6eJKp4IqHhq7UC7B+Jt+7qGXgeGWmH0BBQ9l3AlHVwd+BGnuH0OVAu 1mfKTN8ViH7+TO7wioBDEV0nPtn6JIwNy5jXj76qVt7I4yVAK19vk9O4jm2XsqEvcUSD XPT2dfymkAiJFspNMBYFoy626l0bQ8fi8OAHBd92lgA2NX9ful1jGRqzmddsiMCy+HXR jAJA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:arc-authentication-results; bh=7d3QUU8YA4sK9cn4ouGvYIO1B9pkPy3YXnfCeYhLUVU=; b=u79e/QP7dMfUvSW+wWcZti5spp5p+e7aeMlgx33rgxNVoEUER1lKTyli+u1vahA7ku nnUC6265AeMVtftrpmpJAEcxrbKkdmFlurG42r9sxzASo+KqLwsHRoMpSbdJkbRgU4Lr aK9ndg62RlMSSYEg7l/HdQj7+q3kWu00frRz0KawLFk9IJSXcyH6Qzt+5DF1A89ZOcKD /sGATbe2RgW0lBvQ91PQQnyWXEZCKRgU3OclvhxO5cxYNb/mqCrU1XX6u149+hORJ3mT B+zwkM4r9UAp7QgJuIA+PdMV1CyVL6ggUtEUCQi3Wxa1PljM3ezfaHJ6y4Ldj8qbGJS3 HNXw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p12si2564591pgd.694.2018.02.16.11.23.32; Fri, 16 Feb 2018 11:23:47 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932097AbeBPSoL (ORCPT + 99 others); Fri, 16 Feb 2018 13:44:11 -0500 Received: from mga17.intel.com ([192.55.52.151]:30488 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753572AbeBPSoH (ORCPT ); Fri, 16 Feb 2018 13:44:07 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Feb 2018 10:44:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,520,1511856000"; d="scan'208";a="204886406" Received: from schen9-desk3.jf.intel.com (HELO [10.54.74.42]) ([10.54.74.42]) by fmsmga006.fm.intel.com with ESMTP; 16 Feb 2018 10:44:06 -0800 Subject: Re: [tip:x86/pti] x86/speculation: Use IBRS if available before calling into firmware To: mingo@kernel.org, hpa@zytor.com, tglx@linutronix.de, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, dwmw@amazon.co.uk, peterz@infradead.org, linux-tip-commits@vger.kernel.org References: <1518362359-1005-1-git-send-email-dwmw@amazon.co.uk> From: Tim Chen Message-ID: Date: Fri, 16 Feb 2018 10:44:06 -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: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/11/2018 11:19 AM, tip-bot for David Woodhouse wrote: \ > }) > diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h > index 300cc15..788c4da 100644 > --- a/arch/x86/include/asm/nospec-branch.h > +++ b/arch/x86/include/asm/nospec-branch.h > @@ -162,17 +162,36 @@ static inline void vmexit_fill_RSB(void) > #endif > } > > +#define alternative_msr_write(_msr, _val, _feature) \ > + asm volatile(ALTERNATIVE("", \ > + "movl %[msr], %%ecx\n\t" \ > + "movl %[val], %%eax\n\t" \ > + "movl $0, %%edx\n\t" \ > + "wrmsr", \ > + _feature) \ > + : : [msr] "i" (_msr), [val] "i" (_val) \ > + : "eax", "ecx", "edx", "memory") > + I encountered hang on a machine but not others when using the above macro. It is probably an alignment thing with ALTERNATIVE as the problem went away after I made the change below: Tim diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h index 8f2ff74..0f65bd2 100644 --- a/arch/x86/include/asm/nospec-branch.h +++ b/arch/x86/include/asm/nospec-branch.h @@ -148,6 +148,7 @@ extern char __indirect_thunk_end[]; #define alternative_msr_write(_msr, _val, _feature) \ asm volatile(ALTERNATIVE("", \ + ".align 16\n\t" \ "movl %[msr], %%ecx\n\t" \ "movl %[val], %%eax\n\t" \ "movl $0, %%edx\n\t" \