Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1188483imu; Tue, 11 Dec 2018 14:25:34 -0800 (PST) X-Google-Smtp-Source: AFSGD/WZ5NhiVeXjgZweZZNUUJtEiA8WkWBExX3L7f7+xOkP0XrR6qDnfQfePr+pr78d71KamBnL X-Received: by 2002:a62:f907:: with SMTP id o7mr17666097pfh.244.1544567134520; Tue, 11 Dec 2018 14:25:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544567134; cv=none; d=google.com; s=arc-20160816; b=w5YdSkyQUkweu5r0biq5oVBn9EqBVGuBzI/P6ISF30glbd/ZU4VP7ex/4uf1EfAE7y gCmWgwWc3bgqSGoR7c/YcnbY0yP+V7uzYZRxenBUULsgo5sUsOpZJ0o3dNQutLmFUbQn 4LbW5cuFHOquFmUL/H8xxaGDpnZKWPf+BgOOi0VpNt5E6GIrdTov48FWXq8BO5OnJ/DV OxFs/qnInA4rQrO6iPXqO9Ij+lmn9yjTHs2bKqeS8RTCn34XYVXIyVxNc3v2fOW+jeyn EeNL8Bhr7xtt7Uo5vlOw407SCv5TiZtHGaNsr5jEPibHrYgq+EyYvHOXjD3/SR+Tk9fA 70CQ== 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; bh=Of+0Jcz3tMNKEXWWw6q+gddFzpsqcaSB2yL+b6/CgCI=; b=BXmJEbxUrlNAmkDjO+XxzF17xKD5cRPzWV+sxTpY3phc4gMeN7pn2uX8xvJcq1ualo fxDqRFZ0+pQ0M1X6G+0wbDyEX1KtWxxV9eNh54lnj+3ASACvUifck/YQ+W+ZoAIjxnO2 6ZJmO8qar4TYb5XGa1SA93TYWN664Wm4Ed/PfwPW2GW5bW8IcaGM2dQCdJFV3MsYO741 BVMmSrEsb+e6oAAwBL3bTpLA7cL9+A99ULFyC9xRaO0IneI5+CrZHBeJlmpxIT1Pq61x u/us9T2GFWwW1cHc7uGRY4j7GMxy2OkzrTgCwisLcTmeSGvcuKkyVfdfX8/Bu3iA1a8a fGWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=Q8NPuOa0; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v34si13333815plg.205.2018.12.11.14.25.20; Tue, 11 Dec 2018 14:25:34 -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=pass header.i=@alien8.de header.s=dkim header.b=Q8NPuOa0; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726281AbeLKWXI (ORCPT + 99 others); Tue, 11 Dec 2018 17:23:08 -0500 Received: from mail.skyhub.de ([5.9.137.197]:46072 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726158AbeLKWXI (ORCPT ); Tue, 11 Dec 2018 17:23:08 -0500 Received: from zn.tnic (p200300EC2BCD2B0010F6E1EC68D6BA6C.dip0.t-ipconnect.de [IPv6:2003:ec:2bcd:2b00:10f6:e1ec:68d6:ba6c]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 2AF361EC0B6D; Tue, 11 Dec 2018 23:23:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1544566986; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=Of+0Jcz3tMNKEXWWw6q+gddFzpsqcaSB2yL+b6/CgCI=; b=Q8NPuOa0e+qLuiCCOrnxlX5/zjGpqLmSgRqR0cmeLdxrcmf8im6m8AZGjtjmBgtp4TJexo jlcHcbbrLZ9ydjmg6UDWB8zJUEF9N5uILF0li9/SyVVzErWfzg5i1uTvb9gULxTonJO5zV d6fYAY9NbwZj5GL0vXM+GOLxkztk2Xs= Date: Tue, 11 Dec 2018 23:22:59 +0100 From: Borislav Petkov To: "Lendacky, Thomas" Cc: "x86@kernel.org" , "linux-kernel@vger.kernel.org" , Andrea Arcangeli , Konrad Rzeszutek Wilk , Jiri Kosina , Ingo Molnar , Thomas Gleixner , Tim Chen , David Woodhouse Subject: Re: [PATCH] x86/speculation: Add support for STIBP always-on preferred mode Message-ID: <20181211222259.GU27375@zn.tnic> References: <20181211190959.28321.56433.stgit@tlendack-t1.amdoffice.net> <3308b5d2-0c59-fa33-472b-f56633d39575@amd.com> <20181211211944.GT27375@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 11, 2018 at 10:17:30PM +0000, Lendacky, Thomas wrote: > If using just SPECTRE_V2_USER_STRICT then the code in stibp_state() would > have to be able differentiate between the case where the mode was switched > because of X86_FEATURE_AMD_STIBP_ALWAYS_ON vs a kernel command line with > "spectre_v2_user=on". I could always set and use a static variable in the > file just for the stibp_state() case. Does it matter on X86_FEATURE_AMD_STIBP_ALWAYS_ON CPUs? I mean, we want STIBP to be always on there so you can do: diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 25e914f77bb8..d14860d1cf9c 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -1089,7 +1089,10 @@ static char *stibp_state(void) case SPECTRE_V2_USER_NONE: return ", STIBP: disabled"; case SPECTRE_V2_USER_STRICT: - return ", STIBP: forced"; + if (boot_cpu_has(X86_FEATURE_AMD_STIBP_ALWAYS_ON)) + return ", STIBP: always on"; + else + return ", STIBP: forced"; case SPECTRE_V2_USER_PRCTL: case SPECTRE_V2_USER_SECCOMP: if (static_key_enabled(&switch_to_cond_stibp)) so if user has booted with spectre_v2_user=on, we say, "oh well, it is always enabled anyway"... or? > I'll give it a bit of time and see if there's any other discussion and > re-submit without the new SPECTRE_V2_USER_STRICT_PREFERRED value. Sure. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.