[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <771FC2D4-15CF-464B-96FF-837533A85886@amd.com>
Date: Mon, 16 Aug 2021 22:06:38 +0000
From: "Zeng, Oak" <Oak.Zeng@....com>
To: "Sierra Guiza, Alejandro (Alex)" <Alex.Sierra@....com>,
Christoph Hellwig <hch@....de>
CC: "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"Kuehling, Felix" <Felix.Kuehling@....com>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"rcampbell@...dia.com" <rcampbell@...dia.com>,
"linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>,
"linux-xfs@...r.kernel.org" <linux-xfs@...r.kernel.org>,
"amd-gfx@...ts.freedesktop.org" <amd-gfx@...ts.freedesktop.org>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"jgg@...dia.com" <jgg@...dia.com>,
"jglisse@...hat.com" <jglisse@...hat.com>
Subject: Re: [PATCH v6 05/13] drm/amdkfd: generic type as sys mem on migration
to ram
Regards,
Oak
On 2021-08-16, 3:53 PM, "amd-gfx on behalf of Sierra Guiza, Alejandro (Alex)" <amd-gfx-bounces@...ts.freedesktop.org on behalf of alex.sierra@....com> wrote:
On 8/15/2021 10:38 AM, Christoph Hellwig wrote:
> On Fri, Aug 13, 2021 at 01:31:42AM -0500, Alex Sierra wrote:
>> migrate.vma = vma;
>> migrate.start = start;
>> migrate.end = end;
>> - migrate.flags = MIGRATE_VMA_SELECT_DEVICE_PRIVATE;
>> migrate.pgmap_owner = SVM_ADEV_PGMAP_OWNER(adev);
>>
>> + if (adev->gmc.xgmi.connected_to_cpu)
>> + migrate.flags = MIGRATE_VMA_SELECT_SYSTEM;
>> + else
>> + migrate.flags = MIGRATE_VMA_SELECT_DEVICE_PRIVATE;
> It's been a while since I touched this migrate code, but doesn't this
> mean that if the range already contains system memory the migration
> now won't do anything? for the connected_to_cpu case?
For above’s condition equal to connected_to_cpu , we’re explicitly
migrating from
device memory to system memory with device generic type.
For MEMORY_DEVICE_GENERIC memory type, why do we need to explicitly migrate it from device memory to normal system memory? I thought the design was, for this type of memory, CPU can access it in place without migration(just like CPU access normal system memory), so there is no need to migrate such type of memory to normal system memory...
With this patch, the migration behavior will be: when memory is accessed by CPU, it will be migrated to normal system memory; when memory is accessed by GPU, it will be migrated to device vram. This is basically the same behavior as when vram is treated as DEVICE_PRIVATE.
I thought the whole goal of introducing DEVICE_GENERIC is to avoid such back and forth migration b/t device memory and normal system memory. But maybe I am missing something here....
Regards,
Oak
In this type,
device PTEs are
present in CPU page table.
During migrate_vma_collect_pmd walk op at migrate_vma_setup call,
there’s a condition
for present pte that require migrate->flags be set for
MIGRATE_VMA_SELECT_SYSTEM.
Otherwise, the migration for this entry will be ignored.
Regards,
Alex S.
Powered by blists - more mailing lists