From: Deepak R Varma <mh12gx2825@gmail.com>
To: Felix Kuehling <felix.kuehling@amd.com>
Cc: "David Airlie" <airlied@linux.ie>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org, "Daniel Vetter" <daniel@ffwll.ch>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>
Subject: Re: [PATCH] drm/amdkfd: replace idr_init() by idr_init_base()
Date: Thu, 5 Nov 2020 22:54:29 +0530 [thread overview]
Message-ID: <20201105172429.GA41091@localhost> (raw)
In-Reply-To: <91ebae30-c75c-5485-8de5-36464e97ed7e@amd.com>
On Wed, Nov 04, 2020 at 03:01:17PM -0500, Felix Kuehling wrote:
> On 2020-11-04 10:13 a.m., Deepak R Varma wrote:
> > idr_init() uses base 0 which is an invalid identifier. The new function
> > idr_init_base allows IDR to set the ID lookup from base 1. This avoids
> > all lookups that otherwise starts from 0 since 0 is always unused.
>
> I disagree. We call idr_alloc with start=0 for both these IDRs. That means 0
> seems to be a valid handle.
Hello Felix,
You are correct. There are calls made to idr_alloc with start range from
0. So, for this driver, id=0 seems a valid use case. The change I
proposed is not relevant for this driver. You may please ignore the
patch.
Thank you,
./drv
>
> Regards,
> Felix
>
>
> >
> > References: commit 6ce711f27500 ("idr: Make 1-based IDRs more efficient")
> >
> > Signed-off-by: Deepak R Varma <mh12gx2825@gmail.com>
> > ---
> > drivers/gpu/drm/amd/amdkfd/kfd_events.c | 2 +-
> > drivers/gpu/drm/amd/amdkfd/kfd_process.c | 2 +-
> > 2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
> > index ba2c2ce0c55a..b3339b53c8ad 100644
> > --- a/drivers/gpu/drm/amd/amdkfd/kfd_events.c
> > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
> > @@ -230,7 +230,7 @@ static int create_other_event(struct kfd_process *p, struct kfd_event *ev)
> > void kfd_event_init_process(struct kfd_process *p)
> > {
> > mutex_init(&p->event_mutex);
> > - idr_init(&p->event_idr);
> > + idr_init_base(&p->event_idr, 1);
> > p->signal_page = NULL;
> > p->signal_event_count = 0;
> > }
> > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> > index 65803e153a22..022e61babe30 100644
> > --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> > @@ -1289,7 +1289,7 @@ struct kfd_process_device *kfd_create_process_device_data(struct kfd_dev *dev,
> > list_add(&pdd->per_device_list, &p->per_device_data);
> > /* Init idr used for memory handle translation */
> > - idr_init(&pdd->alloc_idr);
> > + idr_init_base(&pdd->alloc_idr, 1);
> > return pdd;
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
WARNING: multiple messages have this Message-ID (diff)
From: Deepak R Varma <mh12gx2825@gmail.com>
To: Felix Kuehling <felix.kuehling@amd.com>
Cc: "David Airlie" <airlied@linux.ie>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>
Subject: Re: [PATCH] drm/amdkfd: replace idr_init() by idr_init_base()
Date: Thu, 5 Nov 2020 22:54:29 +0530 [thread overview]
Message-ID: <20201105172429.GA41091@localhost> (raw)
In-Reply-To: <91ebae30-c75c-5485-8de5-36464e97ed7e@amd.com>
On Wed, Nov 04, 2020 at 03:01:17PM -0500, Felix Kuehling wrote:
> On 2020-11-04 10:13 a.m., Deepak R Varma wrote:
> > idr_init() uses base 0 which is an invalid identifier. The new function
> > idr_init_base allows IDR to set the ID lookup from base 1. This avoids
> > all lookups that otherwise starts from 0 since 0 is always unused.
>
> I disagree. We call idr_alloc with start=0 for both these IDRs. That means 0
> seems to be a valid handle.
Hello Felix,
You are correct. There are calls made to idr_alloc with start range from
0. So, for this driver, id=0 seems a valid use case. The change I
proposed is not relevant for this driver. You may please ignore the
patch.
Thank you,
./drv
>
> Regards,
> Felix
>
>
> >
> > References: commit 6ce711f27500 ("idr: Make 1-based IDRs more efficient")
> >
> > Signed-off-by: Deepak R Varma <mh12gx2825@gmail.com>
> > ---
> > drivers/gpu/drm/amd/amdkfd/kfd_events.c | 2 +-
> > drivers/gpu/drm/amd/amdkfd/kfd_process.c | 2 +-
> > 2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
> > index ba2c2ce0c55a..b3339b53c8ad 100644
> > --- a/drivers/gpu/drm/amd/amdkfd/kfd_events.c
> > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
> > @@ -230,7 +230,7 @@ static int create_other_event(struct kfd_process *p, struct kfd_event *ev)
> > void kfd_event_init_process(struct kfd_process *p)
> > {
> > mutex_init(&p->event_mutex);
> > - idr_init(&p->event_idr);
> > + idr_init_base(&p->event_idr, 1);
> > p->signal_page = NULL;
> > p->signal_event_count = 0;
> > }
> > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> > index 65803e153a22..022e61babe30 100644
> > --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> > @@ -1289,7 +1289,7 @@ struct kfd_process_device *kfd_create_process_device_data(struct kfd_dev *dev,
> > list_add(&pdd->per_device_list, &p->per_device_data);
> > /* Init idr used for memory handle translation */
> > - idr_init(&pdd->alloc_idr);
> > + idr_init_base(&pdd->alloc_idr, 1);
> > return pdd;
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: Deepak R Varma <mh12gx2825@gmail.com>
To: Felix Kuehling <felix.kuehling@amd.com>
Cc: "Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"David Airlie" <airlied@linux.ie>,
"Daniel Vetter" <daniel@ffwll.ch>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/amdkfd: replace idr_init() by idr_init_base()
Date: Thu, 5 Nov 2020 22:54:29 +0530 [thread overview]
Message-ID: <20201105172429.GA41091@localhost> (raw)
In-Reply-To: <91ebae30-c75c-5485-8de5-36464e97ed7e@amd.com>
On Wed, Nov 04, 2020 at 03:01:17PM -0500, Felix Kuehling wrote:
> On 2020-11-04 10:13 a.m., Deepak R Varma wrote:
> > idr_init() uses base 0 which is an invalid identifier. The new function
> > idr_init_base allows IDR to set the ID lookup from base 1. This avoids
> > all lookups that otherwise starts from 0 since 0 is always unused.
>
> I disagree. We call idr_alloc with start=0 for both these IDRs. That means 0
> seems to be a valid handle.
Hello Felix,
You are correct. There are calls made to idr_alloc with start range from
0. So, for this driver, id=0 seems a valid use case. The change I
proposed is not relevant for this driver. You may please ignore the
patch.
Thank you,
./drv
>
> Regards,
> Felix
>
>
> >
> > References: commit 6ce711f27500 ("idr: Make 1-based IDRs more efficient")
> >
> > Signed-off-by: Deepak R Varma <mh12gx2825@gmail.com>
> > ---
> > drivers/gpu/drm/amd/amdkfd/kfd_events.c | 2 +-
> > drivers/gpu/drm/amd/amdkfd/kfd_process.c | 2 +-
> > 2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
> > index ba2c2ce0c55a..b3339b53c8ad 100644
> > --- a/drivers/gpu/drm/amd/amdkfd/kfd_events.c
> > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
> > @@ -230,7 +230,7 @@ static int create_other_event(struct kfd_process *p, struct kfd_event *ev)
> > void kfd_event_init_process(struct kfd_process *p)
> > {
> > mutex_init(&p->event_mutex);
> > - idr_init(&p->event_idr);
> > + idr_init_base(&p->event_idr, 1);
> > p->signal_page = NULL;
> > p->signal_event_count = 0;
> > }
> > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> > index 65803e153a22..022e61babe30 100644
> > --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> > @@ -1289,7 +1289,7 @@ struct kfd_process_device *kfd_create_process_device_data(struct kfd_dev *dev,
> > list_add(&pdd->per_device_list, &p->per_device_data);
> > /* Init idr used for memory handle translation */
> > - idr_init(&pdd->alloc_idr);
> > + idr_init_base(&pdd->alloc_idr, 1);
> > return pdd;
next prev parent reply other threads:[~2020-11-05 17:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-04 15:13 [PATCH] drm/amdkfd: replace idr_init() by idr_init_base() Deepak R Varma
2020-11-04 15:13 ` Deepak R Varma
2020-11-04 15:13 ` Deepak R Varma
2020-11-04 15:20 ` Christian König
2020-11-04 15:20 ` Christian König
2020-11-04 15:20 ` Christian König
2020-11-04 20:01 ` Felix Kuehling
2020-11-04 20:01 ` Felix Kuehling
2020-11-04 20:01 ` Felix Kuehling
2020-11-05 17:24 ` Deepak R Varma [this message]
2020-11-05 17:24 ` Deepak R Varma
2020-11-05 17:24 ` Deepak R Varma
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=20201105172429.GA41091@localhost \
--to=mh12gx2825@gmail.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=felix.kuehling@amd.com \
--cc=linux-kernel@vger.kernel.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.