From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (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 B19341862 for ; Tue, 14 Oct 2025 00:01:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760400099; cv=none; b=LOJss8Mq5z9x1AzAvcLYWY9ntYDexXGg1SMmfaw7wI2t012sooMw3BNYIUxpkSvW0L8hUXRsPLYrBRPtD4tTzSlDAjP4vG1r09JBus5IX9nZ1BO4DKhqkA4Ys6XRR6TugPvE/9eBNwOKoRb3HNd5j/BCPp3Ash2d1Mwjebon+Mk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760400099; c=relaxed/simple; bh=30EZppTfWymzd62I2Q/lqosIjvmCAwH24sBiTejyFlw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=oFy17a2MIS7UbUD2nSa0up1o/Ed5+oSVdQr23ykehYAXFiqz1Iatt9E9FSACKSvf87G+z5ZbDNNJ5ypsR7NNM7fllJXgw3EQoKQETepQpJFpjEEFsve+pGz8UM2tVzLF3cWxVEv3h5fFDbm52bwgs3m5Whteij7wogHLCEw6gP4= 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.74 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-f74.google.com with SMTP id 98e67ed59e1d1-336b646768eso11232272a91.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=m1Wti/IQMbzZkJEw66EJV72T0ZesK9gTE+St2wBoV/L6r/vt0OPdvbSDTyBC1+Xlc1 siS4W4rlYRI+J/rZPGcgIOlCKMts+ic05335px6uJ6MJxIV7IRW5T3aNaRUClcR7vb47 7KJM4ve7ZJ13YQEc1YcMiB1yr07pSn/FljvAoxoNTe+hCQtls/ig2OeSUfobMgg230sh 3/YHZvnTHBFeZ3Ts/HKEE28uuF+CT5pC5ZayX7bIuyxutI4tKr6OH8dACti4+bmO4GK/ 9XfNEmkCkgpq4iBhq96Myao5uHMQ75McDYn3tAcItQJS7pDpSDsx1IDA0n0uu6rG72Yu 5GZA== X-Gm-Message-State: AOJu0Yz6M6iSg5LAQldNPYkfpHN+rON49f79HUoTREUWZusBrgdA6ZiQ 1e68aOJwPGb8KUMK5yDwv6wxDMbAp8Vwx64qStdDRVmrLBxbwYObn9Xvk/CTuvz4ZoSj8QVW82C bOpgpXA== 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: linux-kernel@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 >