From: "Chuan Hua, Lei" <chuanhua.lei@linux.intel.com>
To: Pavel Tatashin <pasha.tatashin@oracle.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org
Subject: Re: [PATCH v15 19/26] x86/tsc: calibrate tsc only once
Date: Wed, 5 Sep 2018 17:08:10 +0800 [thread overview]
Message-ID: <b4f947f1-72e3-8dc1-7e9b-591d92306e55@linux.intel.com> (raw)
In-Reply-To:
> static unsigned long __init get_loops_per_jiffy(void)
> {
> unsigned long lpj = tsc_khz * KHZ;
>
> do_div(lpj, HZ);
> return lpj;
> }
Just tried this with 4.19-rc2 on x86(32bit). lpj return as zero which is not expected
After disassembling the code,
0xc1239a9e <+199>: imul $0x3e8,0xc12296e4,%edx
0xc1239aa8 <+209>: xor %ecx,%ecx
0xc1239aaa <+211>: test %edx,%edx
0xc1239aac <+213>: mov %eax,%ebx
0xc1239aae <+215>: je 0xc1239abd <tsc_init+230>
0xc1239ab0 <+217>: mov $0x64,%ecx
0xc1239ab5 <+222>: mov %edx,%eax
0xc1239ab7 <+224>: xor %edx,%edx
0xc1239ab9 <+226>: div %ecx
0xc1239abb <+228>: mov %eax,%ecx
0xc1239abd <+230>: mov %ebx,%eax
0xc1239abf <+232>: mov $0x64,%ebx
0xc1239ac4 <+237>: div %ebx
0xc1239ac6 <+239>: mov %ecx,%edx
imul will load the result into %edx, %edx supposed to be high 32 bit which is not zero,
It should be zero in this case. both lpj and tsc_khz should be u64 to work properly.
next reply other threads:[~2018-09-05 9:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-05 9:08 Chuan Hua, Lei [this message]
2018-09-05 10:42 ` Thomas Gleixner
-- strict thread matches above, loose matches on Subject: below --
2018-07-19 20:55 [PATCH v15 00/26] Early boot time stamps Pavel Tatashin
2018-07-19 20:55 ` [PATCH v15 19/26] x86/tsc: calibrate tsc only once Pavel Tatashin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b4f947f1-72e3-8dc1-7e9b-591d92306e55@linux.intel.com \
--to=chuanhua.lei@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pasha.tatashin@oracle.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®