Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp778614imm; Wed, 20 Jun 2018 06:31:30 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKYqWpZXCLm52JDAoWOLrKuSAKv+hDYlvmTZX4CQ9IVnn5uYB/YGRmQ/WcvukF93t5a/0ha X-Received: by 2002:a62:930c:: with SMTP id b12-v6mr3424119pfe.193.1529501490505; Wed, 20 Jun 2018 06:31:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529501490; cv=none; d=google.com; s=arc-20160816; b=k2f/7ToAciGxCLGSYVXH67y9B8GteFW2dIQdbbvk+CidqZ2+UBeiAmefUyc8TFAcBe Obmiom2/13sWK6YonKDV6s9uqz2SXNA7m6rIM6Iso5B/31TK/JUFhHWuVDm2BmTOLGj8 OZtxL2/bEOmiW2xMujLh/O0ok2/9p0Egpqkb0KXV5opFf08+bgiTpAHRzLqFL+WAydU4 srruzltaZzqwAVuTF1eD8lr6zFMu2WoeorNF+15wlRPIRVTWiNe16KeX0gcF6unX4zTR JfpwAQffv0KTauobIV4lzVafPjvc3ar934DjQ6H293P7u6aqrCSRT8azJ/5AE3MAuFtr FC4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=fGO1JuxZeNNHwIusdFHgHbjc+dt/Z/H1dbbZHj8BGA0=; b=bnOP/VLBuiR/QDsHDx6SeGsLbUjTFj2dirAiCmo/iN4ODfX6y0gZMzEYne9HB2BFfZ wPnlRy12yNbFR69TCzSYBvvxkS7a6aWNFKsUIHEbvNhSn114X4uosoTvH8TCQexXeo3u F3M6YCNvODfbvf27Xg73LdJ9Ic7agPP0mTkppCFTmdBoxCT9qiSc45HeYSl1g1yfme8D +do9brKZqSXhvvPdaayJSi3R7OY8s7YeIyTjq+e6k5GPobahk6FkOuyufjnYaSrtpphH Dr+nCBo3JTYRIGpbVlCuljrD8nBQmEiXvsMP5I++5HvuknUb1e3Fah+mv7jimV6N8srm yrwg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v24-v6si2413907plo.159.2018.06.20.06.31.16; Wed, 20 Jun 2018 06:31:30 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754552AbeFTNaI (ORCPT + 99 others); Wed, 20 Jun 2018 09:30:08 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:60341 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754318AbeFTNaF (ORCPT ); Wed, 20 Jun 2018 09:30:05 -0400 Received: from hsi-kbw-5-158-153-52.hsi19.kabel-badenwuerttemberg.de ([5.158.153.52] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fVdB5-0005t9-Lj; Wed, 20 Jun 2018 15:29:39 +0200 Date: Wed, 20 Jun 2018 15:29:36 +0200 (CEST) From: Thomas Gleixner To: Peter Zijlstra cc: Pavel Tatashin , steven.sistare@oracle.com, daniel.m.jordan@oracle.com, linux@armlinux.org.uk, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, john.stultz@linaro.org, sboyd@codeaurora.org, x86@kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com, hpa@zytor.com, douly.fnst@cn.fujitsu.com, prarit@redhat.com, feng.tang@intel.com, pmladek@suse.com, gnomes@lxorguk.ukuu.org.uk Subject: Re: [PATCH v10 7/7] x86/tsc: use tsc early In-Reply-To: <20180620123208.GN2476@hirez.programming.kicks-ass.net> Message-ID: References: <20180615174204.30581-1-pasha.tatashin@oracle.com> <20180615174204.30581-8-pasha.tatashin@oracle.com> <20180620091532.GK2476@hirez.programming.kicks-ass.net> <20180620123208.GN2476@hirez.programming.kicks-ass.net> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 20 Jun 2018, Peter Zijlstra wrote: > On Wed, Jun 20, 2018 at 12:42:40PM +0200, Thomas Gleixner wrote: > > On Wed, 20 Jun 2018, Peter Zijlstra wrote: > > > > I'm still puzzled by the entire need for tsc_early_enabled and all that. > > > Esp. since both branches do the exact same thing: > > > > > > return cycles_2_ns(rdtsc()); > > > > Right. But up to the point where the real sched_clock initialization can be > > done and the static keys can be flipped, there must be a way to > > conditinally use TSC depending on availablility and early initialization. > > Ah, so we want to flip keys early, can be done, see below. > > > You might argue, that we shouldn't care becasue the jiffies case is just > > the worst case fallback anyway. I wouldn't even disagree as those old > > machines which have TSC varying with the CPU frequency really should not > > matter anymore. Pavel might disagree of course. > > You forgot (rightfully) that we even use TSC on those !constant > machines, we adjust the cycles_2_ns thing from the cpufreq notifiers. > > The only case we should _ever_ use that jiffies callback is when TSC > really isn't there. Basically, if we kill notsc, we could make > native_sched_clock() := cycles_2_ns(rdtsc()) (for CONFIG_X86_TSC), the > end. > > No static keys, nothing. So much for the theory. There are CPUs out there where you can't figure out the TSC frequency which in turn needs to discard TSC as well. Yes, it's all utter crap.... > That said; flipping static keys early isn't hard. We should call > jump_label_init() early, because we want the entries sorted and the > key->entries link set. It will also replace the GENERIC_NOP5_ATOMIC > thing, which means we need to also do arch_init_ideal_nop() early, but > since that is pure CPUID based that should be doable. Yes, that should work and then we'd just have a single static key. Thanks, tglx