Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5540009rwd; Mon, 12 Jun 2023 06:35:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6bHMCgL+W2Tj+8SdCMkZsMejOZ642/eHpBdPgvOaWljfXiXT+mtES74EA3fqLvMUlJ1TSs X-Received: by 2002:a05:6a20:3d8a:b0:119:3650:7751 with SMTP id s10-20020a056a203d8a00b0011936507751mr10509946pzi.7.1686576917987; Mon, 12 Jun 2023 06:35:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686576917; cv=none; d=google.com; s=arc-20160816; b=Fku8gKS2T7O1tit22Evi0sP8qXjwQTM4Ny6jyEo/0rKkH5mfH8SxgVn7tOTNt/RSjj Kz6qQYC+cUw1PYrNRzubzql0m/CvKL2ImGPQ1g4eCKz1s1f7kIGHx4YBdMc77foIa1vo dR4LsN8tTQ+X8ZyJqq1G0wszatooaAoDZnzheWDB/g6hKJRIw7/ZyUFhzIrSp3GSf/VQ unkR3vUONMZt30rs3GJnuLfQJSwuDRBGJr7YqBp+C8RO3Lw/Kvy96I2xYs+fAAghXItA KuFE6L2QcVOj7wBErsnTT/Yk7cuO3Bk5hxyP7K/weon+9JNSCFYY0umC6x8G6tCaoc61 555Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=JI38F6kc7Cl9oBDIHBZUEUTirCnCfKvB5Sv3x2W1g9s=; b=SiMQBA/Ci77NYS1KOrr8poE6lI66lvkNoz3+DLsw1la0Fa/i3YOjdol7SVr8UKIaGO fJ4OU9sRhvA+XoBOD2B/Ds1OkN9/o8eRaF+pVXK9TrvJpSuv1smUDsY2+/pTJUB/WKbj sSvUuz8CnTkGQAU3Ru8S8x4T1nT40KRAHyeL1Rqvma3joxFXRgMI4IC0hFTlcKAJ3gb9 PPSAaNwq9pzxfnL/CEu97X3aEsvcTKkWEiLtaIlvPVcfQFIqwhiZTupQ9dH9t8yOvCTB LDZr1JWs4W1IuyUyxY9VxhhNkULQbA4j95CXn3x55p49CY1rT5niAnyN5yyK8x5UP56W p2BA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h15-20020a63384f000000b0053f3498ac9dsi6663152pgn.677.2023.06.12.06.35.05; Mon, 12 Jun 2023 06:35:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236886AbjFLM42 (ORCPT + 99 others); Mon, 12 Jun 2023 08:56:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236874AbjFLM4K (ORCPT ); Mon, 12 Jun 2023 08:56:10 -0400 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC3D71FC9 for ; Mon, 12 Jun 2023 05:55:06 -0700 (PDT) Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-30fa23e106bso1882772f8f.3 for ; Mon, 12 Jun 2023 05:55:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686574498; x=1689166498; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=JI38F6kc7Cl9oBDIHBZUEUTirCnCfKvB5Sv3x2W1g9s=; b=JifMR3Bvz8UDpDybvNCAtUwX2LsBHjZ0nQWb+W+y1r4oD00+2wr0PjpQ1KgCKU14KR n9GFGrQNVDJb+VXSF3GXd2vUr48dltgo/cHbf34DKnKCiyW6kD/NuSczHNPo0kxFx+CF NqQIu8Uucn4cYzSofX2rfO6Akkz1RQDOmZ7WWE5f1qU98i/DyIozn1NgYL05TRDnC0pY Vwyxwo9vkoKymah2OPoqaandPcfpjwcO8Mnc5PciONJK4k4sLindKz6Dl2bdrKwDgWLa yW6bqzjRYJ8raYGaaGDpeRajrhpBCqGgUV9ZGLIIUWvrlqcZsVz2r0kPqq1qII4JRaEv 8jnw== X-Gm-Message-State: AC+VfDzQ5qS1EfOdfYsN08ZmoSkWusiyLwQs2jRF00fyjMhgYhj/zTMe nYiItmEW+Z1habQyLdU42tM= X-Received: by 2002:a5d:4911:0:b0:30e:5b7c:de1c with SMTP id x17-20020a5d4911000000b0030e5b7cde1cmr3901549wrq.11.1686574498215; Mon, 12 Jun 2023 05:54:58 -0700 (PDT) Received: from gmail.com (fwdproxy-cln-007.fbsv.net. [2a03:2880:31ff:7::face:b00c]) by smtp.gmail.com with ESMTPSA id a8-20020a5d5088000000b0030f9c3219aasm10259601wrt.47.2023.06.12.05.54.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jun 2023 05:54:57 -0700 (PDT) Date: Mon, 12 Jun 2023 05:54:56 -0700 From: Breno Leitao To: Thomas Gleixner Cc: bp@alien8.de, pawan.kumar.gupta@linux.intel.com, paul@paul-moore.com, leit@meta.com, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] cpu/bugs: Disable CPU mitigations at compilation time Message-ID: References: <20230203120615.1121272-1-leitao@debian.org> <87352z7xld.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87352z7xld.ffs@tglx> X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 11, 2023 at 12:37:34AM +0200, Thomas Gleixner wrote: > On Fri, Feb 03 2023 at 04:06, Breno Leitao wrote: > > Right now it is not possible to disable CPU vulnerabilities mitigations > > at build time. Mitigation needs to be disabled passing kernel > > parameters, such as 'mitigations=off'. > > > > Create a new config option (CONFIG_CPU_MITIGATIONS_DEFAULT_OFF) that > > sets the global variable `cpu_mitigations` to OFF, instead of AUTO. This > > allows the creation of kernel binaries that boots with the CPU > > mitigations turned off by default, and does not require dealing kernel > > parameters. > > Why? What's the justification There are two major justification from my point of view: 1) We keep consistency with other CONFIG options. Linux already has a CONFIG option to enable/disable mitigations for speculations (CONFIG_SPECULATION_MITIGATIONS), so, this will be a similar one. 2) There are companies that have different kernel flavours (different CONFIG options basically), for different type of workloads, and a machine can change their kernel flavors a few times a day. I.e, for a specifically workload, boots in flavor X since it works the best. Mitigation enabled/disabled is key to some of these flavors. I would like to see a flavor as self-contained in a binary that I can mix and match. Right not they are not, since for some kernel flavours, you need to add kernel command lines (mitigations=off), which requires some hard logic, mainly when you are dealing with kexec and grub.