From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (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 56121376A11 for ; Thu, 25 Jun 2026 22:04:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782425098; cv=none; b=sp9VKXAIUuxsbSoko9Pg0GqtpzLucyzaezYYd3hPfpZYU9yxGTUxfkV/TWDTK12TJ5lQMNFnfr3z98H+GEPnP+UbBsotru0KfiwwlCQbGpgY5CCKvG1n4ulZHUQEGh58ldaAs5NQL79AbXQjJ67gpMWNjT/1vlwCsQXTs28wNbs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782425098; c=relaxed/simple; bh=ohGR4tybGsGwnG8zSyNw7id14okyWjMdatdmOU8g+r8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=fOMFA3HSjapsWyI0YHQPdvf3GcL/9nQAfq+XXdmteH850NBIvsMI4CZIeGNIY07Kn8P2PGNoXxJnrQT9QWpHfn9yC4ZVfD0Cnil20ajac5AtCuODLzKlouuAs6PMeEJU6yQSIvwjlXlzuvGp7ROv5zKulTiGFvKYPWTxWH7QpZs= 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=MPLirnQ3; arc=none smtp.client-ip=209.85.214.201 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="MPLirnQ3" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-2c2d0a8b5beso2646835ad.1 for ; Thu, 25 Jun 2026 15:04:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782425096; x=1783029896; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=RZDKSZXWGrkG6G3v9NbzY5n6wGj5GjUyTAQDn3wMgSk=; b=MPLirnQ3gRZ1WZprOWTvnRSkolqM8LynARtTOQZbx9VLXHjEAa4YagTu1rtx+p8ReG opYLra44R4wFumBvVX3uU2Nl3nUP3T9Q1qHYdp7ESet+dUcUxMyk8NGrLYbU6okp+quF 4y+6KxM0ydW+3s65oxo4X3x8gvakcsWqYQjmPpEeuA/x+pk362LdV26IREIsrvLvH0e+ MTpQo3wHVhnd9quSIpoj0jg6iWUMlMxtiTO2sMLAummmw3OUoBIdFfTH/W4zdLBAvaN7 jD9lVxyJsOVsCX3av3KCif9ibQdEw+oKm9+LHVIuiLJCevlUERhtqJLLHh853O846JkA v9mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782425096; x=1783029896; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=RZDKSZXWGrkG6G3v9NbzY5n6wGj5GjUyTAQDn3wMgSk=; b=pVPkEWa0GRf4I57xf8j0bWHzaNAvV8+Tg6uUc0fNGq+/yd29KYDFqPqohq1qW+VXKX b4HFfq+RV0a7Jjthj2Mg4qXSkqaAgxPfq1vOlUlGeqs7Q99REfSXs1N/wr16dCDnFoAJ JLrXVbE0lJLBH1WshQ4iRA87ra9W7C0p2T8TDz30OQJUcgNC8D/5+A5RNpTh2VbID+WO adXrtGsXCmH9RQLp4ilT4kzCP33prrPLHEJJgyOYL2YSUYh571Yfi32XYwe6522+nO+v OxwYk09+eKN3OZOQ1DOIvSa7G2Gy1RZRXntkhom46UsGjIRWFizk+0g65+lV7E6Hx7ee G+/w== X-Forwarded-Encrypted: i=1; AHgh+RoGahkjCZxBK0XMmCM+dLoNC8XaLoDXAwQ+LvC0AdChCs+PaCxBXLSA4cvbuuNXvEx1vSznOLG/2oUj5rw=@vger.kernel.org X-Gm-Message-State: AOJu0YymFiRF0zwBvoB1Clg5HLFy9v04HpHEQV08/R5mMmkR57BdxPcT mMItfHVo72OcabVP6+GN7oovIuAKw/9eYOgATZPu7pYCs8IWCvrIYpf0AmJCRmYESli+ceRFdE2 kB73Pew== X-Received: from plhd7.prod.google.com ([2002:a17:903:2307:b0:2bc:aee7:306a]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:ec91:b0:2c0:a711:539 with SMTP id d9443c01a7336-2c7fc65bf6amr39666525ad.5.1782425095342; Thu, 25 Jun 2026 15:04:55 -0700 (PDT) Reply-To: Sean Christopherson Date: Thu, 25 Jun 2026 15:04:43 -0700 In-Reply-To: <20260625220450.3354415-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260625220450.3354415-1-seanjc@google.com> X-Mailer: git-send-email 2.55.0.rc0.799.gd6f94ed593-goog Message-ID: <20260625220450.3354415-3-seanjc@google.com> Subject: [PATCH 2/9] KVM: x86/mmu: Annotate tdp_enabled as being read-mostly From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini , Vitaly Kuznetsov Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Binbin Wu , Kai Huang Content-Type: text/plain; charset="UTF-8" Tag tdp_enabled with __read_mostly as the variable is only ever written during vendor module load, same as all the other global MMU variables that are handled by kvm_configure_mmu(). Opportunistically annotate the tdp_mmu_enabled and eager_page_split declarations with __read_mostly, to match their definitions. The compiler will warn if there are conflicting annotations, i.e. there's minimal risk of the declaration annotation becoming stale. No functional change intended. Signed-off-by: Sean Christopherson --- arch/x86/kvm/mmu.h | 6 +++--- arch/x86/kvm/mmu/mmu.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h index c9f628b97dae..85bc503de1b6 100644 --- a/arch/x86/kvm/mmu.h +++ b/arch/x86/kvm/mmu.h @@ -6,14 +6,14 @@ #include "regs.h" #include "cpuid.h" -extern bool tdp_enabled; +extern bool __read_mostly tdp_enabled; #ifdef CONFIG_X86_64 -extern bool tdp_mmu_enabled; +extern bool __read_mostly tdp_mmu_enabled; #else #define tdp_mmu_enabled false #endif extern bool __read_mostly enable_mmio_caching; -extern bool eager_page_split; +extern bool __read_mostly eager_page_split; #define KVM_MEMSLOT_PAGES_TO_MMU_PAGES_RATIO 50 #define KVM_MIN_ALLOC_MMU_PAGES 64UL diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index 6c13da942bfc..af3820136f7c 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -104,7 +104,7 @@ module_param_named(flush_on_reuse, force_flush_and_sync_on_reuse, bool, 0644); * 2. while doing 1. it walks guest-physical to host-physical * If the hardware supports that we don't need to do shadow paging. */ -bool tdp_enabled = false; +bool __read_mostly tdp_enabled = false; static bool __ro_after_init tdp_mmu_allowed; -- 2.55.0.rc0.799.gd6f94ed593-goog