From patchwork Mon Mar 6 09:20:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li,Rongqing" X-Patchwork-Id: 64531 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1742959wrd; Mon, 6 Mar 2023 01:31:27 -0800 (PST) X-Google-Smtp-Source: AK7set9kDM38++pzTigA/AAm8fqIxhhJ7tbDMqHWMwpPN6gs7giqLHB0+FYPVIcCCFA5k1cMyKCu X-Received: by 2002:a05:6402:1512:b0:4c2:6b68:c126 with SMTP id f18-20020a056402151200b004c26b68c126mr8870228edw.8.1678095087527; Mon, 06 Mar 2023 01:31:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678095087; cv=none; d=google.com; s=arc-20160816; b=RYFCfhmV5QQmsvqzEWZwQufXefdetJRx55mcUvIsV1E/jmymE9XcRxFiJzeJ+p4IyX Q9ypp/r+MTPR25xn1b+Ev9Ua3Qek20TKTU/XWMphDr3qYtNjBRC8oGuBLDkFR1gHZGvl ReO++P5yATBAnMCPdhyOS1E7fVE9XV4N5sIdF2E1AMMIUU9tKvbstXAjNuf/lS0vO+ef N25pctGSFeX/pLXHn3/qMyztN6XBs9dXumch+NuO5ruBVaIHrTnl+h3+ZUkCJbHqljlP 39cRuQvh1tYtpUvYm+23Qhj9ZBBKF03NpMkwlELJpihdren2MtfauAO9Qd2aXARAfVfM ujBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:to:from; bh=R/KAnpl5rowxxzP3mpu+Ce3LujokriK6nPrqowE5ipY=; b=Gi6Z3+UZ5MxBs/8yocg3ZRZe+CsC3mMa11NFudbDpijQGst/nr+5FZaIWPxGFO15f0 hWvGK63c2boJd/Mv7sk74wY4HcSzH6fIu52Vgb1/WY8K8v4T01CHBSqoUybabjkE1w/V GIkcib1Qk25atHaatlubbISkpkeCB2a5wdV0row1xEFjI0Utc4zrFxcwfhaKnoCxhVKl +0zoODjiXobatMVAOHmxmCaDezykP2TLwgJFFGcCWLC4EDrEEoyYftDAfbxo4lm1v2JO WUbTzyNqL0ed9L6UzE7sVwfjb4MhpHknxuD1mzwVcq6knX1yCDEoqlhzhXKXyOlN9lr2 XhIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f10-20020a056402160a00b004aaa653a74asi8330885edv.596.2023.03.06.01.31.03; Mon, 06 Mar 2023 01:31:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229651AbjCFJUX (ORCPT + 99 others); Mon, 6 Mar 2023 04:20:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229568AbjCFJUU (ORCPT ); Mon, 6 Mar 2023 04:20:20 -0500 Received: from njjs-sys-mailin01.njjs.baidu.com (mx315.baidu.com [180.101.52.204]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A7BC7D507 for ; Mon, 6 Mar 2023 01:20:18 -0800 (PST) Received: from localhost (bjhw-sys-rpm015653cc5.bjhw.baidu.com [10.227.53.39]) by njjs-sys-mailin01.njjs.baidu.com (Postfix) with ESMTP id E52F07F0005C; Mon, 6 Mar 2023 17:20:16 +0800 (CST) From: lirongqing@baidu.com To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] x86/apic: fix a printk precision vs width issue Date: Mon, 6 Mar 2023 17:20:16 +0800 Message-Id: <1678094416-28615-1-git-send-email-lirongqing@baidu.com> X-Mailer: git-send-email 1.7.1 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759610234268631577?= X-GMAIL-MSGID: =?utf-8?q?1759610234268631577?= From: Li RongQing Before this patch when HZ is 1000, the host bus clock speed is 99812KHz, but shows 99.0812 MHz [ 0.136739] ..... calibration result: 99812 [ 0.136930] ..... host bus clock speed is 99.0812 MHz. it should be: [ 0.136930] ..... host bus clock speed is 99.812 MHz. Signed-off-by: Li RongQing --- arch/x86/kernel/apic/apic.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 20d9a60..7e3b1bf 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -948,15 +948,15 @@ static int __init calibrate_APIC_clock(void) if (boot_cpu_has(X86_FEATURE_TSC)) { apic_printk(APIC_VERBOSE, "..... CPU clock speed is " - "%ld.%04ld MHz.\n", - (deltatsc / LAPIC_CAL_LOOPS) / (1000000 / HZ), - (deltatsc / LAPIC_CAL_LOOPS) % (1000000 / HZ)); + "%ld.%03ld MHz.\n", + ((deltatsc) / LAPIC_CAL_LOOPS) * HZ / 1000 / 1000, + ((deltatsc) / LAPIC_CAL_LOOPS) * HZ / 1000 % 1000); } apic_printk(APIC_VERBOSE, "..... host bus clock speed is " - "%u.%04u MHz.\n", - lapic_timer_period / (1000000 / HZ), - lapic_timer_period % (1000000 / HZ)); + "%u.%03u MHz.\n", + (lapic_timer_period * HZ / 1000) / 1000, + (lapic_timer_period * HZ / 1000) % 1000); /* * Do a sanity check on the APIC calibration result