Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp732284ybl; Wed, 4 Dec 2019 09:58:57 -0800 (PST) X-Google-Smtp-Source: APXvYqwhhziGspp+aqvNl0llKlQ3aobS3ro5bD9Bm9jGJUjw7tqJA1bvSvvy2T1uc18IPe7SwutF X-Received: by 2002:a05:6830:1d59:: with SMTP id p25mr3615386oth.308.1575482337854; Wed, 04 Dec 2019 09:58:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575482337; cv=none; d=google.com; s=arc-20160816; b=WHZ7yOdsOZsr6fYTHexLK85Kp+1CoqoNMH1dGoF2kAg42+nRh6WFXdHEdd0fI0KdIS 2eeVmqcJBaxd1p1KnvhCZYgNnJ5JS3GnxVRojq9GKHrZZ/F8hs1LnNIBuTNrncLPv9fR sfCKiuMDMxgfpJ/XvPjUMFvZ/mRZIrE6j73o23Vdv6kEBCeYjcJgJPP+w5E18oEGgeTK 2msmN9flnCi0npL1KdNlSBiapAE1h1YiUF7kTn36BPL+LWwIsMKYv5V7uUFmXVWzHjYU oR2eiq1jqyTmKxZv4dRTQtVDAOqL55cjrPXfNLwcfDy6urPaQd+SI3BdqWeiExnmLjKZ 53dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=eN6hF+/7eyvwxOM8F6dDobUy/J/ABozWPpkMbpi5VRE=; b=AbLKUO0WTdZ3N5ODqZz0HKf0wuKPCGWT9M1wn/qbwHO1fE+Nn2pi+vFaVzS9riA2pL 1pkm08V+XqNcHnOHHoPLAGmyVeV60fNqd/PBA4D9Wm8DVq2LxE+wI+X32fpp2MZ6qLNj TFffPOyNhjbIF/69KUlWXtT4lIdN2NTZOSdmazc8G0EddgJpZjvUAdVwsqRgaWpA/WJI PgbbXHeQIjqb5V9WJCtV36gNHGJkP7rrZx4mtqqimrpel85TdkqnMhBYmVKIEholl7ZC hOBYP6iuh+q0ajiObKV7UDyKTDgHm5ulBrsA+LE+BF4taq2xwfDYTJZHiCGGrNubW5H3 l+ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gYmZOMgh; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j20si3539478otp.147.2019.12.04.09.58.45; Wed, 04 Dec 2019 09:58:57 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=gYmZOMgh; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728487AbfLDR56 (ORCPT + 99 others); Wed, 4 Dec 2019 12:57:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:59506 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728462AbfLDR5z (ORCPT ); Wed, 4 Dec 2019 12:57:55 -0500 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6565820675 for ; Wed, 4 Dec 2019 17:57:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482274; bh=lwTjIpHsoKK4AkJCfv0JG8JTPqDiQmIFGWOvm6Ie5A4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=gYmZOMghZ2/1+Z+h5VzicyK1eoUgr2cM2d8ZCLyRB+HxzgngVCXPd4s3s40CFHHAG lbP1gBy02paOIcR75H/qIr+CLzND8CmmRwNljl1+kVFq4+shM6n56RXnBxl/ytHWfY 9IVTnNwz3KL3puW7fQp8siGNBNJgT0P2N48zKrpQ= Received: by mail-wm1-f43.google.com with SMTP id p17so730707wma.1 for ; Wed, 04 Dec 2019 09:57:54 -0800 (PST) X-Gm-Message-State: APjAAAW7CXc95WaPlIPpcEI/i4Izit7FvvYnUUOHpBFTJQGIx1AqL16c 2Vt1gyEylQuVhlivEoJxmkJPxP8LW7ydYPSLrTQBFg== X-Received: by 2002:a1c:20d6:: with SMTP id g205mr840527wmg.38.1575482272930; Wed, 04 Dec 2019 09:57:52 -0800 (PST) MIME-Version: 1.0 References: <8eeee0695c664305ba6a56bce42a995f@AcuMS.aculab.com> In-Reply-To: <8eeee0695c664305ba6a56bce42a995f@AcuMS.aculab.com> From: Andy Lutomirski Date: Wed, 4 Dec 2019 09:57:41 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Running an Ivy Bridge cpu at fixed frequency To: David Laight Cc: "x86@kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 4, 2019 at 9:01 AM David Laight wrote: > > Is there any way to persuade the intel_pstate driver to make an Ivy bridge (i7-3770) > cpu run at a fixed frequency? > It is really difficult to compare code execution times when the cpu clock speed > keeps changing. > I thought I'd managed by setting the 'scaling_max_freq' to 1.7GHz, but even that > doesn't seem to be working now. > It would also be nice to run a little faster than that - but without it 'randomly' > going to 'turbo' frequencies (which it is doing even after I've set no_turbo to 1). > I don't remember. I'm sure I could figure out what MSR to write, but that's not the answer you're looking for. Someone else will know :) > An alternative would be a variable frequency TSC - might give more consistent values. You can quite easily use perf to count cycles. I never really finished it, but this is a tiny little library that should do exactly what you need. It's a bit messy. https://git.kernel.org/pub/scm/linux/kernel/git/luto/misc-tests.git/tree/tight_loop/perf_self_monitor.c