From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (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 B79988C1F for ; Tue, 14 Oct 2025 00:01:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760400098; cv=none; b=kQEnXujvTPvgrtd4leMT2yq+ZOY3olju7oI3YSnF+JscQgyaC7rhRSYYl/A2+akTAkyYN7ueVeUCsuXBHSgzXFCWC0znQaOA1saXe5d2bGPP55HZE1+BgI7l1JhyzBsaxY5LpNeWGFaPRNPnjWSQgjFg6DBvtwkh0EGrpdbTuPQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760400098; c=relaxed/simple; bh=30EZppTfWymzd62I2Q/lqosIjvmCAwH24sBiTejyFlw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=pN3T6EWyaPBIYoqoA7g43pODY+R7iOCq0O3ni3wLH7pHhvlH4QM2lGLg61LmFBM0OASRLS8w2FnaNAd6bMSPv13Gi+wORHB+f4z+5Ek4ixGOdPzamEYp+WnG+CioVoBaIbQyNXXyoGb2nuQieQMI9vqfowNyeu2+feWPltMtvX8= 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=NFSvjMUq; arc=none smtp.client-ip=209.85.216.73 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="NFSvjMUq" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-336b646768eso11232274a91.1 for ; Mon, 13 Oct 2025 17:01:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1760400096; x=1761004896; 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=60W7dGApFCGXHKlXBRGDaLpu3YLgl4WyK3JcN6QaedU=; b=NFSvjMUq2klOBCTmti7DH4DcdNC7CMOJwlSo1RjpkXxF3R9H69Ct/dTvIZwFVQR2Xf Whf+5fsmbl0P/2Ko+cWUas9w/xZNychL9Ym3NMchbnNtiycj3rh23wYzvURitxbU+DvA 1rcm65Iu341qU2bQ+gPG1BqmbbCyWc+a2/bn8LPA6JeVxRLWCJdwSBTJbK8qluUXjCk0 jh5r1YJEpu4ReFUtYHiaKdrkxvn2ppxU6Ws5tRRmX58ukcrReJ3NbCa04Wegu45U+1GP 0ZXRnOtkDweU4ipy7pGneBjobiANtQ8wLPP0ls3FmwPm2tQ8af0nE4dqKEhXCIPoUzTN YOVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760400096; x=1761004896; 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=60W7dGApFCGXHKlXBRGDaLpu3YLgl4WyK3JcN6QaedU=; b=rbietMU4mVw03XiPu+ld6uNoUo/4LBsa5P7Z3SWUS299X8/9Cy8lANb1hEzr3PCjii DFcGgq3uDp0FxxZlOtpqBh8uzzfc2VlQ71Hzue5n2Zx+Gv5GLaU38Re5u3oV4dQtYfve 3MOi7XVnO8lbLulhtx0OS2UnFLD4WnnbpYzwPXx2VmIajvg2jAZFpYph/OcU+bZ2+CMs 7jJtd5AVHkkXjptuozpFJIAWhXGSXyCQ09PMDKVKrlP8nxkX1Ak4/PFdgz+uhbBsyWCS mBUXcWwiLOZlJZFkbPjBAZBMtX9So7Y59lJu1ioNCJfbEXe1w5RLyioL74eUwQvpLoTA fpfA== X-Forwarded-Encrypted: i=1; AJvYcCW7jUbDiPcHjErmyX1YuoZ0arlqUZASUctAcgH4wOI5t/PQpuCrU9/LG522sfKFlDn3580=@vger.kernel.org X-Gm-Message-State: AOJu0Yy2F8LzHHgkLqGQ8obfDBk9JiUccm+wgtU9WGwlWkONSA/BZ+M7 YlZF+JDeukpBZ9xJodOhQdhzOsKQCUIFVb4dVGq7bBZgGsENk8QfgWVKaLZvNJMMB5+1QRa4WAN vLXwTCQ== X-Google-Smtp-Source: AGHT+IHFYfnmFjxjbFQp7BMqqD83h/lwfyE6WGt5bwyArJ6H0ox9P/tbWn8NIGRGgabEk9PVFSZMkd4SLvs= X-Received: from pjbbk16.prod.google.com ([2002:a17:90b:810:b0:339:dc19:ae5d]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:38d2:b0:335:2eee:19dc with SMTP id 98e67ed59e1d1-33b5138401amr31287086a91.28.1760400096074; Mon, 13 Oct 2025 17:01:36 -0700 (PDT) Date: Mon, 13 Oct 2025 17:01:34 -0700 In-Reply-To: <20251010153839.151763-20-vschneid@redhat.com> Precedence: bulk X-Mailing-List: rcu@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251010153839.151763-1-vschneid@redhat.com> <20251010153839.151763-20-vschneid@redhat.com> Message-ID: Subject: Re: [PATCH v6 19/29] KVM: VMX: Mark vmx_l1d_should flush and vmx_l1d_flush_cond keys as allowed in .noinstr From: Sean Christopherson To: Valentin Schneider Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, rcu@vger.kernel.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Josh Poimboeuf , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Arnaldo Carvalho de Melo , Paolo Bonzini , Arnd Bergmann , Frederic Weisbecker , "Paul E. McKenney" , Jason Baron , Steven Rostedt , Ard Biesheuvel , Sami Tolvanen , "David S. Miller" , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Mathieu Desnoyers , Mel Gorman , Andrew Morton , Masahiro Yamada , Han Shen , Rik van Riel , Jann Horn , Dan Carpenter , Oleg Nesterov , Juri Lelli , Clark Williams , Yair Podemsky , Marcelo Tosatti , Daniel Wagner , Petr Tesarik Content-Type: text/plain; charset="us-ascii" On Fri, Oct 10, 2025, Valentin Schneider wrote: > Later commits will cause objtool to warn about static keys being used in > .noinstr sections in order to safely defer instruction patching IPIs > targeted at NOHZ_FULL CPUs. > > These keys are used in .noinstr code, and can be modified at runtime > (/proc/kernel/vmx* write). However it is not expected that they will be > flipped during latency-sensitive operations, and thus shouldn't be a source > of interference wrt the text patching IPI. > > Mark it to let objtool know not to warn about it. Can you elaborate in the changelog on what will happen if the key is toggle? IIUC, smp_text_poke_batch_finish() will force IPIs if noinstr code is being patched. Even just a small footnote like this: Note, smp_text_poke_batch_finish() never defers IPIs if noinstr code is being patched, i.e. this is purely about silencing objtool warnings. to make it clear that there's no bug/race being introduced. > Reported-by: Josh Poimboeuf > Signed-off-by: Valentin Schneider > --- > arch/x86/kvm/vmx/vmx.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index aa157fe5b7b31..dce2bd7375ec8 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -204,8 +204,15 @@ module_param(pt_mode, int, S_IRUGO); > > struct x86_pmu_lbr __ro_after_init vmx_lbr_caps; > > -static DEFINE_STATIC_KEY_FALSE(vmx_l1d_should_flush); > -static DEFINE_STATIC_KEY_FALSE(vmx_l1d_flush_cond); > +/* > + * Both of these static keys end up being used in .noinstr sections, however > + * they are only modified: > + * - at init > + * - from a /proc/kernel/vmx* write > + * thus during latency-sensitive operations they should remain stable. > + */ > +static DEFINE_STATIC_KEY_FALSE_NOINSTR(vmx_l1d_should_flush); > +static DEFINE_STATIC_KEY_FALSE_NOINSTR(vmx_l1d_flush_cond); > static DEFINE_MUTEX(vmx_l1d_flush_mutex); > > /* Storage for pre module init parameter parsing */ > -- > 2.51.0 >