From nobody Sat Jan 11 16:33:18 2025 X-Original-To: dev-commits-src-main@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 4YVkbl4GJZz5kYWG; Sat, 11 Jan 2025 16:33:23 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt1-x835.google.com (mail-qt1-x835.google.com [IPv6:2607:f8b0:4864:20::835]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YVkbl254dz4mvC; Sat, 11 Jan 2025 16:33:23 +0000 (UTC) (envelope-from markjdb@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-qt1-x835.google.com with SMTP id d75a77b69052e-4678cce3d60so28375861cf.2; Sat, 11 Jan 2025 08:33:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736613202; x=1737218002; darn=freebsd.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=mujOKdsJHyDEu1K8cgwqTIlLgSUKXKAjedHLPitMd74=; b=OuBHKrQZiBWxdqZD+4l+vRjzeOqTVvPXAecUSQOHGQgtecoYj3g/YfbLPzMz8kJL0Q mT9l7U4oe5jTtifgr5NAxlHyOZDpx5PHL2sRITapGeejkucVPU8rR/vTxIJgu+p+Ndpo /p4Wns0qzZVqwNaHQNLtY5uye3BJkJGoi4JgZehYhfyBkve5Jkz6QB5/i9uOQ2V0Vr1Q sU6VAtDf4jHpIuYcj0Gv/U8UMmx5cQ4/gt8utZ1Rhj9PzGqs1KHokv51lQg/vBEnR3Wp Pnrusgewo6uJxeRGYAV2e45iRcJOT1yBzYYWRC3hqiM2+pAYO3rEEucV/Y4BM05/l/kf wDnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736613202; x=1737218002; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mujOKdsJHyDEu1K8cgwqTIlLgSUKXKAjedHLPitMd74=; b=efzcyKjyA7Cboo+xy/VXiE6qokYwNNh3KbjrTHR0eCTjKq8pL0w+hIJ1fuJ5A4N80l KdSPxoFlL4t22zzJiv8jvRRJp7xHgEteVLFKzlb2jXd39PCWgFmh39YBq8WYHvlQfYzA y4fvl9Thk42sFL6OYQsVALQ/blT8DsAPNavfQ8KV3cQVlAsCPZijq0cwyKyIyNiuXPM4 R5irKljoUQ3xwQ/AC9fDykdebimR1iSW57rb1d49lRi8m/uL4OiV7ooaDzYreVuzpg0/ v95zkvjnB7nfwuYkp1toAjy7pcIHuLnNXopI1+yh2cEIAhDgqsPeuptN8sVTI6YIK1KQ bOXA== X-Forwarded-Encrypted: i=1; AJvYcCVe7UC9EyB3U63ga18y0BHo4hkKLFtkkEy1cD48P6C56oNHX+9iFYPg9ygorb25wujQtplQtTxXylRgyXnoJ8XQ7bmo@freebsd.org, AJvYcCVxGnadM5W7D4keI3AgvSx3P+MJqYwU8OhW899fF60srQNQd+AbgPAXmOzfsqLtIQG/tU53GqIq6IwMracMY6PygrxkV0M=@freebsd.org X-Gm-Message-State: AOJu0YysqskstKryAFtZAC76y5W0YCatS85HWTt80RQLKBtwJUxb6AIT 1Lr6dqYSdD5RxJEyd9ExZ/ekBDZNd4HCOzzxaVhJvnr43e/EOgU6AhwAPA== X-Gm-Gg: ASbGncvHj1PcfkHPOmDRiDK8PKKAmbSeRfR8MmMmsm+UXwqh7yUFAF79SFY7YL7sHZt oRzBURD8SwUkRF7BaQFpNXSUrWht+dIYiC6gixjhBrTzF9CSxpD+jApYZnH2+t6H1L8kZygKBe4 QS8tSzatBGubYWmknTMUgpHbmu3AVk6iuvbh6eZ3eWw6AJOEBuQFZp4qm+rwmm2ERf+LJ3fPy5E dMEAlroD3z11+DZWakNHClp/bfN75tVNWQzaqtI0cDpKahDTD9ccbhy7y4KeTLs2ZwFTxA= X-Google-Smtp-Source: AGHT+IEv7TNgE//S23YGUpe3MDjjkusyup/LNkYPCKtu/pxILlQvZBvwGg8bNxoHMxduToQ+wYYuTw== X-Received: by 2002:a05:6214:449f:b0:6d8:9677:fbe4 with SMTP id 6a1803df08f44-6df9b1f6f51mr269717116d6.9.1736613201779; Sat, 11 Jan 2025 08:33:21 -0800 (PST) Received: from nuc (192-0-220-237.cpe.teksavvy.com. [192.0.220.237]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6dfade89e0csm21163626d6.104.2025.01.11.08.33.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Jan 2025 08:33:20 -0800 (PST) Date: Sat, 11 Jan 2025 11:33:18 -0500 From: Mark Johnston To: John Baldwin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 6b82130e6c9a - main - clock: Add a long ticks variable, ticksl Message-ID: References: <202501101600.50AG0jk6062308@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4YVkbl254dz4mvC X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] On Sat, Jan 11, 2025 at 10:59:08AM -0500, John Baldwin wrote: > On 1/10/25 11:00, Mark Johnston wrote: > > The branch main has been updated by markj: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=6b82130e6c9add4a8892ca897df5a0ec04663ea2 > > > > commit 6b82130e6c9add4a8892ca897df5a0ec04663ea2 > > Author: Mark Johnston > > AuthorDate: 2025-01-10 15:37:07 +0000 > > Commit: Mark Johnston > > CommitDate: 2025-01-10 15:42:59 +0000 > > > > clock: Add a long ticks variable, ticksl > > For compatibility with Linux, it's useful to have a tick counter of > > width sizeof(long), but our tick counter is an int. Currently the > > linuxkpi tries paper over this difference, but this cannot really be > > done reliably, so it's desirable to have a wider tick counter. This > > change introduces ticksl, keeping the existing ticks variable. > > Follow a suggestion from kib to avoid having to maintain two separate > > counters and to avoid converting existing code to use ticksl: change > > hardclock() to update ticksl instead of ticks, and then use assembler > > directives to make ticks and ticksl overlap such that loading ticks > > gives the bottom 32 bits. This makes it possible to use ticksl in the > > linuxkpi without having to convert any native code, and without making > > hardclock() more complicated or expensive. Then, the linuxkpi can be > > modified to use ticksl instead of ticks. > > Reviewed by: olce, kib, emaste > > MFC after: 1 month > > Differential Revision: https://reviews.freebsd.org/D48383 > > --- > > sys/conf/files | 1 + > > sys/kern/kern_clock.c | 26 ++++++++++++++------------ > > sys/kern/kern_tc.c | 4 ++-- > > sys/kern/subr_param.c | 2 +- > > sys/kern/subr_ticks.s | 44 ++++++++++++++++++++++++++++++++++++++++++++ > > sys/sys/kernel.h | 9 +++++++++ > > sys/sys/timetc.h | 2 +- > > 7 files changed, 72 insertions(+), 16 deletions(-) > > > > diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c > > index 19169ba63061..f4359efec466 100644 > > --- a/sys/kern/subr_param.c > > +++ b/sys/kern/subr_param.c > > @@ -197,7 +197,7 @@ init_param1(void) > > * Arrange for ticks to wrap 10 minutes after boot to help catch > > * sign problems sooner. > > */ > > - ticks = INT_MAX - (hz * 10 * 60); > > + ticksl = INT_MAX - (hz * 10 * 60); > > vn_lock_pair_pause_max = hz / 100; > > if (vn_lock_pair_pause_max == 0) > > Did you consider using LONG_MAX here instead of INT_MAX? That would make > both values roll over 10 minutes after boot so that sign problems can be > tested for both counters. Yes, an earlier revision of the diff did that. I changed it because a 64-bit tick counter won't overflow in a reasonable amount of time, and because we still have to worry about overflow of the 32-bit counter since that's what the kernel still uses everywhere.