From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6ABA235E1A1 for ; Fri, 15 May 2026 19:55:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778874958; cv=none; b=bFU3Ql8Gx2s4dsl6P4OaDdlFyDQhE8ZPumX5XN/Fu6k+eDAwgsZa1R6A0TpSd/s4ikj+Wv5WX8fMbTd5dOefW5OFxxx3lBDWl6xUYNAfDBleko8/GoiYJJurgQ7jbh+kavmhfaY2Rlw9xlj0LYBEULUTXR+Wp1xH1anYPM5Z7cY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778874958; c=relaxed/simple; bh=b1C3ZYMqbMUXuJwfK0nJ46SR12LZcEDfwzg/+eG4Nwc=; h=From:Subject:To:Cc:In-Reply-To:References:Content-Type:Date: Message-Id; b=p7ycnOTKyPo6oa2DJnd1ZMBgR6GhVYz3YbsipWFD71WQlu9vUPVvrbR45ewl3M1OEnMYlLfDs1c6MnsKubu+hm0PlXwRBDxSI56XKkxlueePJsZ6kqxOoUacfXAhjP6QmNGYXuE/JwXEpIxH7V13YOt5lELHrsogEqRmtJSv/Ho= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=j6A9uXWH; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="j6A9uXWH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DEF05C2BCB0; Fri, 15 May 2026 19:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778874958; bh=b1C3ZYMqbMUXuJwfK0nJ46SR12LZcEDfwzg/+eG4Nwc=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date:From; b=j6A9uXWHFoSH8CoR6UGZsG/8Q20tHZ03p1cPZXm7RTDJIctt3G11YvhqkcX0u69Cx BvijPQo8Uj8tziNvnXu1GmW9Egn8tuIrMfYHEGFsWpAZk3cOCvIaRfwTO+pTFxgq5A RtoMQ6Lo1fMxtdRb5aaIGgFI57YcuDqbkPy0w/Xz5JRVkxgSf7EriC8snPpLC+xKyW nKUF+Tpj4kaILH+vQxhUqf9JiQLpd9GRf99b6hsrgz+rg2lbQvIWrSwa+VoOM3JkFI vpGEU7fE/p2GOVR0NELzrl2EOJNN1Dl2PjbaWQoKcAmpj2DLnCk1luhddKmtEpvXw4 bGgNqERD37zOQ== From: sashiko-bot@kernel.org Subject: Re: [PATCH v3 36/41] x86/kvmclock: Get local APIC bus frequency from PV CPUID Timing Info Reply-To: sashiko-reviews@lists.linux.dev To: "Sean Christopherson" Cc: linux-hyperv@vger.kernel.org In-Reply-To: <20260515191942.1892718-37-seanjc@google.com> References: <20260515191942.1892718-37-seanjc@google.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 15 May 2026 19:55:51 +0000 Message-Id: <20260515195557.DEF05C2BCB0@smtp.kernel.org> Precedence: bulk X-Mailing-List: linux-hyperv@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [High] lapic_timer_period is incorrectly assigned the raw APIC frequency = in kHz, which fails to account for the kernel's HZ configuration and breaks= APIC timer calibration for any HZ !=3D 1000. -- commit e5bbef05c7ba30fb00c716accae48693e295289a Author: Sean Christopherson x86/kvmclock: Get local APIC bus frequency from PV CPUID Timing Info This commit reads the local APIC bus frequency from the PV CPUID leaf and uses it to directly set lapic_timer_period, bypassing the standard calibration process. > diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c > --- a/arch/x86/kernel/kvmclock.c > +++ b/arch/x86/kernel/kvmclock.c [ ... ] > @@ -200,10 +200,19 @@ void kvmclock_cpu_action(enum kvm_guest_cpu_action = action) > */ > static unsigned long kvm_get_tsc_khz(void) > { > +#ifdef CONFIG_X86_LOCAL_APIC > + u32 apic_khz =3D kvm_para_apic_bus_khz(); > + > /* > - * If KVM advertises the frequency directly in CPUID, use that > - * instead of reverse-calculating it from the KVM clock data. > + * Use the TSC frequency from KVM's (and other hypervisors') PV CPUID > + * leaf when available, instead of reverse-calculating it from the KVM > + * clock data. As a bonus, the CPUID leaf also includes the local APIC > + * bus/timer frequency. > */ > + if (apic_khz) > + lapic_timer_period =3D apic_khz; Does setting lapic_timer_period directly to apic_khz assume that HZ is always configured to 1000? The lapic_timer_period variable represents the number of APIC timer ticks per jiffy. This is usually calculated as (frequency_in_hz / HZ), which would be (apic_khz * 1000) / HZ. Assigning the value of apic_khz directly means the period is exactly frequency_in_hz / 1000. If the kernel is built with HZ set to 100 or 250, could this result in a timer period that is too small, potentially causing timer interrupts to fire much more frequently than intended? > +#endif > + > return kvm_para_tsc_khz() ? : pvclock_tsc_khz(this_cpu_pvti()); > } --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260515191942.1892= 718-1-seanjc@google.com?part=3D36