Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3563871imm; Wed, 5 Sep 2018 02:10:25 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaKTbQEtwN3zmcqulpEdD8w/ODwMAfRAvTnHCadR4Dg6XUZwTZ1k5H3Tc9/kjZCxUG7ASuc X-Received: by 2002:a17:902:7606:: with SMTP id k6-v6mr35117304pll.300.1536138625869; Wed, 05 Sep 2018 02:10:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536138625; cv=none; d=google.com; s=arc-20160816; b=lX8d2AJcg85R+AnieaNEEVCtLkzUrG/mf8/IFKC5i52ceXNqNkxmszYRzwMjpnIr6v NoWYkKWArmwJUTgKST4Oh40OvntzIDIj/FCtGohlDGYwDP2RfXermGksQn0z8GtBxAW4 lFDJA5akTZ7R8ppIsgMB0Z2YGtjlaZVybc4aGOaOMwTvX42rtH9DnjBgTnFhK9dmSx+W eUTgi/9sViOySLgsX99DbMQCWzbWzyO5yQfmHS2jl0yYYSC+SxCoOujbJd4WEfbBrL7j e8W0TxzCwzKZQ3Dt5MEK8d1PxzjzazCBAjMuLuyn27cbpyk6SQ3ad4s1jrDIZeJNf2OI vWqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:mime-version:user-agent:date:message-id :subject:from:cc:to:in-reply-to; bh=JPyAAnxDOuc+qwH3APsA7qocmHojgMsikr9/PIvdlZU=; b=de1FYe/pESXI9xVyyXSnJaN96j1KKLBeWQ1RX4vjXgzfPvWEGGNHiPDKLTf+kOQcsJ GdirEd3dFspXctHPRwsYsdPs/AY7NatmMblrsACa0c9SXJgwdpDtjZ9/A2bPEVdPtufQ X9htqM1eEDuZ+tKA0hiA2WkYH+Oi8KnccHd3lnoObuyQ6SmM5O/hbRpyYwvk9cCqa5dG gRdRVnx3vRlvj66Z6wJVswlo/wMWYv87S4repQpTLqRGtgp30q0TFpGCKQi9If4PxcmR 0zyQ6WG+rAIpTnRE2aqfGoHydhLyXHzCm3L+UED5e6NEJqzmdJxzaV6J4uLAWl4TyntS dZog== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h9-v6si1450631plk.461.2018.09.05.02.10.09; Wed, 05 Sep 2018 02:10:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728031AbeIENh1 (ORCPT + 99 others); Wed, 5 Sep 2018 09:37:27 -0400 Received: from mga02.intel.com ([134.134.136.20]:13830 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726272AbeIENh1 (ORCPT ); Wed, 5 Sep 2018 09:37:27 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Sep 2018 02:08:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,333,1531810800"; d="scan'208";a="260857404" Received: from leichuan-mobl1.gar.corp.intel.com (HELO [10.226.38.45]) ([10.226.38.45]) by fmsmga006.fm.intel.com with ESMTP; 05 Sep 2018 02:08:11 -0700 In-Reply-To: To: Pavel Tatashin Cc: linux-kernel@vger.kernel.org, x86@kernel.org From: "Chuan Hua, Lei" Subject: Re: [PATCH v15 19/26] x86/tsc: calibrate tsc only once Message-ID: Date: Wed, 5 Sep 2018 17:08:10 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 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 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.