From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753297AbdKWS7w (ORCPT ); Thu, 23 Nov 2017 13:59:52 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:44690 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753195AbdKWS7v (ORCPT ); Thu, 23 Nov 2017 13:59:51 -0500 Date: Thu, 23 Nov 2017 19:59:40 +0100 (CET) From: Thomas Gleixner To: Sagar Arun Kamble cc: John Stultz , Stephen Boyd , Chris Wilson , linux-kernel@vger.kernel.org Subject: Re: Creating cyclecounter and lock member in timecounter structure [ Was Re: [RFC 1/4] drm/i915/perf: Add support to correlate GPU timestamp with system time] In-Reply-To: Message-ID: References: <1510748034-14034-1-git-send-email-sagar.a.kamble@intel.com> <1510748034-14034-2-git-send-email-sagar.a.kamble@intel.com> <151074872901.26264.3145709294590477412@mail.alporthouse.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 23 Nov 2017, Sagar Arun Kamble wrote: > We needed inputs on possible optimization that can be done to > timecounter/cyclecounter structures/usage. > This mail is in response to review of patch > https://patchwork.freedesktop.org/patch/188448/. > > As Chris's observation below, about dozen of timecounter users in the kernel > have below structures > defined individually: > > spinlock_t lock; > struct cyclecounter cc; > struct timecounter tc; > > Can we move lock and cc to tc? That way it will be convenient. > Also it will allow unifying the locking/overflow watchdog handling across all > drivers. Looks like none of the timecounter usage sites has a real need to separate timecounter and cyclecounter. The lock is a different question. The locking of the various drivers differs and I have no idea how you want to handle that. Just sticking the lock into the datastructure and then not making use of it in the timercounter code and leave it to the callsites does not make sense. Thanks, tglx