Received: by 10.223.176.5 with SMTP id f5csp584637wra; Sat, 27 Jan 2018 05:59:46 -0800 (PST) X-Google-Smtp-Source: AH8x2248SAAGaWq6g5zHbsw4q8JrJom/hVFsHHctT4KK+ddOE/0sFe//Yz+fgXA6SsTAXJkz82Re X-Received: by 10.98.72.19 with SMTP id v19mr22295505pfa.107.1517061586393; Sat, 27 Jan 2018 05:59:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517061586; cv=none; d=google.com; s=arc-20160816; b=nUQT3dj20EyUbHn+GfF/Jyk5DjQ98JVX/ee9tK24Cj30wC7JL+pZNrJIanHchfrGkK 8as4UXV/VQYzFDGBGAEdZiTsPl4Jh1BXJjCTRGivrsbxf7lmqMBGQCiP8bn/5NvCwf3k L6QjG56arDyYuu7bmZMQFFZ9n7TnZY3sxQzp06g26sC6nYYJomHENnglfaOlQWQBF+ed opLgFgzuTHwm+qegQglmnVpZnrJSRpoeJP5tmqOGiAsuO+pPqyWzfCOgJ7v0qeOkBnnL s7v5tMIsZsFPNtq0tZaQ2dG1TCGRo/KMCLPJW5Op4FdNi5ui0YdyiXQEExFH3fqa2yHq 0tRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=EMz1V4jr42k9zzPsSwbyAq1PJKLk8nVS1YjwHaO9Op8=; b=K3RTq0j0gYOWIMGPFTR2dd+PBrwddEt5d3z+4BYsQ7uIEVNHY45VTVsTUbWJ7sHqVt xJQKnnNgC5xMraDQknuFx5hASE0I0GoD4FnAXAwsdHF1QAlANA0yUw15J7Ij11vAVFne NOG4rxEjiUhSzm5fcvqneKWfcdgmbki+ZwJuqTDolWdtmIgQa3cr2nla146v5K2V+gIA tK9kA3Uj/dySPL9WHKNWdovIsY6JDk0zjiAh4GMvRnbkkt5WBkydqTuoNSP2ukJRvwWf /VKtPWRzNCbxpThF0MFUAylafhyJ9D6X/cBOL83D1IkKU/3/N0psFV6lIxC4it3Dqa3E 9jVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Rqb7sro9; 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 t6-v6si5391409plz.522.2018.01.27.05.59.31; Sat, 27 Jan 2018 05:59:46 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Rqb7sro9; 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 S1752788AbeA0N7J (ORCPT + 99 others); Sat, 27 Jan 2018 08:59:09 -0500 Received: from mail-qt0-f196.google.com ([209.85.216.196]:45319 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751484AbeA0N7H (ORCPT ); Sat, 27 Jan 2018 08:59:07 -0500 Received: by mail-qt0-f196.google.com with SMTP id x27so7555499qtm.12 for ; Sat, 27 Jan 2018 05:59:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=EMz1V4jr42k9zzPsSwbyAq1PJKLk8nVS1YjwHaO9Op8=; b=Rqb7sro9xESYJbozyoydLdkKEywr7B7TBeWEaF8ZCx8bHjp1RJfL4ekhw8dgV44qt8 J9D0QD6KVG3pD9jvqvZVHupe103doJcikyjo7ckxo5gaNOL71th0WnlmMxosQyeYEOQ2 VuLV5OYA8OnD9QSHfoGi/60gfGVrqUeqlJGMN+kE3oKMAaONRP8zogPHQAr8HUQZD84C 6wiOq+RUcLTM4ZRa3ZlJDWroU+IC2Qi9C3CyPS8WPV8bNAkuhdyQeAqrjSFLqSd3hb34 mGIRbMqy5AmTovP1CpduHOTQOQuZEMBwSHEw6l9mvA594KIhakKTQ7fVSFMLFz1gYFMX 89fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=EMz1V4jr42k9zzPsSwbyAq1PJKLk8nVS1YjwHaO9Op8=; b=CgE3KeZHQhcbuLPed37DlBc6aSgiZN17xa7wrOosHzn5lvdhKoIPiB9klrfVFyOc/F 1Z1FwvU3exOjzRPdrN00bpWY74HzNww5wAn5pEpfgAse0RwSKn4RU1OY51hPMx7o3uKP RcAyo6migOxyz7dDzJh8HRY5Vqf0S9GZPnzjEMkhZbCkFNC2oHM4qg4J7NAoRBxU0OnT 4u8KLugK4oEtvHyNVBm5ID9CLTd31xHgquU4Zfj/V3WCoqCgm7hmrDs07eBNU/SrwjRs bIJ/hBfwTwdaNrNOBcEpEt0cqZ5bhQ2MDOGAk4s7Yhmnd37ButVK94HdB9mnsoq/NhS7 r19w== X-Gm-Message-State: AKwxytdXQz5lzXL5K80U+AYutudifgLNR/iW9cDjHEXGU46MXaBMb42U 54EGfQGrdGY09UURBlwsR5M= X-Received: by 10.200.81.199 with SMTP id d7mr29298927qtn.211.1517061546804; Sat, 27 Jan 2018 05:59:06 -0800 (PST) Received: from localhost.localdomain (209-6-200-48.s4398.c3-0.smr-ubr2.sbo-smr.ma.cable.rcncustomer.com. [209.6.200.48]) by smtp.gmail.com with ESMTPSA id h195sm4939794qke.29.2018.01.27.05.59.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 27 Jan 2018 05:59:05 -0800 (PST) Date: Sat, 27 Jan 2018 08:59:02 -0500 From: Konrad Rzeszutek Wilk To: Peter Zijlstra Cc: Dave Hansen , Tim Chen , Thomas Gleixner , Andy Lutomirski , Linus Torvalds , Greg KH , Andrea Arcangeli , Andi Kleen , Arjan Van De Ven , David Woodhouse , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 4/8] x86/spec_ctrl: Add sysctl knobs to enable/disable SPEC_CTRL feature Message-ID: <20180127135859.GA25291@localhost.localdomain> References: <20180108124707.GH32035@hirez.programming.kicks-ass.net> <20180108161437.GN32035@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180108161437.GN32035@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 08, 2018 at 05:14:37PM +0100, Peter Zijlstra wrote: > On Mon, Jan 08, 2018 at 01:47:07PM +0100, Peter Zijlstra wrote: > > > a good suggestion, but we encountered some issues with it either > > > crashing the kernel at boot or not properly turning on/off. > > The below boots, but I lack stuff to test the enabling. ..snip.. > --- a/arch/x86/entry/calling.h > +++ b/arch/x86/entry/calling.h > @@ -373,22 +373,17 @@ For 32-bit we have the following convent > .endm > > .macro ENABLE_IBRS > - testl $1, dynamic_ibrs > - jz .Lskip_\@ > + STATIC_JUMP_IF_FALSE .Lskip_\@, ibrs_key, def=0 > > PUSH_MSR_REGS > WRMSR_ASM $MSR_IA32_SPEC_CTRL, $SPEC_CTRL_FEATURE_ENABLE_IBRS > POP_MSR_REGS > - jmp .Ldone_\@ > > .Lskip_\@: > - lfence > -.Ldone_\@: > .endm I know that this particular patchset is now obsolete as the retpoline along with stuffing the RSB half or full is the preferred way. But I am wondering - why was the 'lfence' added in the first place if dynamic_ibrs was zero? It certainly is not putting the speculative execution on a wild ride like: "[tip:x86/pti] x86/retpoline: Use LFENCE instead of PAUSE in the retpoline/RSB filling RSB macros" https://git.kernel.org/tip/2eb9137c8744f9adf1670e9aa52850948a30112b So what was the intent behind this? Was it: "oh if we do not have IBRS let us at least add lfence on every system call, interrupt, nmi, exception, etc to do a poor man version of IBRS?" Thank you. P.S. My apologies if this was discussed in the prior versions of this thread. I must have missed it.