From owner-svn-src-all@freebsd.org Tue Mar 29 08:45:16 2016 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 D5680AE16F6; Tue, 29 Mar 2016 08:45:16 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 51D97174C; Tue, 29 Mar 2016 08:45:16 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u2T8j7Vo087921 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 29 Mar 2016 11:45:07 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u2T8j7Vo087921 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u2T8j7gH087919; Tue, 29 Mar 2016 11:45:07 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 29 Mar 2016 11:45:06 +0300 From: Konstantin Belousov To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, "'rstone@freebsd.org'" Subject: Re: svn commit: r297039 - head/sys/x86/x86 Message-ID: <20160329084506.GM1741@kib.kiev.ua> References: <201603181948.u2IJmndg063765@repo.freebsd.org> <2922763.uITxoCVqGR@ralph.baldwin.cx> <20160324090917.GC1741@kib.kiev.ua> <2869679.kmLIC3GSQk@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2869679.kmLIC3GSQk@ralph.baldwin.cx> User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 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: Tue, 29 Mar 2016 08:45:16 -0000 On Mon, Mar 28, 2016 at 11:55:18AM -0700, John Baldwin wrote: > I think this is more to allow you to keep the TSCs in sync across cores > more sanely by being able to adjust TSC_ADJ instead of trying to time > a write to the TSC to apply an offset (which is racy). If it was targeted > at SMM, it wouldn't be exposed to the host OS. I think Intel understands > at this point that OS's want a synchronized TSC on bare metal for "cheap" > timekeeping (at this point the TSC is more about that then about counting > CPU "instructions"). There is RDTSCP instruction and IA32_TSC_AUX MSR, which provides atomic fetch of the per-cpu TSC offset and provides automatic serialization. Its use would avoid the need of LFENCE accompaining RDTSC, as it is done now. Hm, yes, IA32_TSC_ADJUST MSR is documented in latest SDM. > > I think your patch later in the thread looks fine. Thanks, committed as r297374. > > Most of the worry about older hardware with variable TSC's later in the > thread is becoming less and less relevant. Intel hasn't shipped a CPU with > a variable TSC in close to a decade now? Core2 were initially released in 2006, and latest models in mobile segment launched in the late 2009. Core2 has invariant TSC, but it stops in C3, which makes either TSC or C3 unusable (at least simultaneously). > > Bruce's points about the hardcoded timeouts for things like mutxes are well > founded. I'm not sure about how best to fix those however. I think we could use similar calibration with fake single-atomic loop. It would give us 2x-5x times error at runtime, but again it does not matter.