All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Sagar Arun Kamble <sagar.a.kamble@intel.com>
Cc: John Stultz <john.stultz@linaro.org>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Chris Wilson <chris@chris-wilson.co.uk>,
	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]
Date: Fri, 24 Nov 2017 14:31:13 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1711241429050.1757@nanos> (raw)
In-Reply-To: <83805c37-99b2-2922-e8e8-ea435f9da7d0@intel.com>

On Fri, 24 Nov 2017, Sagar Arun Kamble wrote:
> 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?

You could have the lock in the struct and protect the inner workings in the
related core functions.

That might remove locking requirements from some of the callers and the
others still have their own thing around it.

Thanks,

	tglx

  reply	other threads:[~2017-11-24 13:31 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-15 12:13 [RFC 0/4] GPU/CPU timestamps correlation for relating OA samples with system events Sagar Arun Kamble
2017-11-15 12:13 ` [RFC 1/4] drm/i915/perf: Add support to correlate GPU timestamp with system time Sagar Arun Kamble
2017-11-15 12:25   ` Chris Wilson
2017-11-15 16:41     ` Sagar Arun Kamble
2017-11-23  7:34     ` 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] Sagar Arun Kamble
2017-11-23 18:59       ` Thomas Gleixner
2017-11-24  9:06         ` Sagar Arun Kamble
2017-11-24 13:31           ` Thomas Gleixner [this message]
2017-11-27 10:05             ` Sagar Arun Kamble
2017-11-27 10:05               ` Sagar Arun Kamble
     [not found]               ` <63a2a495-1bdb-5d47-1202-9b538e9601d8-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-11-30 21:03                 ` Saeed Mahameed
2017-11-30 21:03                   ` Saeed Mahameed
     [not found]                   ` <CALzJLG9JXOnr3EQ2zLcmwKx8S9-CGONRRBSAd9XwHdemEgOn2A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-12-01  7:42                     ` Sagar Arun Kamble
2017-12-01  7:42                       ` Sagar Arun Kamble
2017-12-05 13:58     ` [RFC 1/4] drm/i915/perf: Add support to correlate GPU timestamp with system time Lionel Landwerlin
2017-12-06  8:17       ` Sagar Arun Kamble
2017-11-15 12:13 ` [RFC 2/4] drm/i915/perf: Add support for collecting 64 bit timestamps with OA reports Sagar Arun Kamble
2017-12-06 16:01   ` Lionel Landwerlin
2017-12-21  8:38     ` Sagar Arun Kamble
2017-11-15 12:13 ` [RFC 3/4] drm/i915/perf: Extract raw GPU timestamps from " Sagar Arun Kamble
2017-12-06 19:55   ` Lionel Landwerlin
2017-12-21  8:50     ` Sagar Arun Kamble
2017-11-15 12:13 ` [RFC 4/4] drm/i915/perf: Send system clock monotonic time in perf samples Sagar Arun Kamble
2017-11-15 12:31   ` Chris Wilson
2017-11-15 16:51     ` Sagar Arun Kamble
2017-11-15 17:54   ` Sagar Arun Kamble
2017-12-05 14:22   ` Lionel Landwerlin
2017-12-06  8:31     ` Sagar Arun Kamble
2017-11-15 12:30 ` ✗ Fi.CI.BAT: warning for GPU/CPU timestamps correlation for relating OA samples with system events Patchwork
2017-12-05 14:16 ` [RFC 0/4] " Lionel Landwerlin
2017-12-05 14:28   ` Robert Bragg
2017-12-05 14:37     ` Lionel Landwerlin
2017-12-06  9:01       ` Sagar Arun Kamble
2017-12-06 20:02 ` Lionel Landwerlin
2017-12-22  5:15   ` Sagar Arun Kamble
2017-12-22  5:26     ` Sagar Arun Kamble
2017-12-07  0:48 ` Robert Bragg
2017-12-07  0:57   ` Robert Bragg
2017-12-21 12:59     ` Lionel Landwerlin
2017-12-22  9:30       ` Sagar Arun Kamble
2017-12-22 10:16         ` Lionel Landwerlin
2017-12-26  5:32           ` Sagar Arun Kamble
2017-12-28 17:13             ` Lionel Landwerlin
2018-01-03  5:38               ` Sagar Arun Kamble
2017-12-22  6:06   ` Sagar Arun Kamble

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1711241429050.1757@nanos \
    --to=tglx@linutronix.de \
    --cc=chris@chris-wilson.co.uk \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sagar.a.kamble@intel.com \
    --cc=sboyd@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.