Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp705570pxb; Wed, 11 Nov 2020 14:17:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJy6XuT5X3AntjukE4Lg64BYVuI8OQaQ0TURT0wxz92/AkAHESD6QQtrXVTEPl/lrnbVkDj6 X-Received: by 2002:aa7:c358:: with SMTP id j24mr1843734edr.265.1605133055752; Wed, 11 Nov 2020 14:17:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605133055; cv=none; d=google.com; s=arc-20160816; b=udcbPJiXCWRdXWmN/39bz0MmfosMQcbx/o8FBeCvlz25e78VXLEeMly4WOXvneRq5z JT7qVNcw59adnVQIg1UCBx/hJ9LyEbcrbKpUuzJjkbkRwYMgkZBpaexpBn1mPo1peS9D 4KQCd4S1EWHxG7r9NHEYXUmT0tWsRvzHWry5ziWi0UcCL1htKIncOCBS+54nirXnVN6W J+ZgQxWj1sJVTBGkVd4ShR8nSb+d1b3e55iXwE+jlOhHM3US8oosI0bGVSEajlW53lCD i9T9jqC7eUFYMXYdNnHxwXjzxAttOmsIPjJCg2fxtpqe8R10khpCM/6k5XwLvuqqUQUd MoDA== 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=91r94iUTubA0MQQr1EcWS8Ca7E+cJ1bjSDANsENfj5E=; b=c7EOjXqmqvv1fzysnIc4NrWzWRbaCWwiASoa6escn7w3TvQEh5AzdgUXXuksHMK8Fx By9y5HuZfY8lQa6Quu69OXXx1tmaHyWHAaUWGXS0RZd4pXermMrL/2PaDJWVThqti41k 7s2IyPKsxp0/aRoRciIV4AF7LijjYPIsOAFHZFtF1I+Mc1wweEr9BkygExpXQR1LZAKD bX8Sv9o/dklR6Ia1T4U0U/BJqPRcQcsqlP1jCNbUxVACTfvkJJVXqL1tUdpqwxW0uYdx K+YMUorxKfemmA0xDZg08r9Ukdb/2fj/JkHVqlrUecujhjx1FB7O+H6FLRixccQyFIgk swLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=MRn7h105; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z19si2490498edx.461.2020.11.11.14.17.11; Wed, 11 Nov 2020 14:17:35 -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=@joelfernandes.org header.s=google header.b=MRn7h105; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726157AbgKKWPT (ORCPT + 99 others); Wed, 11 Nov 2020 17:15:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725933AbgKKWPT (ORCPT ); Wed, 11 Nov 2020 17:15:19 -0500 Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12827C0613D1 for ; Wed, 11 Nov 2020 14:15:19 -0800 (PST) Received: by mail-il1-x141.google.com with SMTP id e17so3435992ili.5 for ; Wed, 11 Nov 2020 14:15:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=91r94iUTubA0MQQr1EcWS8Ca7E+cJ1bjSDANsENfj5E=; b=MRn7h105jseFtjCynfvmm6KGobPP/y6Zm+duoe0ES8mCsTxCU/X7iUeZdPzBR5lMv9 CiA1qy0yEYzuU5U00uYkdGTUQXjx/8TYWPz3EbHcCwzaiQrAyVZKsVjw5EiQJXwk3pcZ MKLLTceD5+ZRE6oWx0VdVpyFthoDnwR9nLjn0= 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=91r94iUTubA0MQQr1EcWS8Ca7E+cJ1bjSDANsENfj5E=; b=XBTEX12m53OCIQXcFEtRpAoCLt/6ObIyrqhuRx8q/sx6gwDpAr+ywkGVgSEg86uihM ljkKYoplM5T3evl6ok6AZGOXq4JUSO9X5D1V7CVZSs1G5tHwrAwKL7rBNSvCOF1b96u1 3jRftaDkQLPAiDaJ3joSf/1t2YAZGkjyItKSN7w0pSZmo+FNZmMkf2gntUp0tW0vGsjJ U0CvPxlM/lgkcwnlChtp2UcmEdEu7LugtX4RoAaHfcswJQU4JyXRBG2PQRpbQrKIVM6j 4ZVBN+4qXIDNIYKAlLMh8pYemuqfaXGGzA/iDiJhJBIs4zqrvTnTid7HgRpPzrKXoerv tvdw== X-Gm-Message-State: AOAM530uiNERd8L9OSKjwuZaWY0dM9Eccc9RVSCqqI0Dr0UJGqY6cI4h /ChDa90vUAw9EWKjFa0xCKE1GqjVaYFIbecmICnoJg== X-Received: by 2002:a92:c0c9:: with SMTP id t9mr6742653ilf.262.1605132918419; Wed, 11 Nov 2020 14:15:18 -0800 (PST) MIME-Version: 1.0 References: <20201111211011.1381848-1-joel@joelfernandes.org> <20201111211011.1381848-2-joel@joelfernandes.org> In-Reply-To: From: Joel Fernandes Date: Wed, 11 Nov 2020 17:15:07 -0500 Message-ID: Subject: Re: [RFC 1/2] x86/bugs: Disable coresched on hardware that does not need it To: Alexander Graf Cc: Nishanth Aravamudan , Julien Desfossez , Peter Zijlstra , Tim Chen , Vineeth Pillai , Aaron Lu , Aubrey Li , Thomas Glexiner , LKML , Ingo Molnar , Linus Torvalds , Frederic Weisbecker , Kees Cook , Greg Kerr , Phil Auld , Valentin Schneider , Mel Gorman , Pawan Gupta , Paolo Bonzini , vineeth@bitbyteword.org, Chen Yu , Christian Brauner , Agata Gruza , Antonio Gomez Iglesias , konrad.wilk@oracle.com, Dario Faggioli , Paul Turner , Steven Rostedt , Patrick Bellasi , =?UTF-8?B?YmVuYmppYW5nKOiSi+W9qik=?= , Alexandre Chartre , James.Bottomley@hansenpartnership.com, OWeisse@umich.edu, Dhaval Giani , Junaid Shahid , Jesse Barnes , "Hyser,Chris" , Ben Segall , Josh Don , Hao Luo , "Anand K. Mistry" , Borislav Petkov , Daniel Bristot de Oliveira , Dietmar Eggemann , "H. Peter Anvin" , Ingo Molnar , Juri Lelli , Mel Gorman , Mike Rapoport , Tom Lendacky , Tony Luck , Vincent Guittot , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 11, 2020 at 5:13 PM Joel Fernandes wrote: > > On Wed, Nov 11, 2020 at 5:00 PM Alexander Graf wrote: > > On 11.11.20 22:14, Joel Fernandes wrote: > > >> Some hardware such as certain AMD variants don't have cross-HT MDS/L1TF > > >> issues. Detect this and don't enable core scheduling as it can > > >> needlessly slow the device done. > > >> > > >> diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c > > >> index dece79e4d1e9..0e6e61e49b23 100644 > > >> --- a/arch/x86/kernel/cpu/bugs.c > > >> +++ b/arch/x86/kernel/cpu/bugs.c > > >> @@ -152,6 +152,14 @@ void __init check_bugs(void) > > >> #endif > > >> } > > >> > > >> +/* > > >> + * Do not need core scheduling if CPU does not have MDS/L1TF vulnerability. > > >> + */ > > >> +int arch_allow_core_sched(void) > > >> +{ > > >> + return boot_cpu_has_bug(X86_BUG_MDS) || boot_cpu_has_bug(X86_BUG_L1TF); > > > > Can we make this more generic and user settable, similar to the L1 cache > > flushing modes in KVM? > > > > I am not 100% convinced that there are no other thread sibling attacks > > possible without MDS and L1TF. If I'm paranoid, I want to still be able > > to force enable core scheduling. > > > > In addition, we are also using core scheduling as a poor man's mechanism > > to give customers consistent performance for virtual machine thread > > siblings. This is important irrespective of CPU bugs. In such a > > scenario, I want to force enable core scheduling. > > Ok, I can make it new kernel command line option with: > coresched=on > coresched=secure (only if HW has MDS/L1TF) > coresched=off Also, I would keep "secure" as the default. (And probably, we should modify the informational messages in sysfs to reflect this..) - Joel