Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5733720rdb; Wed, 13 Dec 2023 19:05:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IGN779YlvIKoX2JMp0yFd38SaXUjUuCkb/r5R89e0WHvUEd6bgOYbq+zMjlxfail6/98Ob5 X-Received: by 2002:a05:6a00:1388:b0:6ce:fa73:a046 with SMTP id t8-20020a056a00138800b006cefa73a046mr10288202pfg.50.1702523152373; Wed, 13 Dec 2023 19:05:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702523152; cv=none; d=google.com; s=arc-20160816; b=PaTfBrH4xR4wDk3Nfl0Pxv73SAzdRmuHo6KAElqyFmHJrVqDFOQ7cfFYnKOyl6+LNj jk4hJa5bI5pro+WIwPYFvCgTtY067iRS/UmvgwG5j8SFDWIrAGALI/8cSogpZtXoZsew hziXX3QbmVvv+tCxu0ClZb1Z8vYqzFydNUrfETWtsUEn8gG1YiD2zE4jMZ3IrFR7RKMZ Fa0wlayS7LFrMI1jBrhliUjNSWbEEhCjCP7h8XxlF19PJw6sS367o3uihG+pV0EpDca7 kFp+curiAnKnHPJGzP5DKY6iLztcNS4evVRULDIkxfjAkGed593UeQVcxjNhBJ+yOk80 x7yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=/fqykIJsu3Xlc2O2iUQrKK7nkryRUae+aXEVKhcnKMw=; fh=ApSZSMqk2cOXZBaXQhOniVNa7xwAQ0YLx1sKJGpf0is=; b=zwjESvoegJ4TnoPDUvmg+zWGQAKyz5yaHaD5OFHCR1t8nVQ7cR38dqPr5THYzpCS7s /D8/S8UnF7bdKxieUXbjVB4ehKKpoblFI2CYBOm1RHO3HOlM5aajNYumfhmfHrED9ABx QorwwdRqbtKRZ1RC8+hXxYqw0xcQBpi5mBqd1wKqqiWx596yDv1gME87yqJx5+nP7uVg lpn/6DyQQjpYrscb7/GuCb7ucmFg53FNV8LghsGHs7/cHRZ2NYo2Y9EKklKrc2296aiz 0fr94WSrpYzcKwfWAUPAOG4bR2xaXkBGWoFUDSGCRfW853vtGRfO5WwU3S/Q0xYg4JVi WhTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=oUm9ZVrJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id o13-20020a65614d000000b005c65ac797acsi10494561pgv.360.2023.12.13.19.05.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 19:05:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=oUm9ZVrJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id C65A48030E65; Wed, 13 Dec 2023 19:05:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229739AbjLNDFb (ORCPT + 99 others); Wed, 13 Dec 2023 22:05:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234298AbjLNDF3 (ORCPT ); Wed, 13 Dec 2023 22:05:29 -0500 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2909109; Wed, 13 Dec 2023 19:05:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1702523131; bh=LrxU6sQ+dsyjQREDT4BqariJas1wB0ELeUtGmLjt5hk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=oUm9ZVrJjcgL8ANF1i/wuYUqFY9lGp0W9fEF+9BL7i68tUgB4WB35mDspLiNR77ze 0sSzjP1Off+usSCenz/w3y9zm6QPrwJFWseeHFDRTmTp1TizwYU1fuRe5iKdksR0g/ exuSnIzu9cp9Ehjoq2gKuAMCVP7ko/4xjB7l42sz3VvUE/l/WOhlfVDKVmhZNOREJ7 QNe2U8Df5bwkxoEHVVAdqy2tARarPCr68bq1gaMute0JzlzDy/GoCu5sN0KJA1QTrw lbKxMFN/HSqor5XL14SexTrP7RdasHf9Y/flN4sbR8crJAgWtJLcfwlTksMj+fNErl mqLbcxwwJDKiw== Received: from [IPV6:2606:6d00:100:4000:cacb:9855:de1f:ded2] (unknown [IPv6:2606:6d00:100:4000:cacb:9855:de1f:ded2]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4SrHKR27VRzGcN; Wed, 13 Dec 2023 22:05:31 -0500 (EST) Message-ID: Date: Wed, 13 Dec 2023 22:05:29 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] ring-buffer: Remove 32bit timestamp logic Content-Language: en-US To: Steven Rostedt , LKML , Linux Trace Kernel Cc: Masami Hiramatsu , Mark Rutland References: <20231213211126.24f8c1dd@gandalf.local.home> From: Mathieu Desnoyers In-Reply-To: <20231213211126.24f8c1dd@gandalf.local.home> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 13 Dec 2023 19:05:49 -0800 (PST) On 2023-12-13 21:11, Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > Each event has a 27 bit timestamp delta that is used to hold the delta > from the last event. If the time between events is greater than 2^27, then > a timestamp is added that holds a 59 bit absolute timestamp. > > Until a389d86f7fd09 ("ring-buffer: Have nested events still record running > time stamp"), if an interrupt interrupted an event in progress, all the > events delta would be zero to not deal with the races that need to be > handled. The commit a389d86f7fd09 changed that to handle the races giving > all events, even those that preempt other events, still have an accurate > timestamp. > > To handle those races requires performing 64-bit cmpxchg on the > timestamps. But doing 64-bit cmpxchg on 32-bit architectures is considered > very slow. To try to deal with this the timestamp logic was broken into > two and then three 32-bit cmpxchgs, with the thought that two (or three) > 32-bit cmpxchgs are still faster than a single 64-bit cmpxchg on 32-bit > architectures. > > Part of the problem with this is that I didn't have any 32-bit > architectures to test on. After hitting several subtle bugs in this code, > an effort was made to try and see if three 32-bit cmpxchgs are indeed > faster than a single 64-bit. After a few people brushed off the dust of > their old 32-bit machines, tests were done, and even though 32-bit cmpxchg > was faster than a single 64-bit, it was in the order of 50% at best, not > 300%. I literally had to dust off my old Eee PC for this :) > > This means that this complex code is not only complex but also not even > faster than just using 64-bit cmpxchg. > > Nuke it! > Acked-by: Mathieu Desnoyers > @@ -3720,6 +3517,7 @@ rb_reserve_next_event(struct trace_buffer *buffer, > struct rb_event_info info; > int nr_loops = 0; > int add_ts_default; > + static int once; (as you spotted, should be removed) Thanks, Mathieu > > /* ring buffer does cmpxchg, make sure it is safe in NMI context */ > if (!IS_ENABLED(CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG) && -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com