From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) (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 82DB24A8C71 for ; Thu, 6 Aug 2026 23:37:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786059434; cv=none; b=NYY65UPIYLAbr53JzB9b+B7N8GG+v+mgClRJ0+r/+oUe8Zukd8wzTO22RE7LSJ1N87R5NabIqpc02xEwwYm0aM/fSFwLTF7KNz51vBrYOTfnjowgo6teeLJJh36OXWmJM99xOVd2TMRbHNzaFKrulh0gg5GMX1Pnz0G+K2SUnHE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786059434; c=relaxed/simple; bh=xQeSz+UJSRzEJeUN758xlvy+p2UjlhjfQlkKcSNGiA0=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=HJ/Ipe8PD2sv1KWyozQoHPsTuLKiCrOlxNtEqNB9tgKkOMD3u8JpQL42UO4wTI1T+v5PcA+UyPBo/JovdR5IlOiPjGWiI2MV+BRMLq4kLGz65c72ShXNqWcI97D1VvG7/a3AgJmgW0YaVjBZg4es6GECAF/+pOzGyHxY9J5brnU= 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=FxLtI8uT; arc=none smtp.client-ip=209.85.214.199 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="FxLtI8uT" Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2ce7dfd33ffso32942265ad.0 for ; Thu, 06 Aug 2026 16:37:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1786059431; x=1786664231; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:reply-to:from:to:cc:subject:date:message-id :reply-to:content-type; bh=dLl1t0qRZTm556OBeVqKVx/DHfexmKODeXAiUOaDm4I=; b=FxLtI8uTpRMW3QsjAnJm+ORVKEpbSKKgwRYg5ddW/C+NUAk4Ci81ny7RUQmuh3+1OS HYmjrOCOz3QAjZYC9543vUexa1aJcsIj5LlnPRImZhdPK/OvRI9JPrkn3K5g8XjZnHgR Jfglss7Ka13TdAriw1cqYZxnz9+hr+ZMOQSs1gRieeNFVnnKaltdvtJGNGbYEv16zem8 4+jbBYz/NU9+/EVFg33nsyG/B1k1sIQHNt5MDATzODrJRupRKitPLlhi+Ozrm14C6x4x lHhNDaTKcds4wXHm5qQ0kQmNTO4+QTW76Mi57IOAVkGp0WQk5rMaGv2ofxXWgEevITC7 kznA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786059431; x=1786664231; h=content-type: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:content-type; bh=dLl1t0qRZTm556OBeVqKVx/DHfexmKODeXAiUOaDm4I=; b=TwTBmhgfN3vN8pAaZhK0w2PTLmb/wRWJnEYy6jtVrWLGRBZjoEnxEW1KAb9m5s+Q63 4LV1mrTl4n8YeMSTXamEpLPtQKuSUxl9GtqiiFHX+YACXlu6jf7DJW/oEg6SMcGqz33d KXP1iiWHOuJiqkfyrpYAlm31CEmOXPc8alUsbWfPsqhOwozlc0ZxspCdHhG62g6vLsbJ Mh6gRKukT3FsL29wQwT1sfP+LWlhIS4dbNUXCEV2K1hM776/7FZFOzK7qvMwqMXv90n8 q0hWL8pT6PBi1rncmBHZiIdlC/yeLlGJ4nKVnBAAjvr1Fj1nxmRHqgyqP+s8GSuuc9it oWwg== X-Forwarded-Encrypted: i=1; AHgh+Rro9G2NxeD94EhJST9iUehnNDKvie1hzmfdT+O6wAg/MaykXKgZmOOC1yPc2r5xxC8RUpxtuk/DWkU0Hd8=@vger.kernel.org X-Gm-Message-State: AOJu0Yzye5QpfmA53md1RIdYN+/zvho2xi8cqAbKHyzYbYGKxj9h0ifP J3wDSdRPjp9eNjL3zl1hoatnwvAGhYlJzsBKOVACLcZRnex66LjNmgRksVpYqfa58HFjzFEIiVu dkjOyKQ== X-Received: from pjzg4.prod.google.com ([2002:a17:90a:e584:b0:38e:b470:e6db]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:2590:b0:38f:2168:b9cb with SMTP id 98e67ed59e1d1-3903c572a05mr18787499a91.9.1786059430539; Thu, 06 Aug 2026 16:37:10 -0700 (PDT) Reply-To: Sean Christopherson Date: Thu, 6 Aug 2026 16:35:54 -0700 In-Reply-To: <20260806233609.212337-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: <20260806233609.212337-1-seanjc@google.com> X-Mailer: git-send-email 2.55.0.679.g6767b8d81c-goog Message-ID: <20260806233609.212337-38-seanjc@google.com> Subject: [PATCH v6 37/51] x86/kvmclock: Move kvm_sched_clock_init() down in kvmclock.c From: Sean Christopherson To: Kiryl Shutsemau , Rick Edgecombe , Sean Christopherson , Paolo Bonzini , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , Ajay Kaher , Alexey Makhalov , Jan Kiszka , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Juergen Gross , Daniel Lezcano , Thomas Gleixner , John Stultz Cc: Vitaly Kuznetsov , Broadcom internal kernel review list , Boris Ostrovsky , Stephen Boyd , Miroslav Lichvar , x86@kernel.org, linux-coco@lists.linux.dev, kvm@vger.kernel.org, linux-hyperv@vger.kernel.org, virtualization@lists.linux.dev, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, Michael Kelley , Tom Lendacky , Nikunj A Dadhania , David Woodhouse , David Woodhouse , Thomas Gleixner Content-Type: text/plain; charset="UTF-8" Move kvm_sched_clock_init() "down" so that it can reference the global kvm_clock structure without needing a forward declaration. Opportunistically mark the helper as "__init" instead of "inline" to make its usage more obvious; modern compilers don't need a hint to inline a single-use function, and an extra CALL+RET pair during boot is a complete non-issue. And, if the compiler ignores the hint and does NOT inline the function, the resulting code may not get discarded after boot due lack of an __init annotation. No functional change intended. Reviewed-by: David Woodhouse Signed-off-by: Sean Christopherson --- arch/x86/kernel/kvmclock.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index 5b9955343199..5220d205abc7 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c @@ -155,20 +155,6 @@ static void kvm_restore_sched_clock_state(void) kvm_register_clock("primary cpu clock, resume"); } -static inline void kvm_sched_clock_init(bool stable) -{ - kvm_sched_clock_offset = kvm_clock_read(); - __paravirt_set_sched_clock(kvm_sched_clock_read, stable, - kvm_save_sched_clock_state, - kvm_restore_sched_clock_state); - - pr_info("kvm-clock: using sched offset of %llu cycles", - kvm_sched_clock_offset); - - BUILD_BUG_ON(sizeof(kvm_sched_clock_offset) > - sizeof(((struct pvclock_vcpu_time_info *)NULL)->system_time)); -} - void kvmclock_cpu_action(enum kvm_guest_cpu_action action) { /* @@ -325,6 +311,20 @@ static int kvmclock_setup_percpu(unsigned int cpu) return p ? 0 : -ENOMEM; } +static __init void kvm_sched_clock_init(bool stable) +{ + kvm_sched_clock_offset = kvm_clock_read(); + __paravirt_set_sched_clock(kvm_sched_clock_read, stable, + kvm_save_sched_clock_state, + kvm_restore_sched_clock_state); + + pr_info("kvm-clock: using sched offset of %llu cycles", + kvm_sched_clock_offset); + + BUILD_BUG_ON(sizeof(kvm_sched_clock_offset) > + sizeof(((struct pvclock_vcpu_time_info *)NULL)->system_time)); +} + void __init kvmclock_init(bool prefer_tsc) { u8 flags; -- 2.55.0.679.g6767b8d81c-goog