From nobody Wed Jan 08 07:58:05 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YSgJg3nW1z5jtbp; Wed, 08 Jan 2025 07:58:11 +0000 (UTC) (envelope-from bz@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YSgJg1pXnz46l1; Wed, 8 Jan 2025 07:58:11 +0000 (UTC) (envelope-from bz@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736323091; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VivsH7xDwoJwveQMRly1xeFYc/9QpDi1za7Fx30NXeg=; b=f+dvBSNxaJ0BUi5Et6jMzZ1Dh9VLoaGiUWIfaGvBUpwHvDPyEpiRgLx0ojOthR2DNC+rAL o1Ev4qTDv1JD7h/E6XfD2pDPaQ1Ic+jJ5t8eJE6eMVN++6xY//H1jG5Xj4nShyNpwHE9jz uUAcRX0p6fLtH2NQKSjTnb+cossf3+XxZbYKkDnEElgf6MLCxk2iiG7hoca63DKiBykfLn cl1ZKvgqEfTo/Q1Sn3Xxj8cOQQZiAgOdPTH2dEkAFvoyUreLR1zCBZoK1hueXnj1TdNipA Pq8iHW7rSjdQOpCpQ+hrYMUckqxOORxewd/Q8Iysp0r+/GyAKDU7mRppBv170g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736323091; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VivsH7xDwoJwveQMRly1xeFYc/9QpDi1za7Fx30NXeg=; b=KuX6XiNn3yIRC87wRkMkM4bBUz0e/PTIXohf/iGIRllznAHBItdqbJ84hDRPq0o7J/Phd+ /Mrh1Yvs+EKqdCsXTtx+aY9adGSK4PCJvCQgzhik0aRTXQB1TYJvoNOYa8iM+Oie1UGBUC KqrK9lvc+giz1HTV3/jFrUraKqmEYL87DwNSNKD2z4PV80jawUg2PUKrOGLHfrny7sSnrZ DSs/q1LloUnHWFMi/ma4j2bui1B2Pa623rsUdXYB+O9Dvsg3VPyJZ7J3TdL6bsHn4oMrAr 2+kkerK8SyARdEuP8fwugGySpVzlQoa4dY0NBym5mL4K33RlHn9QIwEU/Cj2dw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736323091; a=rsa-sha256; cv=none; b=I8nvjtlm4UuM58A1unwazM0ZOu9F2KFrrDP2gH3Fdyxf/jBnKxX5fpCAt3pWVPX3sFUMJs FJcmsrgLa5rB3Ff2muiRQK6zSQrWobgApgiM9mLCuLmWb1S3R1XmEEm3VQwEwVVALwLY8A xfUasNQdk28ozqbHKsA3aOXyXF+GGlsJo5XAKTPIqVC9uA7OlU9EU/oIMkM/siImS68VLX 9A86vzgheVCoglEqPGea4DDNSxQqbK5GeBSPJ9CYnsFieHTApizOpyHTFlAlblh9rBDaI7 rzrI9Yx9xLF4v4gtkmVFrveI+WUMcYZbxYFuJ/2JvnWlUtCMG2XYD+ESqtXHow== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from mx-01.divo.sbone.de (mx-01.divo.sbone.de [IPv6:2003:a:140a:2200:6:594:fffe:19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature ECDSA (prime256v1) client-digest SHA256) (Client CN "mx-01.divo.sbone.de", Issuer "E6" (verified OK)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4YSgJg0HHnzL9Z; Wed, 08 Jan 2025 07:58:11 +0000 (UTC) (envelope-from bz@freebsd.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by mx-01.divo.sbone.de (Postfix) with ESMTPS id 998DFA64805; Wed, 08 Jan 2025 07:58:02 +0000 (UTC) Received: from content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id EFC342D029DD; Wed, 8 Jan 2025 07:58:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) by content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (amavisd-new, port 10024) with ESMTP id rnjTsAIIKWod; Wed, 8 Jan 2025 07:58:08 +0000 (UTC) Received: from strong-aiccu0.sbone.de (strong-aiccu0.sbone.de [IPv6:fde9:577b:c1a9:f491::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 965562D029D8; Wed, 8 Jan 2025 07:58:07 +0000 (UTC) Date: Wed, 8 Jan 2025 07:58:05 +0000 (UTC) From: "Bjoern A. Zeeb" To: Mark Johnston cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: fd27f86dd71b - main - LinuxKPI: switch jiffies and timer->expire to unsigned long In-Reply-To: Message-ID: References: <202501072247.507MlsLu036332@gitrepo.freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed On Tue, 7 Jan 2025, Mark Johnston wrote: > On Tue, Jan 07, 2025 at 10:47:54PM +0000, Bjoern A. Zeeb wrote: >> The branch main has been updated by bz: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=fd27f86dd71b7ff1df6981297095b88d1d29652e >> >> commit fd27f86dd71b7ff1df6981297095b88d1d29652e >> Author: Bjoern A. Zeeb >> AuthorDate: 2024-12-28 09:57:56 +0000 >> Commit: Bjoern A. Zeeb >> CommitDate: 2025-01-07 20:00:20 +0000 >> >> LinuxKPI: switch jiffies and timer->expire to unsigned long >> >> It seems these functions work with unsigned long and not int in Linux. >> Start simply replacing the int where I came across it while debugging >> a wireless driver timer modification. Also sprinkle in some "const". >> >> Sponsored by: The FreeBSD Foundation >> MFC after: 2 weeks >> Reviewed by: emaste >> Differential Revision: https://reviews.freebsd.org/D48318 >> --- >> sys/compat/linuxkpi/common/include/linux/jiffies.h | 28 +++++++++++----------- >> sys/compat/linuxkpi/common/include/linux/timer.h | 4 ++-- >> sys/compat/linuxkpi/common/src/linux_compat.c | 2 +- >> 3 files changed, 17 insertions(+), 17 deletions(-) >> >> diff --git a/sys/compat/linuxkpi/common/include/linux/jiffies.h b/sys/compat/linuxkpi/common/include/linux/jiffies.h >> index bd05a0db0767..8346e74fb830 100644 >> --- a/sys/compat/linuxkpi/common/include/linux/jiffies.h >> +++ b/sys/compat/linuxkpi/common/include/linux/jiffies.h >> @@ -38,7 +38,7 @@ >> >> #define jiffies ticks > > There is a fundamental incompatibility here: jiffies is an unsigned long > but ticks is an int. Historically that was the source of some very > painful-to-find bugs in the IB stack, since the difference mostly arises > when one has to deal with ticks rollover, a rare event. > > It doesn't make a lot of sense to me to partially convert some routines > to using unsigned long if we're not going to do it everywhere, > especially if there isn't a concrete bug being fixed. With this diff, > jiffies is still an int, and various macros like time_after() still cast > their result to a 32-bit value, so at a glance it seems incomplete. I > also suspect that the delta < 1 check in linux_timer_jiffies_until() is > now broken. > > I'd advise against a change like this unless you're very confident in > it: it's easy to introduce rare bugs. If I'll back it out (and deal with the conversion elsewhere as needed) would you write a follow-up comment of your knowledge and add it to jiffies.h so we can avoid this in the future? > The real solution IMO is have a > native 64-bit tick counter that we can use directly in the linuxkpi > layer. -- Bjoern A. Zeeb r15:7