From patchwork Thu Aug 12 06:30:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sierra Guiza, Alejandro (Alex)" X-Patchwork-Id: 12432579 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E988C43214 for ; Thu, 12 Aug 2021 06:31:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 26BC360FED for ; Thu, 12 Aug 2021 06:31:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 26BC360FED Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id A6A276B0075; Thu, 12 Aug 2021 02:31:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9F2D86B0078; Thu, 12 Aug 2021 02:31:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7FC066B007B; Thu, 12 Aug 2021 02:31:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0068.hostedemail.com [216.40.44.68]) by kanga.kvack.org (Postfix) with ESMTP id 52B686B0078 for ; Thu, 12 Aug 2021 02:31:25 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 0EDBE22863 for ; Thu, 12 Aug 2021 06:31:25 +0000 (UTC) X-FDA: 78465456930.12.707E0A1 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2070.outbound.protection.outlook.com [40.107.223.70]) by imf17.hostedemail.com (Postfix) with ESMTP id B21F4F006EE3 for ; Thu, 12 Aug 2021 06:31:24 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ng+Ub96dILi7iPxAkNOInoZx/zlUezSgGcLQQXzJhFR43WoFtFlEYTW6sQKhCelxF8IY+4dYVAxp8x/AMBV3sfA8cyk1r0XoGFIKzzVsWcwO6E9vmVH+niZeW9/6M98IArt32uMmehjpU9FBRi6cZ0pb4t5+6jt3J3mc1PFrcEiXPm8+8tCfXO7JSMt0EQcn5HxKP4gerZCiUCUutHUFpv7E3FV+CO2jDHwZxehrj19QahYGwwql82fwxZEuETEAFwJl7GRCl1/Emrkue59iybLo+xfJodvsFMBvdNhdm4/N7nILItu9ShNsyWm1/VvZtagXIfVgFtHgNlI1XbCXbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4HzlIn9ZrDqltW27OtHNPNd/ATCxAv/hvwq+QIQbS/g=; b=UUKtgItwkSOAt5UxaVSfCsWvjGhNKvqzUFSloBU7UcOhRSb69K5MFXJn5i0zr7O9w+03j0snRkuwEcHrPpsVGtLPd+gFeVkDxYegbv8p9xDXgPoyRWyhgCezlD9QpF+5pEXHHXAhr7/8Sxn8IqTBDa+3Xty58ypONy53DVq1gO0Ct06v0lmOLt8MwQQxXLKwp7NPoEOw/FCAQ6K9OSMJszag3XiJzoCCVY0lIFoI5Sr8DJnEBCrjftqriiL6miKrxiSzWmAcDLBCNBDB/ojW1KiBg+kM/EXEIbNZiXslQaZx+41lauQKB3eWJ1/qoivkIIN/7QjFzs44WSrC8a7o5Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4HzlIn9ZrDqltW27OtHNPNd/ATCxAv/hvwq+QIQbS/g=; b=AmijVqNzuAq4V544/zfCvk6mvb8x0c02WHG8rVtfl/d3JmlT7zR+ydtYdPCmhNkIhZ6nIJyiFAXo7R7Lk0D6ZpJ2dvcuf2vq1YPdt9+fRhvFEJirAjkb9fj90knZfRR3HKGqahOxl/JNOzPR6xxMUpqqAlRDg0Yfy7lV9g+bLUk= Received: from SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) by SN1PR12MB2448.namprd12.prod.outlook.com (2603:10b6:802:28::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.25; Thu, 12 Aug 2021 06:31:23 +0000 Received: from SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::e828:5445:a5aa:94cb]) by SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::e828:5445:a5aa:94cb%5]) with mapi id 15.20.4415.016; Thu, 12 Aug 2021 06:31:22 +0000 From: Alex Sierra To: akpm@linux-foundation.org, Felix.Kuehling@amd.com, linux-mm@kvack.org, rcampbell@nvidia.com, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, hch@lst.de, jgg@nvidia.com, jglisse@redhat.com Subject: [PATCH v5 05/13] drm/amdkfd: generic type as sys mem on migration to ram Date: Thu, 12 Aug 2021 01:30:52 -0500 Message-Id: <20210812063100.31997-6-alex.sierra@amd.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210812063100.31997-1-alex.sierra@amd.com> References: <20210812063100.31997-1-alex.sierra@amd.com> X-ClientProxiedBy: SN7PR18CA0026.namprd18.prod.outlook.com (2603:10b6:806:f3::18) To SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from alex-MS-7B09.amd.com (165.204.78.1) by SN7PR18CA0026.namprd18.prod.outlook.com (2603:10b6:806:f3::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.17 via Frontend Transport; Thu, 12 Aug 2021 06:31:22 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 835d9c59-eaa3-456c-3b82-08d95d5acd95 X-MS-TrafficTypeDiagnostic: SN1PR12MB2448: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hOKtCWePxla9lAQExklMN51ZmQxH2X3zLLMuJLQmOei1H2xQKqtV8IVu5/s5sZlreEczstPB2ZE+yCYoLt/nym7DPigy0rQg80AHKwjG/JF9ctfujojzlKadUQlgpTzBe652MfUTyZfyLIE4AzNzEBfVXflhQCgZYKvgc7yfVrrAAvJtJxa9P0XpY8+v3eV64C3vpGoPX+UUvK0eE5OYdFUhy0CHIyRP9dMzdvuUCAMUMxav8SJGAcoTnlQHJgFFYVG1yKgOYUqg/H3tb3SlWGibhUZNaMf2Ykjt+gIAn2XgDsBBhAKRfm8MRvWe6pWdKoaNUwEjwrUnJ3XeXdxux7iOuusPifziFdJuV5HPSbRarNQja6msF/X1ysEiXOJrBGTdSnokjdP4jEzCt9b90D7cRaiZUJo/ZaJuFOadiRSTen3ScoANNo8PDnRTR6H+jdZHDgnCL4ppfHvgjMWD5dgXz9sCnXvt9nOFBwUfzvdrwtDWiBjoxFdZ43R2l0prT8cJxrxAIb2lVtEHc/IrVQcIvjToh9uKcO2Hy2tLIe0QEYr61Hxfq93dxocCVjaMZgL0MSpUIxkyaQ6PLhxLI2PgtSe401jsOXwQ9PHdHHtTEYcsq/c20v//vZPy3ar+X3o5h5LGQJcvt88uu5baukFg5XEIBETWi0tTkdMO1tzKH6c1Y76wtEVzzJ/OwTsXHnc11ms8YOLF2oxL8hb4XrTwR/awTGq3VXARXFKmJT8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA0PR12MB4430.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(39860400002)(396003)(366004)(136003)(346002)(38350700002)(6666004)(186003)(66556008)(66946007)(2616005)(478600001)(83380400001)(38100700002)(8676002)(26005)(44832011)(2906002)(66476007)(956004)(52116002)(7416002)(1076003)(4326008)(86362001)(36756003)(6486002)(8936002)(5660300002)(316002)(7696005)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: w96IwJWmGatH4P0nwS74kPNyyAiXZpsrrXauSsE3+cBx1fGiRKRQwBHkGZUiFruHu3VXkeWicDUhp+chSl4XeOMV9lEM0xIlq17Voa7+ZMggFFcuCUaCmWE/vmtX6zgs5Gsd7o3RA+v6kcllNeM0iplWXtHSFVXJScMTLxT3WtP1l9dPaER02yX2UWwbnZ8as48bsj9DcoWi2p86mGKkQpXB5u3t9kh/efoVEZuqktCOo8mE2gtmVX6GASzPOwSAkH+jZXzRcHL4919wQ2WU9tUxbKtHELe0UpirYRT2lk6aGn+eDPiDhODo0ekVpHM0tL8ssMbGZ3R26/i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change-CrossTenant-AuthSource: SA0PR12MB4430.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2021 06:31:22.8434 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8TR/LSpBYx6zo05V2Tx0WzdcOMDGW+eLD38U5a3zcIwOjzmNnD022samzl/uYG+r5bkxoCe5e+6pMpaDXCtP4A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2448 X-Rspamd-Queue-Id: B21F4F006EE3 Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=AmijVqNz; spf=pass (imf17.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.223.70 as permitted sender) smtp.mailfrom=Alex.Sierra@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com X-Rspamd-Server: rspam01 X-Stat-Signature: jxnf8ugscbbgjdoidr19o578qt4nxoz3 X-HE-Tag: 1628749884-695421 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Generic device type memory on VRAM to RAM migration, has similar access as System RAM from the CPU. This flag sets the source from the sender. Which in Generic type case, should be set as SYSTEM. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c index 3e9315354ce4..c511932e56d7 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c @@ -664,9 +664,12 @@ svm_migrate_vma_to_ram(struct amdgpu_device *adev, struct svm_range *prange, 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; size = 2 * sizeof(*migrate.src) + sizeof(uint64_t) + sizeof(dma_addr_t); size *= npages; buf = kvmalloc(size, GFP_KERNEL | __GFP_ZERO);