Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp221899pxb; Wed, 4 Nov 2020 20:34:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJyzLTIEmiLDadHxWyZurv7eW9HtZnbQQpbx5nQ9HFq9rZpGDxp19U1Y1kNT8lSDVYAQr8wk X-Received: by 2002:a17:906:398b:: with SMTP id h11mr510425eje.277.1604550842393; Wed, 04 Nov 2020 20:34:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604550842; cv=none; d=google.com; s=arc-20160816; b=tGSyBq1Gr1sXQnqSnRVCvmaVo3AWcEgknDjTjwhI7TufC7TX2zWrHwYG/QJNSF/cwT Z5ewi4WmbCn1utpy5/lWbr4i+B5q8HI5L7uQWA1cxLzniZzAfy5ux6IQRr26z4K3px79 o4/Y6tztFtZBH++eWhA/1X/vAsjRDGw6mKWhqkt90pRpOLdEQlJ/y8E0v4pMTdI6mcK8 O/fe4FGFvgO+DSMoRpCoLUZalEbmiiZ8jLaZfEkAaQ8arE61hEPiYtaRsADKYpjs84Ul n65osiONxmxxCLdUV4ClExewbfVUwz1jaCu2Am1NYPTRNSBonIwD2SpyjWPrjO3ZwWbB 6LhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=5WyMUvbXsD6Cd+HVdB+2QZriRko6wOVZOY2U2kpsjkk=; b=KcQq/d0XtBZQrm4U3Fi8DcSN0WxMJvGFoXg5a6DicetG1ZQ7x2J4ua7EVCy4jy8+wP BhKunyUG25Rq/7ksH4mopjQn73/woC3PLmrvJZogAnHrkLWgKIG7C/fHWG+YeZV4z9S2 CtuqdUKtn7zeSnlkosTzcorRtkAM56YC4kEukLaCoAsyrh5SnI5afoKdBa0ZaMkVMe8+ zi6fI0JNBvpTvcP4Y8HXk4hZUQq8N3acRgg4fL2aMnlO0VXscwyXXVlZKHbZVi2DBZ+J Je2XbSv9gH9HLEDiUkeugIsukqcgjTTYQ74sWHsTAk2tdzMbyOCrPFRdajSssSHjOb+m 22qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="bejopD0/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l7si273241eja.665.2020.11.04.20.33.39; Wed, 04 Nov 2020 20:34:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="bejopD0/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388238AbgKEBNe (ORCPT + 99 others); Wed, 4 Nov 2020 20:13:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729858AbgKEBNd (ORCPT ); Wed, 4 Nov 2020 20:13:33 -0500 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EF3EC0613CF for ; Wed, 4 Nov 2020 17:13:33 -0800 (PST) Received: by mail-io1-xd41.google.com with SMTP id n129so109054iod.5 for ; Wed, 04 Nov 2020 17:13:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5WyMUvbXsD6Cd+HVdB+2QZriRko6wOVZOY2U2kpsjkk=; b=bejopD0/53NQT2et/Tqaoe01gsRyjXFWDSyt5m9oR+m5MOiQmcSDOM6dIUzMijVryE UvNui8Sloeb7KP02V25AJpAh6hGcKPQ6BMrlRR9sSicZi04bBcnP95pyznQzC4BxzZ3Y pfHnmf5VgkclUnQ2DsYONEDl7Vi3R4KWlq4jdiEFn4umPmuEpUiS2GguTXV7YEJ2n1Ig 7WzxnyRFFFS57KNwbKTwQVo5dO1Re71skgyTne7yCxOlnvB0VTsrNXo6mg70XCNrXvDO FxMqjuZNzP8fUGPK21zFfain+3IQBSNVFiHoEvIMDKqJGvsGoFkBrz3RxTMSI2AS0W5i WVLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5WyMUvbXsD6Cd+HVdB+2QZriRko6wOVZOY2U2kpsjkk=; b=rkUPN3/xmkLkE547zMK9H9UK2y1zUfXlJzK9I4cmM9eXfQXjto+sNadeqa9emZZFyO byxEJEr3pa79Foo7fGTE+Am2VlHCmRBEJ8HmD0DEnISGn4xB/gXlN3CO3yHIy7FIkxcd NmVrGIlutRh2DojR/Z1x0N7yVoFJgI+nxBDHIsXxbPz/2IzC6OAshPrsjMgCNZCZhMZv mECt7IuAXMpOEGC+Ka7RloC56MMM3ttAT4rO+rB6dEN+b5r6AyIS2V+Ff86RsmODgrWq 4hFZBtxU3P/Go9hCKGney2w7+/MJ/PEQpX0LCju0OdW+7RI3bVFBucqzqfs0UhptmyP4 pFVw== X-Gm-Message-State: AOAM5327ahoKdQfSZnehv//rdA6ScrcKYo7uHkctG3JIPJZIvc3i6yEt JX/pnghBY/KWeGz23WDfx4Qd5Cz4G/JIkVPY8en4jg== X-Received: by 2002:a02:c952:: with SMTP id u18mr174505jao.139.1604538811818; Wed, 04 Nov 2020 17:13:31 -0800 (PST) MIME-Version: 1.0 References: <20201029065133.3027749-1-amistry@google.com> <20201029175120.1.Ifd7243cd3e2c2206a893ad0a5b9a4f19549e22c6@changeid> <839fad53-4377-592a-a0da-2cf18b5c6027@amd.com> <20201103105757.GC6310@zn.tnic> In-Reply-To: <20201103105757.GC6310@zn.tnic> From: "Anand K. Mistry" Date: Thu, 5 Nov 2020 12:13:20 +1100 Message-ID: Subject: Re: [PATCH 1/1] x86/speculation: Allow IBPB to be conditionally enabled on CPUs with always-on STIBP To: Borislav Petkov Cc: Tom Lendacky , x86@kernel.org, Joel Fernandes , Anthony Steinhauser , tglx@linutronix.de, "H. Peter Anvin" , Ingo Molnar , Josh Poimboeuf , Mark Gross , Mike Rapoport , Pawan Gupta , Tony Luck , Vineela Tummalapalli , Waiman Long , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 3 Nov 2020 at 21:58, Borislav Petkov wrote: > > On Mon, Nov 02, 2020 at 11:02:10AM +1100, Anand K. Mistry wrote: > > > I like the idea of passing in the mode you want to check, but it appears > > > they are never used independently. The ibpb and stibp modes are always > > > checked together in one of the if statements below, so you could make this > > > a function that checks both modes and just have a single call. I'll leave > > > that up to the maintainers to see what is preferred. > > > > I can see both sides to this. Personally, I think I prefer it as-is > > since I think it improves readability a bit by making the conditions > > less complicated whilst not hiding too many details. I'll wait to see > > what others say before changing this one. > > Yes, but if you make it a single function with a descriptive name, you'd > make the call sites even more readable: > > if (!is_spec_ib_conditional(..)) > bla; > > or > > if (!is_spec_ib_user_controlled(..)) > blu; > > and that function should simply check both spectre_v2_user_ibpb *and* > spectre_v2_user_stibp in one go. > > Why should we do that? > > Exactly because you both got your brains twisted just from looking at > this. Because this mitigation crap is such an ugly and complex maze that > we would take even the smallest simplification any day of the week! Ok then, two votes for. I'll make the change in v2 and post that up today. > > Welcome to my life since meltdown. Brain twist feels good, doesn't it? I don't think "feels good" are the words I'd use. > > :-))) > > Thx. > > -- > Regards/Gruss, > Boris. > > https://people.kernel.org/tglx/notes-about-netiquette -- Anand K. Mistry Software Engineer Google Australia