Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1123275pxk; Fri, 4 Sep 2020 00:45:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycsXmkwD8iSr2BgJnHvQxOGEI1qazOcVjUBm2qshsV+ftzqwLE1CQbjWp0TOOSthx7leTo X-Received: by 2002:a05:6402:1d03:: with SMTP id dg3mr6935229edb.249.1599205514374; Fri, 04 Sep 2020 00:45:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599205514; cv=none; d=google.com; s=arc-20160816; b=gn/boFivGmervQ6UpUOexe0jEziJ33ODyANF7yHic4lYJR8BzPkvs0O9koLx2QJOD0 GhX6io60irXEjEaA6HW9z6rFTapNT9XoyosflcS4QrQQ8JiyntkQpGMZz4cStJxzoRpU 5RDRQPk4IJAegZKjcsNNNPOr3gVmzfgIBFgoa73LavriZisYgHyY1WWZFnXSFK4s2kKT JlDlC9PJl/YS38BxB4OcNE51x0vQr18IqB7O+t6RI7HasvqUJcni2uGX6zcXwk9KHXZs OFIkW15oRRK2MJ9RubPuPxkXn/9CiBGVsYRGNH6oloBxQTEnLXPX0w43W1F8GgCGRnAW iNlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=oAdewkxWA7zZhhRIIu3LLj08dgY5aFFVJNcpz8rgRyo=; b=xkUoLJI40PNosJBGge3fhmd/foqoMh/FZM8XqPLmLzzEm+d3JiqE6aJRiH7KjJKmzR zjiJojiWYabF0ubq1Cw/6LFHRjxjKG1CdNwW9DMGlXQPdSO857LBtoYAY+Rm9XKujgWj Fx7d+xDlMmhibWjyL6J/a13oo7SKCK1ygT1tZBvVSUGySHiK6y3xbhJ9c5ob6/Ri9CYP c5wII4YiU46frV31/j9vEkbXlA1vEXcocVYpT1YO58vSC4t+Is+IT6UimqSIn7S4Ricm YBBb08PCUd1DVRjMOf+VR4n72YgNEe3Z7w2xMOvCjGuTf8gEKyCSvvOp1gCkvHyZGO0A 0naQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=WVqFR3tu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p23si3601273ejw.12.2020.09.04.00.44.51; Fri, 04 Sep 2020 00:45:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=WVqFR3tu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729627AbgIDHlw (ORCPT + 99 others); Fri, 4 Sep 2020 03:41:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726127AbgIDHlv (ORCPT ); Fri, 4 Sep 2020 03:41:51 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29D02C061244 for ; Fri, 4 Sep 2020 00:41:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=oAdewkxWA7zZhhRIIu3LLj08dgY5aFFVJNcpz8rgRyo=; b=WVqFR3tuF4i7vaXkBgcfaXqcWU gZ4IE9vApbk6xQ7Wsd75qIARfk3I+scha0o+rqQePtaLMBMp+RlxuzSLEcTDgvoC2QJlihp9HbdN7 4ja5/amloiItBJ23/iczFStwQlusiL/B5AJUUCoG0H66wI7w3bsBOWY6XUkHMCtpLYT96pxcyZecu nYAjm0Rjt1cI0QMLk/ufQrKLjYVx9daYrfLrjuE1iPGAwNzxPTQ3azjabwrJrOsvxnBksVjC8K+LH KaVGBBnauGhmMiz47Oe3ExAHjwBlSvCDasfQK9CUb6eT1WSbbpVxokf6ppfqRnFPn37qNIzvGXaR4 rbqUWQLg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kE6Lw-0002w3-Ua; Fri, 04 Sep 2020 07:41:45 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id F289A3012DF; Fri, 4 Sep 2020 09:41:42 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id CFA742BE18715; Fri, 4 Sep 2020 09:41:42 +0200 (CEST) Date: Fri, 4 Sep 2020 09:41:42 +0200 From: peterz@infradead.org To: "Ahmed S. Darwish" Cc: Ingo Molnar , Will Deacon , Thomas Gleixner , "Sebastian A. Siewior" , LKML , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" Subject: Re: [PATCH v1 6/8] x86/tsc: Use seqcount_latch_t Message-ID: <20200904074142.GL2674@hirez.programming.kicks-ass.net> References: <20200827114044.11173-1-a.darwish@linutronix.de> <20200827114044.11173-7-a.darwish@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200827114044.11173-7-a.darwish@linutronix.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 27, 2020 at 01:40:42PM +0200, Ahmed S. Darwish wrote: > __always_inline void cyc2ns_read_begin(struct cyc2ns_data *data) > { > + seqcount_latch_t *seqcount; > int seq, idx; > > preempt_disable_notrace(); > > + seqcount = &this_cpu_ptr(&cyc2ns)->seq; > do { > - seq = this_cpu_read(cyc2ns.seq.sequence); > + seq = raw_read_seqcount_latch(seqcount); > idx = seq & 1; > > data->cyc2ns_offset = this_cpu_read(cyc2ns.data[idx].cyc2ns_offset); > data->cyc2ns_mul = this_cpu_read(cyc2ns.data[idx].cyc2ns_mul); > data->cyc2ns_shift = this_cpu_read(cyc2ns.data[idx].cyc2ns_shift); > > - } while (unlikely(seq != this_cpu_read(cyc2ns.seq.sequence))); > + } while (read_seqcount_latch_retry(seqcount, seq)); > } So I worried about this change, it obviously generates worse code. But I was not expecting this: Before: 196: 0000000000000110 189 FUNC GLOBAL DEFAULT 1 native_sched_clock After: 195: 0000000000000110 399 FUNC GLOBAL DEFAULT 1 native_sched_clock That's _210_ bytes extra!! If you look at the disassembly of the thing after it's a complete trainwreck.