dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Huang, Ray" <Ray.Huang@amd.com>
To: "Koenig, Christian" <Christian.Koenig@amd.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Sumit Semwal <sumit.semwal@linaro.org>
Cc: "Deucher, Alexander" <Alexander.Deucher@amd.com>,
	"Liu, Monk" <Monk.Liu@amd.com>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>
Subject: RE: [PATCH 1/3] dma-buf: make the flags can be configured during dma fence init
Date: Tue, 14 Dec 2021 09:19:21 +0000	[thread overview]
Message-ID: <DM5PR12MB250468603570AFC28C211F56EC759@DM5PR12MB2504.namprd12.prod.outlook.com> (raw)
In-Reply-To: <5adca96a-e2bb-833a-e470-807a22b9b2fc@amd.com>

[AMD Official Use Only]

> -----Original Message-----
> From: Koenig, Christian <Christian.Koenig@amd.com>
> Sent: Tuesday, December 14, 2021 4:00 PM
> To: Huang, Ray <Ray.Huang@amd.com>; dri-devel@lists.freedesktop.org;
> Daniel Vetter <daniel.vetter@ffwll.ch>; Sumit Semwal
> <sumit.semwal@linaro.org>
> Cc: amd-gfx@lists.freedesktop.org; linux-media@vger.kernel.org; Deucher,
> Alexander <Alexander.Deucher@amd.com>; Liu, Monk
> <Monk.Liu@amd.com>
> Subject: Re: [PATCH 1/3] dma-buf: make the flags can be configured during
> dma fence init
> 
> Am 13.12.21 um 07:34 schrieb Huang Rui:
> > In some user scenarios, the get_timeline_name callback uses the flags
> > to decide which way to return the timeline string name. Once the
> > trace_dma_fence_init event is enabled, it will call get_timeline_name
> > callback to dump the fence structure. However, at this moment, the
> > flags are always 0, and it might trigger some issues in
> > get_timeline_name callback implementation of different gpu driver. So
> > make a member to initialize the flags in dma_fence_init().
> 
> Well that doesn't make much sense to me.
> 
> None of the dma_fence callbacks is called from the dma_fence_init function
> (or at least shouldn't). So drivers always have the opportunity to to adjust
> the flags.
> 
> So please explain the rational again?

Once we enable trace_dma_fence_init event, we will call get_driver_name and get_timeline_name callback function to dump the names in dma_fence_init().
At that time, the flags are always 0. However, in amdgpu_fence_get_timeline_name(), it will check the flags (AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT) to select which way to get the ring.
If the fence should be actually embedded in the job (will be set after that), it still will trigger a kernel panic (please see patch2) because it go with a wrong way. Because we cannot set the flags at the start of dma_fence_init. That is the problem.

Thanks,
Ray

> 
> Christian.
> 
> >
> > Signed-off-by: Huang Rui <ray.huang@amd.com>
> > ---
> >   drivers/dma-buf/dma-fence.c | 2 +-
> >   include/linux/dma-fence.h   | 7 +++++++
> >   2 files changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
> > index 066400ed8841..3e0622bf385f 100644
> > --- a/drivers/dma-buf/dma-fence.c
> > +++ b/drivers/dma-buf/dma-fence.c
> > @@ -952,7 +952,7 @@ dma_fence_init(struct dma_fence *fence, const
> struct dma_fence_ops *ops,
> >   	fence->lock = lock;
> >   	fence->context = context;
> >   	fence->seqno = seqno;
> > -	fence->flags = 0UL;
> > +	fence->flags = ops->init_flags;
> >   	fence->error = 0;
> >
> >   	trace_dma_fence_init(fence);
> > diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
> > index 1ea691753bd3..f9270c5bc07a 100644
> > --- a/include/linux/dma-fence.h
> > +++ b/include/linux/dma-fence.h
> > @@ -131,6 +131,13 @@ struct dma_fence_ops {
> >   	 */
> >   	bool use_64bit_seqno;
> >
> > +	/**
> > +	 * @init_flags:
> > +	 *
> > +	 * The initial value of fence flags (A mask of DMA_FENCE_FLAG_*
> defined).
> > +	 */
> > +	unsigned long init_flags;
> > +
> >   	/**
> >   	 * @get_driver_name:
> >   	 *

  reply	other threads:[~2021-12-14  9:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-13  6:34 [PATCH 1/3] dma-buf: make the flags can be configured during dma fence init Huang Rui
2021-12-13  6:34 ` [PATCH 2/3] drm/amdgpu: fix the fence timeline null pointer Huang Rui
2021-12-14  8:01   ` Christian König
2021-12-14  9:23     ` Huang, Ray
2021-12-13  6:34 ` [PATCH 3/3] drm: fix the warnning of string style for scheduler trace Huang Rui
2021-12-20  5:30   ` Huang Rui
2022-01-20  0:31   ` Huang Rui
2021-12-14  7:59 ` [PATCH 1/3] dma-buf: make the flags can be configured during dma fence init Christian König
2021-12-14  9:19   ` Huang, Ray [this message]
2021-12-14  9:24     ` Christian König
2021-12-14  9:44       ` Huang, Ray
2021-12-14  9:51         ` Christian König

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=DM5PR12MB250468603570AFC28C211F56EC759@DM5PR12MB2504.namprd12.prod.outlook.com \
    --to=ray.huang@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=Monk.Liu@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-media@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).