AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Andrey Grodzovsky <andrey.grodzovsky@amd.com>,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: alexdeucher@gmail.com, daniel.vetter@ffwll.ch, michel@daenzer.net
Subject: Re: [PATCH 2/6] drm/amdgpu: Force unmap all user VMAs on device removal.
Date: Mon, 11 May 2020 08:47:23 +0200	[thread overview]
Message-ID: <9d374ffa-40d2-d016-cd44-16c7d0505f78@gmail.com> (raw)
In-Reply-To: <1589050310-19666-3-git-send-email-andrey.grodzovsky@amd.com>

Am 09.05.20 um 20:51 schrieb Andrey Grodzovsky:
> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  4 +++-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    | 14 ++++++++++----
>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |  4 ++++
>   3 files changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index e6978a2..4da52b7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1374,8 +1374,10 @@ amdgpu_device_ip_get_ip_block(struct amdgpu_device *adev,
>   			      enum amd_ip_block_type type)
>   {
>   	int i;
> -
>   	for (i = 0; i < adev->num_ip_blocks; i++)
> +
> +
> +

Unrelated whitespace change.

>   		if (adev->ip_blocks[i].version->type == type)
>   			return &adev->ip_blocks[i];
>   
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 76a6198..ea2b47e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1130,16 +1130,22 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
>   	return ret;
>   }
>   
> +static void amdgpu_force_unmap_user_space_mappings(struct drm_device *dev)
> +{
> +	struct amdgpu_device *adev = dev->dev_private;
> +
> +	ttm_bo_unmap_virtual_address_space(&adev->mman.bdev);
> +}
> +

If we really add a function for this we should probably put it into 
amdgpu_ttm.c

>   static void
>   amdgpu_pci_remove(struct pci_dev *pdev)
>   {
>   	struct drm_device *dev = pci_get_drvdata(pdev);
>   
> -#ifdef MODULE
> -	if (THIS_MODULE->state != MODULE_STATE_GOING)
> -#endif
> -		DRM_ERROR("Hotplug removal is not supported\n");

Keep the warning for now, there is a lot of stuff we need to fix first 
before removing that one.

Christian.

>   	drm_dev_unplug(dev);
> +
> +	amdgpu_force_unmap_user_space_mappings(dev);
> +
>   	amdgpu_driver_unload_kms(dev);
>   	pci_disable_device(pdev);
>   	pci_set_drvdata(pdev, NULL);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 3d822eb..22afd11 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -35,6 +35,7 @@
>   
>   #include <drm/amdgpu_drm.h>
>   #include <drm/drm_cache.h>
> +#include <drm/drm_drv.h>
>   #include "amdgpu.h"
>   #include "amdgpu_trace.h"
>   #include "amdgpu_amdkfd.h"
> @@ -1361,6 +1362,9 @@ int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
>   	if (!amdgpu_bo_is_amdgpu_bo(bo))
>   		return 0;
>   
> +	if (drm_dev_is_unplugged(adev->ddev))
> +		return -ENODEV;
> +
>   	abo = ttm_to_amdgpu_bo(bo);
>   
>   	/* Remember that this BO was accessed by the CPU */

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

  reply	other threads:[~2020-05-11  6:47 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-09 18:51 [PATCH 0/6] RFC Support hot device unplug in amdgpu Andrey Grodzovsky
2020-05-09 18:51 ` [PATCH 1/6] drm/ttm: Add unampping of the entire device address space Andrey Grodzovsky
2020-05-11  6:45   ` Christian König
2020-06-05 14:29     ` Andrey Grodzovsky
2020-06-05 18:40       ` Christian König
2020-06-09 16:37         ` Andrey Grodzovsky
2020-05-09 18:51 ` [PATCH 2/6] drm/amdgpu: Force unmap all user VMAs on device removal Andrey Grodzovsky
2020-05-11  6:47   ` Christian König [this message]
2020-05-09 18:51 ` [PATCH 3/6] drm/amdgpu: Wait for all user clients Andrey Grodzovsky
2020-05-11  6:57   ` Christian König
2020-05-09 18:51 ` [PATCH 4/6] drm/amdgpu: Wait for all clients importing out dma-bufs Andrey Grodzovsky
2020-05-09 18:51 ` [PATCH 5/6] drm/ttm: Add destroy flag in TTM BO eviction interface Andrey Grodzovsky
2020-05-11  7:05   ` Christian König
2020-06-10 10:25   ` Thomas Hellström (Intel)
2020-06-10 13:56     ` Andrey Grodzovsky
2020-05-09 18:51 ` [PATCH 6/6] drm/amdgpu: Use TTM MMs destroy interface Andrey Grodzovsky
2020-05-11  9:26 ` [PATCH 0/6] RFC Support hot device unplug in amdgpu Pekka Paalanen
2020-05-11 12:29   ` Christian König
2020-05-11 16:37   ` Andrey Grodzovsky
2020-05-11  9:54 ` Daniel Vetter
2020-05-11 10:19   ` Chris Wilson
2020-05-11 11:03     ` Daniel Vetter
2020-05-11 11:19   ` Daniel Vetter
2020-05-11 12:34     ` Christian König
2020-05-11 12:43       ` Daniel Vetter
2020-05-11 11:43   ` Lukas Wunner
2020-05-11 12:21     ` Daniel Vetter
2020-05-11 14:08       ` Lukas Wunner
2020-05-11 14:14         ` Daniel Vetter
2020-05-13 14:32   ` Andrey Grodzovsky
2020-05-13 18:05     ` 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=9d374ffa-40d2-d016-cd44-16c7d0505f78@gmail.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=andrey.grodzovsky@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=michel@daenzer.net \
    /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