Linux Media Controller development
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: "Pierre-Eric Pelloux-Prayer" <pierre-eric.pelloux-prayer@amd.com>,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	"Gustavo Padovan" <gustavo@padovan.org>,
	"Christian König" <christian.koenig@amd.com>,
	"Masami Hiramatsu" <mhiramat@kernel.org>,
	"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
	dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org,
	"Alex Deucher" <alexander.deucher@amd.com>,
	amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 6/6] drm: add drm_mode_atomic_commit event
Date: Fri, 16 Feb 2024 17:37:23 +0100	[thread overview]
Message-ID: <Zc-PQ9Yx4fk4TK43@phenom.ffwll.local> (raw)
In-Reply-To: <20240213112017.726016f0@gandalf.local.home>

On Tue, Feb 13, 2024 at 11:20:17AM -0500, Steven Rostedt wrote:
> On Tue, 13 Feb 2024 16:50:31 +0100
> Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> wrote:
> 
> > @@ -1503,6 +1504,24 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
> >  		drm_mode_object_put(obj);
> >  	}
> >  
> > +	if (trace_drm_mode_atomic_commit_enabled()) {
> > +		struct drm_crtc_state *crtc_state;
> > +		struct drm_crtc *crtc;
> > +		int *crtcs;
> > +		int i, num_crtcs;
> > +
> > +		crtcs = kcalloc(dev->mode_config.num_crtc, sizeof(int),
> > +				GFP_KERNEL);
> 
> If the above allocation fails, this will cause a NULL kernel dereference.

Yeah can't we somehow iterate directly into the trace subsystem? If
nothing else works I guess just a per-crtc event should do.

The more fundamental issue: I don't get how this works. For atomic we
have:
- explicitly handed in in-fences as dependencies with the IN_FENCE
  property
- dependencies that drivers fish out of the dma_resv object of the
  underlying gem buffer objects for each framebuffer. That has become
  pretty much entirely generic code since everyone uses the same, and so
  imo the dependency tracking should be fully generic too

- atomic has an out-fence too, so we could even do the full fence->fence
  dependency tracking. It's just not created as a userspace object if all
  userspace asks for is a drm vblank event, but it is very much there. And
  I think if you want fence tracking, we really should have fence tracking
  :-) Also the out-fence should be 100% generic (or it's a driver bug)
  because the driver functions hide the differences between generating a
  vblank event and signalling a dma_fence.

Cheers, Sima


> 
> -- Steve
> 
> > +
> > +		num_crtcs = 0;
> > +		for_each_new_crtc_in_state(state, crtc, crtc_state, i)
> > +			crtcs[num_crtcs++] = drm_crtc_index(crtc);
> > +
> > +		trace_drm_mode_atomic_commit(file_priv, crtcs, num_crtcs, arg->flags);
> > +
> > +		kfree(crtcs);
> > +	}
> > +
> >  	ret = prepare_signaling(dev, state, arg, file_priv, &fence_state,
> >  				&num_fences);
> >  	if (ret)

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  reply	other threads:[~2024-02-16 16:37 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-17 18:41 [PATCH 1/2] tracing, dma-buf: add a trace_dma_fence_sync_to event Pierre-Eric Pelloux-Prayer
2024-01-17 18:41 ` [PATCH 2/2] amdgpu: use trace_dma_fence_sync_to in amdgpu_fence_sync Pierre-Eric Pelloux-Prayer
2024-02-13 15:50 ` [PATCH v2 0/6] dma-fence, drm, amdgpu new trace events Pierre-Eric Pelloux-Prayer
2024-02-13 15:50   ` [PATCH v2 1/6] tracing, dma-buf: add a trace_dma_fence_sync_to event Pierre-Eric Pelloux-Prayer
2024-02-14 12:00     ` Christian König
2024-02-14 15:10       ` Steven Rostedt
2024-02-14 16:54         ` Pierre-Eric Pelloux-Prayer
2024-02-16 16:32     ` Daniel Vetter
2024-02-16 16:51       ` Christian König
2024-02-16 18:02         ` Daniel Vetter
2024-02-13 15:50   ` [PATCH v2 2/6] dma-buf/fence-chain: use trace_dma_fence_sync_to Pierre-Eric Pelloux-Prayer
2024-02-13 15:50   ` [PATCH v2 3/6] amdgpu: use trace_dma_fence_sync_to in amdgpu_fence_sync Pierre-Eric Pelloux-Prayer
2024-02-14 12:10     ` Christian König
2024-02-13 15:50   ` [PATCH v2 4/6] drm/amdgpu: add BO clear event Pierre-Eric Pelloux-Prayer
2024-02-14 12:06     ` Christian König
2024-02-13 15:50   ` [PATCH v2 5/6] drm/amdgpu: add a amdgpu_cs_ioctl2 event Pierre-Eric Pelloux-Prayer
2024-02-14 12:09     ` Christian König
2024-02-14 16:38       ` Pierre-Eric Pelloux-Prayer
2024-02-14 16:45         ` Christian König
2024-02-13 15:50   ` [PATCH v2 6/6] drm: add drm_mode_atomic_commit event Pierre-Eric Pelloux-Prayer
2024-02-13 16:20     ` Steven Rostedt
2024-02-16 16:37       ` Daniel Vetter [this message]
2024-02-16 16:44         ` Steven Rostedt
2024-02-16 16:25   ` [PATCH v2 0/6] dma-fence, drm, amdgpu new trace events Daniel Vetter

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=Zc-PQ9Yx4fk4TK43@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gustavo@padovan.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=pierre-eric.pelloux-prayer@amd.com \
    --cc=rostedt@goodmis.org \
    --cc=sumit.semwal@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox