From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sender4-pp-o94.zoho.com (sender4-pp-o94.zoho.com [136.143.188.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB5E62236E0 for ; Tue, 24 Mar 2026 00:23:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.94 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774311787; cv=pass; b=m+qSigp84NV4uSeKYwfobSF6XcqSICU1WyZ5bL0IyCciDwnlqcL7LveoyxET4DhNW4YYQ7U2k4ZgbNAlL1mzDSYaOGWd4M1oMBCSU/Fv0vyTGC5WBYGdJ6pheLajC2WE1nBZ88gABBSRDRtsbRgSzZi7i298ZB6ndaZQB6FVwng= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774311787; c=relaxed/simple; bh=TRahzIg6o/k2IgBPnj27NhWwwP/PF0Kp5G7nlIYGXTs=; h=From:To:Cc:References:In-Reply-To:Subject:Date:Message-ID: MIME-Version:Content-Type; b=pzIhmc2gvF4dYl8DD/fhg+hJ8WyU0v0jiHXN+VGLuNreEK549EfE7WxI4xoSNXLfIckuxTI6y766h3iJAU/tVzprJu8+AOTG+h64bhCAcr1nQUqxiK5Pxp8GnbcKqi9vdKfwEosStuinr1KXmkVvORPC5f1wK8PtSID3mT5zt5g= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=zohomail.com; spf=pass smtp.mailfrom=zohomail.com; dkim=pass (1024-bit key) header.d=zohomail.com header.i=mhklkml@zohomail.com header.b=dWKjQVRB; arc=pass smtp.client-ip=136.143.188.94 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=zohomail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zohomail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=zohomail.com header.i=mhklkml@zohomail.com header.b="dWKjQVRB" ARC-Seal: i=1; a=rsa-sha256; t=1774311743; cv=none; d=zohomail.com; s=zohoarc; b=kSlmwJXDe51elFtro7wqAs0/+JAuK+slTBpi+Z9/U4zkl40AliR9B7LUbtz/N/yVaDXJTc5mCgAKQVxzProy86LoivL6pzum+bOTu+4rxBsKwl+tuOTTHIxzjW/zeeEbX5qDjj8/Pk3Ydt0G8QDkpoerdW3FsjvNSwwq6XCGaZ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774311743; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=1Ro5xxO6+EJf3ALlRNtFkj+kQlF0bRqN2q3yFAjCRBY=; b=VTJx9XRvec9BqnMO66ld36Exj3hclFsLfbPaiwvAML4c3rnGi0+9XdVaFW5TL7Z/9YAxk2Zmppj6lhwCQFOMFnPxqblmmNmUfwusTgIyrruBc1OVPSvFuRg3M5MRfi2qKSFN1CFOF2yliMytv1VnKUuVsHUc4Sq/8PJBim/c4hI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=zohomail.com; spf=pass smtp.mailfrom=mhklkml@zohomail.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1774311743; s=zm2022; d=zohomail.com; i=mhklkml@zohomail.com; h=From:From:To:To:Cc:Cc:References:In-Reply-To:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Feedback-ID:Message-Id:Reply-To; bh=1Ro5xxO6+EJf3ALlRNtFkj+kQlF0bRqN2q3yFAjCRBY=; b=dWKjQVRBvcDIfNfuaM/4w5mGmSLoeAdGnN57iE0eTOWh3b/3FuJxO/LZEbwSDO9e HiiGKvsmu8fs5vgns1umkVZPNW8ljYpcSqUcCQjx8G1p33tAY8yPD8d6LdZ/c1c5TIV EXOoVDl1r2VVbGaT3oTx3YjDRPOu+mHUi7qWJxco= Received: by mx.zohomail.com with SMTPS id 1774311741867969.3248683025438; Mon, 23 Mar 2026 17:22:21 -0700 (PDT) From: To: "'Thomas Gleixner'" , "'LKML'" Cc: "'Anna-Maria Behnsen'" , "'John Stultz'" , "'Stephen Boyd'" , "'Daniel Lezcano'" , "'Juri Lelli'" , "'Vincent Guittot'" , "'Dietmar Eggemann'" , "'Steven Rostedt'" , "'Ben Segall'" , "'Mel Gorman'" , "'Valentin Schneider'" , , "'Peter Zijlstra'" , "'Frederic Weisbecker'" , "'Eric Dumazet'" References: <20260224163022.795809588@kernel.org> <20260224163430.010425428@kernel.org> <87v7emgrd5.ffs@tglx> In-Reply-To: <87v7emgrd5.ffs@tglx> Subject: RE: [patch 19/48] clockevents: Provide support for clocksource coupled comparators Date: Mon, 23 Mar 2026 17:22:20 -0700 Message-ID: <002301dcbb24$4825b600$d8712200$@zohomail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 16.0 Content-Language: en-us Thread-Index: AQMY7IEwwssQCjl5gZfQdLvn3cLO7AEq6LYjAZOiAAsCeJ5WpgE8vUuhsxDHu+A= Feedback-ID: rr0801122783b08384560599165c5fecfa0000178f6597b69de80bebfa837cbac67fac4d25f040b8c5cd5d04:zu08011227d37d3f10aff40ea49b9222fb000079f659d5d90f61595dfdf650c570ade5716cb84bf9942df874:rf0801122c481d3bbfc590269820cf3e500000baef5cfd9b9359f0d7610b07875ed48bbeef5f1d66b151ce31d898bdd09e:ZohoMail X-ZohoMailClient: External From: Thomas Gleixner Sent: Monday, March 23, 2026 2:37 PM > > On Mon, Mar 23 2026 at 04:24, Michael Kelley wrote: > >> > +static inline bool clockevent_set_next_coupled(struct clock_event_device *dev, ktime_t expires) > >> > +{ > >> > + u64 cycles; > >> > + > >> > + if (unlikely(!(dev->features & CLOCK_EVT_FEAT_CLOCKSOURCE_COUPLED))) > >> > + return false; > >> > + > >> > + if (unlikely(!ktime_expiry_to_cycles(dev->cs_id, expires, &cycles))) > >> > + return false; > >> > + > >> > + if (IS_ENABLED(CONFIG_GENERIC_CLOCKEVENTS_COUPLED_INLINE)) > >> > >> Since COUPLED_INLINE is always selected for x64, there's no way to add the Hyper-V > >> clockevent that is coupled but not inline. Adding the machinery to allow a second > >> inline clockevent type may not be worth it, but adding a second coupled but not > >> inline clockevent type on x64 should be supported. Thoughts? > >> > >> After fixing the u64 typo, and temporarily not always selecting COUPLED_INLINE in > >> arch/x86/Kconfig, the coupled Hyper-V TSC page clocksource and timer seem to work > >> correctly, though I'm still doing some testing. I'm also working on counting the number > >> of time reads to confirm the expected benefit. > > > > Gentle ping. Any thoughts on this? (And on Peter Zijlstra's "deliciously insane" > > follow-up?) > > Sure, we should be able to support that and I think Peter's suggestion > is pretty clever. Did you get it working? > I got the coupling working with the Hyper-V clocksource and timer in non-inlined form, and observed the expected reduction in time reads. That was straightforward. But I did not try Peter's suggestion, just to keep things simple. The Hyper-V timer can be loaded with a single wrmsrq just like the TSC deadline timer, but it's a different MSR that's synthetic and always traps to the hypervisor. Given the unavoidable overhead of trapping to the hypervisor, the relative gain of inlining would be small. Michael