Re: [PATCH libdrm 2/2] [RFC] amdgpu: do not free flink bo for flink_fd

2018-08-13 Thread Christian König

Am 13.08.2018 um 12:08 schrieb Zhang, Jerry (Junwei):

On 08/13/2018 04:29 PM, Christian König wrote:

Am 13.08.2018 um 08:43 schrieb Zhang, Jerry (Junwei):

On 08/13/2018 11:03 AM, Zhang, Jerry (Junwei) wrote:

On 08/10/2018 10:20 PM, Christian König wrote:

Am 10.08.2018 um 07:05 schrieb Junwei Zhang:

the flink bo is used to export


Why should we do this? That makes no sense, this way we would 
create a memory leak.


Get the thought from bo_import code, but neglected the detail of 
DRM_IOCTL_GEM_CLOSE IOCTL,
that will remove the bo handle from filp->object_idr rather than 
filp->dev->object_name_idr.


If so, shall we close the flink bo handle(open_arg.handle) in bo 
import, when fails to find bo in flink handle table?


Yeah, that's what I've meant with that looks like we forgot to close 
the handle there.


Try to fix it in bo create patch.


NO! Please make a separate patch for that.

Could be that somebody wants to backport this.

Christian.



Jerry



Christian.


{{{
args.handle = open_arg.handle;
drmIoctl(dev->flink_fd, DRM_IOCTL_GEM_CLOSE, );
}}}

Regards,
Jerry


Then make sense now. Sorry for the noise.

Jerry



Christian.



Signed-off-by: Junwei Zhang 
---
  amdgpu/amdgpu_bo.c | 6 --
  1 file changed, 6 deletions(-)

diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
index 6f0baf1..5b91cfc 100644
--- a/amdgpu/amdgpu_bo.c
+++ b/amdgpu/amdgpu_bo.c
@@ -219,12 +219,6 @@ static int 
amdgpu_bo_export_flink(amdgpu_bo_handle bo)

  bo->flink_name = flink.name;
-    if (bo->dev->flink_fd != bo->dev->fd) {
-    struct drm_gem_close args = {};
-    args.handle = handle;
-    drmIoctl(bo->dev->flink_fd, DRM_IOCTL_GEM_CLOSE, );
-    }
-
pthread_mutex_lock(>dev->bo_table_mutex);
  r = handle_table_insert(>dev->bo_flink_names, 
bo->flink_name, bo);

pthread_mutex_unlock(>dev->bo_table_mutex);



___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH libdrm 2/2] [RFC] amdgpu: do not free flink bo for flink_fd

2018-08-13 Thread Zhang, Jerry (Junwei)

On 08/13/2018 04:29 PM, Christian König wrote:

Am 13.08.2018 um 08:43 schrieb Zhang, Jerry (Junwei):

On 08/13/2018 11:03 AM, Zhang, Jerry (Junwei) wrote:

On 08/10/2018 10:20 PM, Christian König wrote:

Am 10.08.2018 um 07:05 schrieb Junwei Zhang:

the flink bo is used to export


Why should we do this? That makes no sense, this way we would create a memory 
leak.


Get the thought from bo_import code, but neglected the detail of 
DRM_IOCTL_GEM_CLOSE IOCTL,
that will remove the bo handle from filp->object_idr rather than 
filp->dev->object_name_idr.


If so, shall we close the flink bo handle(open_arg.handle) in bo import, when 
fails to find bo in flink handle table?


Yeah, that's what I've meant with that looks like we forgot to close the handle 
there.


Try to fix it in bo create patch.

Jerry



Christian.


{{{
args.handle = open_arg.handle;
drmIoctl(dev->flink_fd, DRM_IOCTL_GEM_CLOSE, );
}}}

Regards,
Jerry


Then make sense now. Sorry for the noise.

Jerry



Christian.



Signed-off-by: Junwei Zhang 
---
  amdgpu/amdgpu_bo.c | 6 --
  1 file changed, 6 deletions(-)

diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
index 6f0baf1..5b91cfc 100644
--- a/amdgpu/amdgpu_bo.c
+++ b/amdgpu/amdgpu_bo.c
@@ -219,12 +219,6 @@ static int amdgpu_bo_export_flink(amdgpu_bo_handle bo)
  bo->flink_name = flink.name;
-if (bo->dev->flink_fd != bo->dev->fd) {
-struct drm_gem_close args = {};
-args.handle = handle;
-drmIoctl(bo->dev->flink_fd, DRM_IOCTL_GEM_CLOSE, );
-}
-
pthread_mutex_lock(>dev->bo_table_mutex);
  r = handle_table_insert(>dev->bo_flink_names, bo->flink_name, bo);
pthread_mutex_unlock(>dev->bo_table_mutex);



___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH libdrm 2/2] [RFC] amdgpu: do not free flink bo for flink_fd

2018-08-13 Thread Christian König

Am 13.08.2018 um 08:43 schrieb Zhang, Jerry (Junwei):

On 08/13/2018 11:03 AM, Zhang, Jerry (Junwei) wrote:

On 08/10/2018 10:20 PM, Christian König wrote:

Am 10.08.2018 um 07:05 schrieb Junwei Zhang:

the flink bo is used to export


Why should we do this? That makes no sense, this way we would create 
a memory leak.


Get the thought from bo_import code, but neglected the detail of 
DRM_IOCTL_GEM_CLOSE IOCTL,
that will remove the bo handle from filp->object_idr rather than 
filp->dev->object_name_idr.


If so, shall we close the flink bo handle(open_arg.handle) in bo 
import, when fails to find bo in flink handle table?


Yeah, that's what I've meant with that looks like we forgot to close the 
handle there.


Christian.


{{{
args.handle = open_arg.handle;
drmIoctl(dev->flink_fd, DRM_IOCTL_GEM_CLOSE, );
}}}

Regards,
Jerry


Then make sense now. Sorry for the noise.

Jerry



Christian.



Signed-off-by: Junwei Zhang 
---
  amdgpu/amdgpu_bo.c | 6 --
  1 file changed, 6 deletions(-)

diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
index 6f0baf1..5b91cfc 100644
--- a/amdgpu/amdgpu_bo.c
+++ b/amdgpu/amdgpu_bo.c
@@ -219,12 +219,6 @@ static int 
amdgpu_bo_export_flink(amdgpu_bo_handle bo)

  bo->flink_name = flink.name;
-    if (bo->dev->flink_fd != bo->dev->fd) {
-    struct drm_gem_close args = {};
-    args.handle = handle;
-    drmIoctl(bo->dev->flink_fd, DRM_IOCTL_GEM_CLOSE, );
-    }
-
pthread_mutex_lock(>dev->bo_table_mutex);
  r = handle_table_insert(>dev->bo_flink_names, 
bo->flink_name, bo);

pthread_mutex_unlock(>dev->bo_table_mutex);



___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH libdrm 2/2] [RFC] amdgpu: do not free flink bo for flink_fd

2018-08-13 Thread Zhang, Jerry (Junwei)

On 08/13/2018 11:03 AM, Zhang, Jerry (Junwei) wrote:

On 08/10/2018 10:20 PM, Christian König wrote:

Am 10.08.2018 um 07:05 schrieb Junwei Zhang:

the flink bo is used to export


Why should we do this? That makes no sense, this way we would create a memory 
leak.


Get the thought from bo_import code, but neglected the detail of 
DRM_IOCTL_GEM_CLOSE IOCTL,
that will remove the bo handle from filp->object_idr rather than 
filp->dev->object_name_idr.


If so, shall we close the flink bo handle(open_arg.handle) in bo import, when 
fails to find bo in flink handle table?
{{{
args.handle = open_arg.handle;
drmIoctl(dev->flink_fd, DRM_IOCTL_GEM_CLOSE, );
}}}

Regards,
Jerry


Then make sense now. Sorry for the noise.

Jerry



Christian.



Signed-off-by: Junwei Zhang 
---
  amdgpu/amdgpu_bo.c | 6 --
  1 file changed, 6 deletions(-)

diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
index 6f0baf1..5b91cfc 100644
--- a/amdgpu/amdgpu_bo.c
+++ b/amdgpu/amdgpu_bo.c
@@ -219,12 +219,6 @@ static int amdgpu_bo_export_flink(amdgpu_bo_handle bo)
  bo->flink_name = flink.name;
-if (bo->dev->flink_fd != bo->dev->fd) {
-struct drm_gem_close args = {};
-args.handle = handle;
-drmIoctl(bo->dev->flink_fd, DRM_IOCTL_GEM_CLOSE, );
-}
-
  pthread_mutex_lock(>dev->bo_table_mutex);
  r = handle_table_insert(>dev->bo_flink_names, bo->flink_name, bo);
  pthread_mutex_unlock(>dev->bo_table_mutex);



___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH libdrm 2/2] [RFC] amdgpu: do not free flink bo for flink_fd

2018-08-12 Thread Zhang, Jerry (Junwei)

On 08/10/2018 10:20 PM, Christian König wrote:

Am 10.08.2018 um 07:05 schrieb Junwei Zhang:

the flink bo is used to export


Why should we do this? That makes no sense, this way we would create a memory 
leak.


Get the thought from bo_import code, but neglected the detail of 
DRM_IOCTL_GEM_CLOSE IOCTL,
that will remove the bo handle from filp->object_idr rather than 
filp->dev->object_name_idr.
Then make sense now. Sorry for the noise.

Jerry



Christian.



Signed-off-by: Junwei Zhang 
---
  amdgpu/amdgpu_bo.c | 6 --
  1 file changed, 6 deletions(-)

diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
index 6f0baf1..5b91cfc 100644
--- a/amdgpu/amdgpu_bo.c
+++ b/amdgpu/amdgpu_bo.c
@@ -219,12 +219,6 @@ static int amdgpu_bo_export_flink(amdgpu_bo_handle bo)
  bo->flink_name = flink.name;
-if (bo->dev->flink_fd != bo->dev->fd) {
-struct drm_gem_close args = {};
-args.handle = handle;
-drmIoctl(bo->dev->flink_fd, DRM_IOCTL_GEM_CLOSE, );
-}
-
  pthread_mutex_lock(>dev->bo_table_mutex);
  r = handle_table_insert(>dev->bo_flink_names, bo->flink_name, bo);
  pthread_mutex_unlock(>dev->bo_table_mutex);



___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH libdrm 2/2] [RFC] amdgpu: do not free flink bo for flink_fd

2018-08-10 Thread Christian König

Am 10.08.2018 um 07:05 schrieb Junwei Zhang:

the flink bo is used to export


Why should we do this? That makes no sense, this way we would create a 
memory leak.


Christian.



Signed-off-by: Junwei Zhang 
---
  amdgpu/amdgpu_bo.c | 6 --
  1 file changed, 6 deletions(-)

diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
index 6f0baf1..5b91cfc 100644
--- a/amdgpu/amdgpu_bo.c
+++ b/amdgpu/amdgpu_bo.c
@@ -219,12 +219,6 @@ static int amdgpu_bo_export_flink(amdgpu_bo_handle bo)
  
  	bo->flink_name = flink.name;
  
-	if (bo->dev->flink_fd != bo->dev->fd) {

-   struct drm_gem_close args = {};
-   args.handle = handle;
-   drmIoctl(bo->dev->flink_fd, DRM_IOCTL_GEM_CLOSE, );
-   }
-
pthread_mutex_lock(>dev->bo_table_mutex);
r = handle_table_insert(>dev->bo_flink_names, bo->flink_name, bo);
pthread_mutex_unlock(>dev->bo_table_mutex);


___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH libdrm 2/2] [RFC] amdgpu: do not free flink bo for flink_fd

2018-08-09 Thread Junwei Zhang
the flink bo is used to export

Signed-off-by: Junwei Zhang 
---
 amdgpu/amdgpu_bo.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
index 6f0baf1..5b91cfc 100644
--- a/amdgpu/amdgpu_bo.c
+++ b/amdgpu/amdgpu_bo.c
@@ -219,12 +219,6 @@ static int amdgpu_bo_export_flink(amdgpu_bo_handle bo)
 
bo->flink_name = flink.name;
 
-   if (bo->dev->flink_fd != bo->dev->fd) {
-   struct drm_gem_close args = {};
-   args.handle = handle;
-   drmIoctl(bo->dev->flink_fd, DRM_IOCTL_GEM_CLOSE, );
-   }
-
pthread_mutex_lock(>dev->bo_table_mutex);
r = handle_table_insert(>dev->bo_flink_names, bo->flink_name, bo);
pthread_mutex_unlock(>dev->bo_table_mutex);
-- 
1.9.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH libdrm 2/2] [RFC] amdgpu: do not free flink bo for flink_fd

2018-08-09 Thread Junwei Zhang
the flink bo is used to export

Signed-off-by: Junwei Zhang 
---
 amdgpu/amdgpu_bo.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
index 2947715..0d0c73b 100644
--- a/amdgpu/amdgpu_bo.c
+++ b/amdgpu/amdgpu_bo.c
@@ -219,12 +219,6 @@ static int amdgpu_bo_export_flink(amdgpu_bo_handle bo)
 
bo->flink_name = flink.name;
 
-   if (bo->dev->flink_fd != bo->dev->fd) {
-   struct drm_gem_close args = {};
-   args.handle = handle;
-   drmIoctl(bo->dev->flink_fd, DRM_IOCTL_GEM_CLOSE, );
-   }
-
pthread_mutex_lock(>dev->bo_table_mutex);
r = handle_table_insert(>dev->bo_flink_names, bo->flink_name, bo);
pthread_mutex_unlock(>dev->bo_table_mutex);
-- 
1.9.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx