From owner-svn-src-stable@freebsd.org Mon Jun 25 09:19:51 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8639F1002F85; Mon, 25 Jun 2018 09:19:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3864E73BBB; Mon, 25 Jun 2018 09:19:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 15A662B360; Mon, 25 Jun 2018 09:19:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5P9Jo4F057028; Mon, 25 Jun 2018 09:19:50 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5P9JoTM057027; Mon, 25 Jun 2018 09:19:50 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201806250919.w5P9JoTM057027@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 25 Jun 2018 09:19:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r335628 - stable/11/sys/x86/x86 X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/x86/x86 X-SVN-Commit-Revision: 335628 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2018 09:19:51 -0000 Author: avg Date: Mon Jun 25 09:19:50 2018 New Revision: 335628 URL: https://svnweb.freebsd.org/changeset/base/335628 Log: MFC r333638: calibrate lapic timer in native_lapic_setup Modified: stable/11/sys/x86/x86/local_apic.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/x86/local_apic.c ============================================================================== --- stable/11/sys/x86/x86/local_apic.c Mon Jun 25 08:57:03 2018 (r335627) +++ stable/11/sys/x86/x86/local_apic.c Mon Jun 25 09:19:50 2018 (r335628) @@ -202,6 +202,9 @@ SYSCTL_INT(_hw_apic, OID_AUTO, eoi_suppression, CTLFLA SYSCTL_INT(_hw_apic, OID_AUTO, timer_tsc_deadline, CTLFLAG_RD, &lapic_timer_tsc_deadline, 0, ""); +static void lapic_calibrate_initcount(struct lapic *la); +static void lapic_calibrate_deadline(struct lapic *la); + static uint32_t lapic_read32(enum LAPIC_REGISTERS reg) { @@ -783,6 +786,13 @@ native_lapic_setup(int boot) intrcnt_add(buf, &la->la_timer_count); } + /* Calibrate the timer parameters using BSP. */ + if (boot && IS_BSP()) { + lapic_calibrate_initcount(la); + if (lapic_timer_tsc_deadline) + lapic_calibrate_deadline(la); + } + /* Setup the timer if configured. */ if (la->la_timer_mode != LAT_MODE_UNDEF) { KASSERT(la->la_timer_period != 0, ("lapic%u: zero divisor", @@ -917,7 +927,7 @@ native_lapic_disable_pmc(void) } static void -lapic_calibrate_initcount(struct eventtimer *et, struct lapic *la) +lapic_calibrate_initcount(struct lapic *la) { u_long value; @@ -943,7 +953,7 @@ lapic_calibrate_initcount(struct eventtimer *et, struc } static void -lapic_calibrate_deadline(struct eventtimer *et, struct lapic *la __unused) +lapic_calibrate_deadline(struct lapic *la __unused) { if (bootverbose) { @@ -985,11 +995,6 @@ lapic_et_start(struct eventtimer *et, sbintime_t first struct lapic *la; la = &lapics[PCPU_GET(apic_id)]; - if (et->et_frequency == 0) { - lapic_calibrate_initcount(et, la); - if (lapic_timer_tsc_deadline) - lapic_calibrate_deadline(et, la); - } if (period != 0) { lapic_change_mode(et, la, LAT_MODE_PERIODIC); la->la_timer_period = ((uint32_t)et->et_frequency * period) >>