From patchwork Wed Aug 25 03:48:21 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: 12456325 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, 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 8ABB5C432BE for ; Wed, 25 Aug 2021 03:49:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 36D706103C for ; Wed, 25 Aug 2021 03:49:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 36D706103C 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 CCBFA6B007D; Tue, 24 Aug 2021 23:48:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C7DC66B0080; Tue, 24 Aug 2021 23:48:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ACE2B6B007E; Tue, 24 Aug 2021 23:48:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0231.hostedemail.com [216.40.44.231]) by kanga.kvack.org (Postfix) with ESMTP id 947E56B007B for ; Tue, 24 Aug 2021 23:48:48 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 3FEFE8249980 for ; Wed, 25 Aug 2021 03:48:48 +0000 (UTC) X-FDA: 78512221536.30.AFE984F Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2089.outbound.protection.outlook.com [40.107.237.89]) by imf23.hostedemail.com (Postfix) with ESMTP id CED0B90000B7 for ; Wed, 25 Aug 2021 03:48:47 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BJKdRnW1mtjVyZk+/YMIa+tXeS3xNcmYupfchjiEAgs0dZkWa8mznQC7k2N4Btm6fcvXxj4OVBhM/JdZ2KoikrL1nZTDO5H0l2m3gM8ZIXnucF2ImfNgi1RjtMmLxUiFJeEowncJUysPVn2gsg3HpfDvkmuoET9gyE0HsXEBIgfy1mHgx48neZsbcJn/HPbjctrMfRPC64Y1HbWizn4P9Gy/LWnPerby7wBNmMGY/fOeHBEIlVGNEdDnK8wzyLYjk8RfOpekjqdG+2LQCjn0sI/0utS4VTQM6OMgVIpCBIr/jtQXH545ppdlIFEp6CgviMOkuX4r6Rt8Lc8UjGh2sQ== 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=ytzilRdg7u/L1sYg4tCIUqF5v6yBkwXcMogVV+Xzdfc=; b=Ayj1tp8Q3qjxbA7dgZAoKx9gZlxmsOb3XZ5B9wYvhk9/2+TxhZr0TqxcBiy5kftjC0CEFBawQ7QTvw34VZVlIgmjoxHTRUazRCI6Qj4VHvWdPdWMhvfKm17WguiMD3NP8//wIeWUV3AtwOG657Mkgaw3Hl/IjpyuuufZqFAf55qR6Cnz+HbSNy0LGm5pzmfPvEjmOVeBiTML8/P1RK5jMcxriulCClOvdI5KNCb8fpeHWIL79dWDNRtgtF65KXzizQ2BlKkEEWiDYnVqF26qxEiz2+s/KotAwTixiCAY4AKu8rFTnvl8av3VED/uQ/MdYzb3Ggr/D8p/9Yqq/yt+XA== 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=ytzilRdg7u/L1sYg4tCIUqF5v6yBkwXcMogVV+Xzdfc=; b=KdTvO8EVsVeu4CKU+dj0zEOHQYPQWfBMCvECX5xNEsPNsST+vRov+yM4CjS/A0l0p8zsjDnjFtZX/cbX+VGYsNAAVUN60+Np3K+QWfKZ0tiNg+LqDO0Zy4bgMa2431x8gfmdDmQaxTJ8C5pkc+/+lmc8XIj4YelwsDziI1mhB7g= Received: from SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) by SN6PR12MB4750.namprd12.prod.outlook.com (2603:10b6:805:e3::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.22; Wed, 25 Aug 2021 03:48:46 +0000 Received: from SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::855b:1f8c:c5d1:331f]) by SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::855b:1f8c:c5d1:331f%7]) with mapi id 15.20.4457.017; Wed, 25 Aug 2021 03:48:46 +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 v1 07/14] drm/amdkfd: public type as sys mem on migration to ram Date: Tue, 24 Aug 2021 22:48:21 -0500 Message-Id: <20210825034828.12927-8-alex.sierra@amd.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210825034828.12927-1-alex.sierra@amd.com> References: <20210825034828.12927-1-alex.sierra@amd.com> X-ClientProxiedBy: SN7PR04CA0190.namprd04.prod.outlook.com (2603:10b6:806:126::15) 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 SN7PR04CA0190.namprd04.prod.outlook.com (2603:10b6:806:126::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Wed, 25 Aug 2021 03:48:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 08e08265-d84a-4eb0-843e-08d9677b3d89 X-MS-TrafficTypeDiagnostic: SN6PR12MB4750: 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: F6whwGGh7uAC8OY67KKSenLN8OyQa0ZuD2qkW5AewbQb9SkGhMoHKUNod4SXPNcwiNcihv2Q3aPnUPP4kqCb/nagChytmu2spxWVLDofoNNg02wZ5WdIMw5aj8pCk3MyztGK0vvmMZ4iaM77lo9omyKYSC3WB9p4ktt2b7nZDHqSRAIidN0D62PnXYTJfenF9qvgikWexUGcd/cT/XwKEp+OvC0qo2NTEdnFrU73IS/OsLa14q55EG53yhI7N9vXHDGrVpMTWl1OKKUq9nDKSbVeK+h2nhLa1vwTGPhLLdgKIqpD4zoJpCDe2EFDkT2tdLICX9BmNKDW0CPW+ccUg8HtfuQv7OMjwx5pfp0kN8rneiNqZCBZzJA5tYVAa7HWf6z5x/p9Xd9gYsX5U+uLvLMSgI//XGqU6LUNYjOSKQeZzA4xUeKLadRcbgc5bUEOAk8qKRQEvAfs99Vcs40sh3mPNQjjgBnYSquevnkQFetCzHmcYeUyU4nL17/kal4lWf1VIMs7KMyIhYLvMmsqSgD2K3gQXBEWmi5IM/85+Q6eSI2Ag+iqDr8G01U8gh/8WgU7oHWgZ1UMLnFdzN0IMLXpM1HvmAyFjubZvyV0BeHFOkR2k+tpQYyUrcwz4zE9bxL370beTCN6gAs0sc306e7GIGST3wR2I8GC6cyT/XMqyasTsiIcGUlqxtnPB4bz8dNjMcpmGID09l0wgCf1QQ== 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)(39860400002)(376002)(346002)(136003)(396003)(366004)(7416002)(6486002)(1076003)(4326008)(86362001)(7696005)(44832011)(52116002)(186003)(2616005)(956004)(38350700002)(38100700002)(478600001)(66476007)(66556008)(6666004)(316002)(26005)(36756003)(8936002)(5660300002)(8676002)(66946007)(83380400001)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GTEmg6nbEV/cdmN4opTvmbsXSSDqbaqcIaU5O5AY6Ph3xHdLIzgynOZeNK0InIRK+ZEGIrsvB4BItoywcfi8yHvEukpuP4TGeowEcUAVI62xhTAv13vOmduCdfWJDn26J9ByxPb4yKQBbGHiheQ8RNmOUfJWcmAp/ELFtn0NmHhQ0ZCq2P6Rh8637DtkeVD1M52jOXpp0/syrLxpyy+kNfPQrpmhe8DU2sx9o1WmwS0HQiVUqeuJQ0HYEk10VbRl2uyw6KX/19OD03rlFfmoOu1JZtj3h1TE6bvkohysA6ip0DvdYb+Ni8VM/Hv44qpz9dvOZMP0raD4vva2y/e9mBFxae6ci9kPTzJEL4QHFmf2onqI5uoUZ1F2jdN3v5jmMU8RZL+J5ILV1qb9ikdCGt68ImnXDUp5Kbu/EoZLrEPxMvblbGCrP7JoNdeMEJcJtw1NSg9kwdK78/4yhg2SKMNrOpr/DWJiq7EUBadVZ/Q2IqDK1hL/ob8xPVL7MF7V9tzPtJJ6e2UyMU+Agx35Pp4mi5nKabpXvMiPXCXsF/umpcT2sJn5F6k6Pk48s1fZ2x1zIKbkMMuNODTYl9Ppv6wwT4d1rBDL46y06vXAqi5gBYKoyOxKcdGNDIGtjIkvIaLWKVUCrwXJc8llHr2JwwWnMSvQ22dHVPhajB1HlmGoL91cqUHXs7M+yoyPfA0fS7yKxPvAr4HbMybpPHh+4micMbVAEpmyXO95i/ewG893fUYrTrsTcdTTWkXQvBuWAXn0zB7shtevookBdS3B6+zyx9Zc36GE1SaoPMRcc3MSl4FicOluLN70kU4SlfiabeS/pyZWQaNLhf4Ht/N9lPMAUERYQKiTBNbg30iK6pREpuICKqmyVRL2uiQgqZuM+IIuK30kc/B4dCJr67nBWURQ8k+0dqOj6szWrkQGqpnig+nSLHGVsTMaK+i1cyjjI3eJ6NT9ngB2DtxF4K5PNgvfzUC7odsRkj91SYEYWYZI8VbxVqvQHMKKVBmogpwo66PhhSrhz1L6Bg6selt+IOQ54P1uzQAs7kmLo/j9pATtbuIqDG1i4dmMa0nthumNja6+/HH3GG6LWO2qPImLYrvIK/ctU/wN/Jtov4MgquTYba0/0/6UUIkXwXrm7pAd6z2LEuglcZbBwx80iWUbSBCbcvUovmYR68hpprdRno7AdfUJA+GGJZpg49hmRcgUyXi91Y6Mo4eE0NYacaPf0u890gDd0iVSwA5KuhcP57gt3UebyKz2DnCjBbF9Gt9GvNUHYc43MirJnzPx/UUNqb9s5RKhVj4NpsDg8XusmkWo73W61zEgXEuaUI+nB86r X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 08e08265-d84a-4eb0-843e-08d9677b3d89 X-MS-Exchange-CrossTenant-AuthSource: SA0PR12MB4430.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2021 03:48:46.3524 (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: RtVSp/4/NpTc2uoswF+JliVzYRO+vzMYOpZSDWKTgGA6gtym6CxILecxqktYEsSCeEr3Ac+SImMulo9lRFoxgA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB4750 Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=KdTvO8EV; spf=pass (imf23.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.237.89 as permitted sender) smtp.mailfrom=Alex.Sierra@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com X-Stat-Signature: 9kwiiitzdogbqfmdsunpbo9615foqi6h X-Rspamd-Queue-Id: CED0B90000B7 X-Rspamd-Server: rspam04 X-HE-Tag: 1629863327-300884 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: Public 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 Public type case, should be set as IOMEM. 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 dd245699479f..618035dffc64 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c @@ -616,9 +616,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_IOMEM; + 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);