From owner-svn-src-all@freebsd.org Fri Feb 24 16:11:57 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87166CEBEC6; Fri, 24 Feb 2017 16:11:57 +0000 (UTC) (envelope-from kib@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 mx1.freebsd.org (Postfix) with ESMTPS id 46CE8BE1; Fri, 24 Feb 2017 16:11:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1OGBujS036461; Fri, 24 Feb 2017 16:11:56 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1OGBu3B036457; Fri, 24 Feb 2017 16:11:56 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201702241611.v1OGBu3B036457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 24 Feb 2017 16:11:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r314211 - in head/sys: dev/acpica kern sys x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Feb 2017 16:11:57 -0000 Author: kib Date: Fri Feb 24 16:11:55 2017 New Revision: 314211 URL: https://svnweb.freebsd.org/changeset/base/314211 Log: Remove cpu_deepest_sleep variable. On Core2 and older Intel CPUs, where TSC stops in C2, system does not allow C2 entrance if timecounter hardware is TSC. This is done by tc_windup() which tests for TC_FLAGS_C2STOP flag of the new timecounter and increases cpu_disable_c2_sleep if flag is set. Right now init_TSC_tc() only sets the flag if cpu_deepest_sleep >= 2, but TSC is initialized too early for this variable to be set by acpi_cpu.c. There is no reason to require that ACPI reported C2 and deeper states to set TC_FLAGS_C2STOP, so remove cpu_deepest_sleep test from init_TSC_tc() condition. And since this is the only use of the variable, remove it at all. Reported and submitted by: Jia-Shiun Li Suggested by: jhb MFC after: 2 weeks Modified: head/sys/dev/acpica/acpi_cpu.c head/sys/kern/kern_clocksource.c head/sys/sys/systm.h head/sys/x86/x86/tsc.c Modified: head/sys/dev/acpica/acpi_cpu.c ============================================================================== --- head/sys/dev/acpica/acpi_cpu.c Fri Feb 24 16:02:01 2017 (r314210) +++ head/sys/dev/acpica/acpi_cpu.c Fri Feb 24 16:11:55 2017 (r314211) @@ -703,7 +703,6 @@ acpi_cpu_generic_cx_probe(struct acpi_cp sc->cpu_non_c2 = sc->cpu_cx_count; sc->cpu_non_c3 = sc->cpu_cx_count; sc->cpu_cx_count++; - cpu_deepest_sleep = 1; /* * The spec says P_BLK must be 6 bytes long. However, some systems @@ -729,7 +728,6 @@ acpi_cpu_generic_cx_probe(struct acpi_cp cx_ptr++; sc->cpu_non_c3 = sc->cpu_cx_count; sc->cpu_cx_count++; - cpu_deepest_sleep = 2; } } if (sc->cpu_p_blk_len < 6) @@ -746,7 +744,6 @@ acpi_cpu_generic_cx_probe(struct acpi_cp cx_ptr->trans_lat = AcpiGbl_FADT.C3Latency; cx_ptr++; sc->cpu_cx_count++; - cpu_deepest_sleep = 3; } } } @@ -831,7 +828,6 @@ acpi_cpu_cx_cst(struct acpi_cpu_softc *s cx_ptr->type = ACPI_STATE_C0; cx_ptr++; sc->cpu_cx_count++; - cpu_deepest_sleep = 1; /* Set up all valid states. */ for (i = 0; i < count; i++) { @@ -884,8 +880,6 @@ acpi_cpu_cx_cst(struct acpi_cpu_softc *s continue; case ACPI_STATE_C2: sc->cpu_non_c3 = sc->cpu_cx_count; - if (cpu_deepest_sleep < 2) - cpu_deepest_sleep = 2; break; case ACPI_STATE_C3: default: @@ -894,8 +888,7 @@ acpi_cpu_cx_cst(struct acpi_cpu_softc *s "acpi_cpu%d: C3[%d] not available.\n", device_get_unit(sc->cpu_dev), i)); continue; - } else - cpu_deepest_sleep = 3; + } break; } Modified: head/sys/kern/kern_clocksource.c ============================================================================== --- head/sys/kern/kern_clocksource.c Fri Feb 24 16:02:01 2017 (r314210) +++ head/sys/kern/kern_clocksource.c Fri Feb 24 16:11:55 2017 (r314211) @@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$"); #include #include -int cpu_deepest_sleep = 0; /* Deepest Cx state available. */ int cpu_disable_c2_sleep = 0; /* Timer dies in C2. */ int cpu_disable_c3_sleep = 0; /* Timer dies in C3. */ Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Fri Feb 24 16:02:01 2017 (r314210) +++ head/sys/sys/systm.h Fri Feb 24 16:11:55 2017 (r314211) @@ -321,7 +321,6 @@ sbintime_t cpu_idleclock(void); void cpu_activeclock(void); void cpu_new_callout(int cpu, sbintime_t bt, sbintime_t bt_opt); void cpu_et_frequency(struct eventtimer *et, uint64_t newfreq); -extern int cpu_deepest_sleep; extern int cpu_disable_c2_sleep; extern int cpu_disable_c3_sleep; Modified: head/sys/x86/x86/tsc.c ============================================================================== --- head/sys/x86/x86/tsc.c Fri Feb 24 16:02:01 2017 (r314210) +++ head/sys/x86/x86/tsc.c Fri Feb 24 16:11:55 2017 (r314211) @@ -542,7 +542,7 @@ init_TSC_tc(void) * result incorrect runtimes for kernel idle threads (but not * for any non-idle threads). */ - if (cpu_deepest_sleep >= 2 && cpu_vendor_id == CPU_VENDOR_INTEL && + if (cpu_vendor_id == CPU_VENDOR_INTEL && (amd_pminfo & AMDPM_TSC_INVARIANT) == 0) { tsc_timecounter.tc_flags |= TC_FLAGS_C2STOP; if (bootverbose)