Received: by 10.223.164.202 with SMTP id h10csp1779608wrb; Fri, 24 Nov 2017 01:07:34 -0800 (PST) X-Google-Smtp-Source: AGs4zMY+tUuhylkIzqMIi8Ys9PzeM87AT8LQvlDIYf66rLhptv1V8LSLaRo+7Cfy4rd35/AYXLt8 X-Received: by 10.84.128.4 with SMTP id 4mr2902172pla.406.1511514454561; Fri, 24 Nov 2017 01:07:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511514454; cv=none; d=google.com; s=arc-20160816; b=gAcwCaC78ccOl3rUpsau5EfWOSCNBOewncfXLuCqNkMfAdsv/HGN5IgRrFsKnhupKz VQieuakuePXokaFErj1UDhqZoxMOSNhpHCI+VVQxd4WHh/kmvIcFijMFbMhx42szHOJS UOQNbtslODic8GhsUy6K33UuyltdyBQAu+x2kq2en0Vd06oGvzadmUv3aajNucvZUbZ/ UR5t6nGr/FqpiN56m5VhPwIXFul+qWyOswSoXtXNJF3oaL3ClMlp+Ioe5dYZbQluSSWU 2vUQzxq95uMY2XrSLBPVeZPfbf4CSOvbc9Te9ASScyte0FXVPFuzjqvyohViKAEDyGkg ZBCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=R7ltAgj8O8vIxaSPAlXSu+8zaNaSlBGY+ap8YmxKono=; b=WJzVZHnu4cytaLTQ1ktcEeiaU2KwCf5PTB8syCKQ+vk1LmXhp+B8aWLIW1dvFzpHIi P4wqYtf0VknThx44yyNcSjFVzWgGDbgA3uBmyehttVix8a2Zm3yalcyQ+En119cdGxID NHIPkpSgyRckAH02aQA5qurEz6vj0OF34vJb8TRlNOnSZn9T2GCk431ZaKebGZ2vWvLp /zK2+Dx6zo93pEC9Id4k2HGlfWFbHkHyJh+DpQQdxPzYxUxotyYfAU4L4T9YotAAtq+G jqpLoMSyg2qpzQOYU6pgEdDd8kmCKV+zLoqllwXSOH9Sjmp6zZf0BPg50mP5mgs6FYwm KlDQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z64si16345050plh.764.2017.11.24.01.07.21; Fri, 24 Nov 2017 01:07:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752770AbdKXJGd (ORCPT + 76 others); Fri, 24 Nov 2017 04:06:33 -0500 Received: from mga11.intel.com ([192.55.52.93]:16109 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752278AbdKXJG3 (ORCPT ); Fri, 24 Nov 2017 04:06:29 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Nov 2017 01:06:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,446,1505804400"; d="scan'208";a="1247919381" Received: from sakamble-mobl.gar.corp.intel.com (HELO [10.252.157.173]) ([10.252.157.173]) by fmsmga002.fm.intel.com with ESMTP; 24 Nov 2017 01:06:27 -0800 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] To: Thomas Gleixner Cc: John Stultz , Stephen Boyd , Chris Wilson , linux-kernel@vger.kernel.org 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> From: Sagar Arun Kamble Message-ID: <83805c37-99b2-2922-e8e8-ea435f9da7d0@intel.com> Date: Fri, 24 Nov 2017 14:36:26 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/24/2017 12:29 AM, Thomas Gleixner wrote: > 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. Yes. Will share patch for this change. > 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. Most of the locks are held around timecounter_read. In some instances it is held when cyclecounter is updated standalone or is updated along with timecounter calls. Was thinking if we move the lock in timecounter functions, drivers just have to do locking around its operations on cyclecounter. But then another problem I see is there are variation of locking calls like lock_irqsave, lock_bh, write_lock_irqsave (some using rwlock_t). Should this all locking be left to driver only then? > Thanks, > > tglx Thanks Sagar From 1584884529018191670@xxx Thu Nov 23 19:01:09 +0000 2017 X-GM-THRID: 1584841375616009291 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread