Received: by 10.223.185.116 with SMTP id b49csp1452406wrg; Wed, 14 Feb 2018 18:05:06 -0800 (PST) X-Google-Smtp-Source: AH8x225fpsUyNjlh0Hk1BaFJg3LzmyjQoGeXQMDT78DQdq1azmEoUTqxj/Qm3dC7Y1vSiL+F+uN/ X-Received: by 2002:a17:902:9897:: with SMTP id s23-v6mr957712plp.238.1518660306257; Wed, 14 Feb 2018 18:05:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518660306; cv=none; d=google.com; s=arc-20160816; b=E47YpW3oEXiLi8b0qFGRQbDTEarbq5lH4Dm+P92oY7fWyXpexCA1jEZWB6zPfUKJpB U3Z9xHNQdflar4Ql4kn2ToP4tyegNeTWA3RVpyzWFEGVJ6a6YUhhdN5bGgSow0+Wbm+P XOQcH/eNw3x4EJc9Pl8tHWYjZm9cKlU10V5O4Lnq3Sxn+e3ZMEBLOcUkq4bbajPvCBuP p+OiNcSh1A2HO7zQiCI7zbIHe7L0K0qYblRNQDPotyDbdXclvpBNXrCo8NAUQesbpx3l 8Xf+KJnofducpieBEBpwO6dCKQ+C/Ksm0c/1h/LySSu3wbGZhLMbmy+oc/Bf1ntFwZbJ EXIw== 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:cc:to:subject:arc-authentication-results; bh=XlY5sSxEhx7+rQcaUUsItjNjj++efsIAYCkc4Dc05RI=; b=0VDCsa11sG4pXuS+P7uTtpbPguBjqOJ4PZBTY+g+zjDif5nOsEndNdsvHAHjMCVZi0 meT82LpRFWtUs1m52dN4INnnZaY+JOjFJfSt8RHI++hA7oaTET62gAAPuZwSezA7eiTy q8nmJyHkJ3Pgarbwi7Nhk5J4548H8Tc+bXawtADsCPJK415sgLe8ajAluIXjphyGzqPB jR/33/z8UhlDRQqlQjFBoz3tZ6zJnUInhtcimN97ouyQaq8AIDyb8MISLth+dHaQnguV hw54r/G46rlKJqthuLKY1jWSCoqxfh5+v6bUdd6KCWRhKHTuzCwdWmq5X6otQUx6hV3I drZw== 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 o23-v6si578339pll.7.2018.02.14.18.04.51; Wed, 14 Feb 2018 18:05:06 -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 S1032569AbeBOCBo (ORCPT + 99 others); Wed, 14 Feb 2018 21:01:44 -0500 Received: from mga06.intel.com ([134.134.136.31]:9131 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032245AbeBOCBn (ORCPT ); Wed, 14 Feb 2018 21:01:43 -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 orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Feb 2018 18:01:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,515,1511856000"; d="scan'208";a="204327441" Received: from schen9-desk3.jf.intel.com (HELO [10.54.74.42]) ([10.54.74.42]) by fmsmga006.fm.intel.com with ESMTP; 14 Feb 2018 18:01:42 -0800 Subject: Re: [tip:x86/pti] x86/speculation: Use IBRS if available before calling into firmware To: Ingo Molnar Cc: Peter Zijlstra , Dave Hansen , hpa@zytor.com, tglx@linutronix.de, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, dwmw@amazon.co.uk, linux-tip-commits@vger.kernel.org, Borislav Petkov , Arjan van de Ven References: <1518362359-1005-1-git-send-email-dwmw@amazon.co.uk> <20180212102211.cdrrqqd4hdw7xu5y@gmail.com> <20180212165835.GO25181@hirez.programming.kicks-ass.net> <20180213075540.3lkikkpgjoe6ocjk@gmail.com> <5c3ba123-abbe-f153-7b75-a89d31d25c72@linux.intel.com> <20180214085614.GT25181@hirez.programming.kicks-ass.net> <1fd7c8ef-a50c-53d8-7159-d992e669c2f2@linux.intel.com> <20180214231904.ww46gjnytbx3jqef@gmail.com> From: Tim Chen Message-ID: <97bc2ca2-7d5b-c206-5c23-902ed3586256@linux.intel.com> Date: Wed, 14 Feb 2018 18:01:41 -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: <20180214231904.ww46gjnytbx3jqef@gmail.com> 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/14/2018 03:19 PM, Ingo Molnar wrote: > > * Tim Chen wrote: > >> On 02/14/2018 12:56 AM, Peter Zijlstra wrote: >> >>> >>> At the very least this must disable and re-enable preemption, such that >>> we guarantee we inc/dec the same counter. ISTR some firmware calls (EFI) >>> actually are preemptible so that wouldn't work. >>> >>> Further, consider: >>> >>> this_cpu_inc_return() // 0->1 >>> >>> this_cpu_inc_return() // 1->2 >>> call_broken_arse_firmware() >>> this_cpu_dec_return() // 2->1 >>> >>> wrmsr(SPEC_CTRL, IBRS); >>> >>> /* from dodgy firmware crap */ >>> >>> this_cpu_dec_return() // 1->0 >>> wrmsr(SPEC_CTRL, 0); >>> >> >> How about the following patch. > > These fragile complications of the interface should now be unnecessary, as the > only driver that called firmware from NMI callbacks (hpwdt.c) is going to remove > those firmware callbacks in the near future - solving the problem at the source. > > Thanks, > > Ingo > Sounds good. I sent this out before seeing the other mails on removing NMI callbacks from hpwdt.c Tim