Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp154597lqp; Thu, 4 Apr 2024 09:19:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWfZcF48Hn7DzhZMm19xGfhBm7PraYKQ69eTpRRS+1pMm0ijm0hMeDgw9TjZbh0gJcxmavt5w6SJAX/RT5Z3t3lHleHjpYSyb0rg/mn/g== X-Google-Smtp-Source: AGHT+IGrUdLFRswKWeipn71tnhoZ90uR4zMt0LwcPTeM9wF0TR8o3MQhmvznlS+VRjjcFPdiBH9U X-Received: by 2002:a17:906:2316:b0:a46:8c9f:f783 with SMTP id l22-20020a170906231600b00a468c9ff783mr122480eja.67.1712247540100; Thu, 04 Apr 2024 09:19:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712247540; cv=pass; d=google.com; s=arc-20160816; b=AZpOpQ3QzbOfy2VHTB35UmlvBmtPTle8bt1pFJVSglL8CylvnuIYAzZT4w+3YP2TY/ qbyZ3PhjNw7cG9ys/ibnAVEcP/ix8lQdcTY9Pfl3KnE4AgHkBebgyxhfbMHHCqmz2Uj8 PZ7WEN7V/WpE/MqSHgp/PHURjlJ4wU/8EohIBRwMIIl/KbPpNWQ/Wz2zFnx3yl75xc8S X3MjTB2KHRJg17Mt5Mqw164IzYUkpUkrDHQC9G4tsc2wq9Ii5uZCNtenX+A92RlqcJmO 7Pgm1GF6zdhNYykz6HXt8lB50EtGzkWBSoCD6J5Cs1qHe7/6OmuEycAzjFfXdSCuwlY9 Pd5g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=iVwR60M09qp3eNkKBsyNij7ZpEjKjJ0flnXDpzKp76o=; fh=B6aUsR3tWA4d0MkyV2R87fHpsN/RZp8t495ZCRO9WYg=; b=jTKETYiBlCx21fyaP5lAcG8HEgJ6Qr0f4PSxtgDMdjiLdsNgPor1zr7fKkXlpPE4dF /OQEkCn8v4MRZGYWbPbpuKhwo/3MR1IJ2OSXiODmH4MjpA0iA4XPkBHCPwIYETP+a+w3 uk4Eg7cnOFPPwBktqAzoP3SzqQlatEviak5RGj86Id39lea5otcRJAY3UbN5wNdOpO3x AHLs2qT6MDz2CMDXbFEWbpFfiCG5LC3e13elJN4oI5Bmd4AVbtK1ZZSnq2yMBHvcKI0z 0rSkf+bhWjiruO7Z4Xjp9bq22lP6oIhET8Ez/gZMkL7MKu23/a1a88yVX78cw/nk/6ht F2/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=wDbkKZXL; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-131807-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131807-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id g25-20020a170906349900b00a519d318d6bsi77115ejb.210.2024.04.04.09.19.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 09:19:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131807-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=wDbkKZXL; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-131807-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131807-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D20731F254D8 for ; Thu, 4 Apr 2024 16:18:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1DECA12BEA4; Thu, 4 Apr 2024 16:18:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="wDbkKZXL" Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF1FC71734 for ; Thu, 4 Apr 2024 16:18:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712247529; cv=none; b=XFZh77gS3raLYHNK9+hgv5vyM1cBMheLlfNj0o7c7qUxSlXSyT/wKXo0K+XIhuxyqf3SRm45exvLaXkDFWeX0Gpg2WD5ttAlMIMV/yCTXUBR4nwOzg6X9qnkE+1yV285tCydvxfa5LZ7LwYYiGp5593fhGbSHyqNLOlIMpRcAcQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712247529; c=relaxed/simple; bh=ni9ef8/m9sbD2y1ei5GZR7E9mc/Du+rMHCoorxfhMe4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=pa96d6wtol5Lze6UjkSLXELhpr3LwHBTWIdH5S8eqbaDtFLscaSwGblvIZy4B+yJvPAdER/9N5Zcop7wmZDhm+2XkweHCics+3/MNZ7pKjGD3o0IzwJUeLR3C5rcp8YAbj/bgXaEhSvLJu+hg7srD6bcaaBvsV5DbMqwf7vo4u8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=wDbkKZXL; arc=none smtp.client-ip=209.85.215.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-5d8dbe37d56so1028741a12.0 for ; Thu, 04 Apr 2024 09:18:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712247527; x=1712852327; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=iVwR60M09qp3eNkKBsyNij7ZpEjKjJ0flnXDpzKp76o=; b=wDbkKZXLfKzxHt33oJWa05hJCPn+K8t8E8VNrofIflKRX7wd2KIUJiB6FxOQnE6CR/ Bc+eJ4kk5jUwrcSaL5YNLDHMEyppSc1/MRNwe8hv1tNvh4VTvtLu6HYmDXjliYvynwhp VyaOQ+l75An+A6+4+D8FbS4wTnPTVUJmlAtA/mis2aVoFUmNTC+BuJKAyAnWn0BOXJzs XIKlxGHqKdvOFqL0c4pPpZFBdT5JLISAfMdy/QSNL/Ax8xzFKW+kv9Km61NK/RkTowTV fIwr2WiusfOY3hGt4GQY1T9Hqrjuedvu2YhqvpRBIhzjo59BVXTpA6muMrljpgQF85KV XR/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712247527; x=1712852327; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iVwR60M09qp3eNkKBsyNij7ZpEjKjJ0flnXDpzKp76o=; b=k6wkmPi3JeHW1Zm8hEzD39JoVhw6YtBUn2ysd+01QWuE0M4K9DU7KGQON5HLMl0v3a 87Qs1jSMcrnJFmjyWqp7QOOBOCCAaym9enQvfgiSdzSMU97RNrHGm8Nl6qCA8Ra0tPFI 7KGYeglKUKYoCU+f4Bv6on358GrMi3cSHWLAlBe63uJ2arw7TxpoEXyIiZ0TINd58sWj j4fk+kAFj915QYwu5WY9XqHT4bi5tclxVkFlY2NJD3pNr9AANE0R5f82oJ+dLP4W7nnP H4EztMNa1DqZoAMj3qajvgtqOkCr6H/oT0fcSWGf6EBY1JcjKY8TvynD03ShM/OJrEDk WP7A== X-Forwarded-Encrypted: i=1; AJvYcCVavXDjOzkTNjKZG/+f/FhaYHjGqTjta9pyGlEUnDFNrBMqujLS740fjxXQcyt2h54dwwZ1mKqfVcOF9kqlqj5j8WSn8VXL0OcHQo1n X-Gm-Message-State: AOJu0YxCkZ/zLR8EmYTYY+F5g34RcO0f05eaVkLd9TCxQWJ8nT47EzqN tvPjnboJyzVfAL3y5hSgdV37J57HPY0Wf7II0ophiJUndFFtN7HJWY8ZrUIcFDzKmQWrp1LMJmb NiA== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a63:9a41:0:b0:5dc:11fe:525f with SMTP id e1-20020a639a41000000b005dc11fe525fmr8407pgo.6.1712247527094; Thu, 04 Apr 2024 09:18:47 -0700 (PDT) Date: Thu, 4 Apr 2024 09:18:45 -0700 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240324190503.116160-1-xry111@xry111.site> Message-ID: Subject: Re: [PATCH v2] x86/mm: Don't disable INVLPG if "incomplete Global INVLPG flushes" is fixed by microcode From: Sean Christopherson To: Michael Kelley Cc: Xi Ruoyao , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , Dexuan Cui Content-Type: text/plain; charset="us-ascii" On Mon, Mar 25, 2024, Michael Kelley wrote: > > static void setup_pcid(void) > > { > > + const struct x86_cpu_id *invlpg_miss_match; > > + > > if (!IS_ENABLED(CONFIG_X86_64)) > > return; > > > > if (!boot_cpu_has(X86_FEATURE_PCID)) > > return; > > > > - if (x86_match_cpu(invlpg_miss_ids)) { > > + invlpg_miss_match = x86_match_cpu(invlpg_miss_ids); > > + if (invlpg_miss_match && > > + invlpg_miss_match->driver_data > boot_cpu_data.microcode) { > > pr_info("Incomplete global flushes, disabling PCID"); > > setup_clear_cpu_cap(X86_FEATURE_PCID); > > return; > > As noted in similar places where microcode versions are > checked, hypervisors often lie to guests about microcode versions. > For example, see comments in bad_spectre_microcode(). I > know Hyper-V guests always see the microcode version as > 0xFFFFFFFF (max u32 value). So in a Hyper-V guest the above > code will always leave PCID enabled. Enumerating broken PCID support to a guest is very arguably a hypervisor bug. Hypervisors also lie to guest about FMS. As KVM *user* with affected hardware (home box), I would want the kernel to assume PCID works if X86_FEATURE_HYPERVISOR is present.