From patchwork Fri Aug 13 06:31:42 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: 12434771 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 AC83FC19F35 for ; Fri, 13 Aug 2021 06:32:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5C9A2610CC for ; Fri, 13 Aug 2021 06:32:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5C9A2610CC 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 CEEFB8D0006; Fri, 13 Aug 2021 02:32:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C7B6B8D0003; Fri, 13 Aug 2021 02:32:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A7DAB8D0006; Fri, 13 Aug 2021 02:32:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0221.hostedemail.com [216.40.44.221]) by kanga.kvack.org (Postfix) with ESMTP id 86D3C8D0003 for ; Fri, 13 Aug 2021 02:32:09 -0400 (EDT) Received: from smtpin33.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 31465180ACC3C for ; Fri, 13 Aug 2021 06:32:09 +0000 (UTC) X-FDA: 78469087578.33.03DDA06 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2087.outbound.protection.outlook.com [40.107.220.87]) by imf17.hostedemail.com (Postfix) with ESMTP id B8293F005544 for ; Fri, 13 Aug 2021 06:32:08 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dN4FDsqGZj0Vua7rPwkKUd6Rmm8DgR9lct9xSgc/63SufNOwuRkt9XKE47MdxSgQdDFuhFxjtEZZf43XXvSgtxGq5ZDo1Rp+Vc60ooxUWtCiDqlVBx+3hHIDgb7BIY0getn86lYiQOQzTE2JvrAzO/rHMeZ3anTUco2y1ddvxnFhBhgbV2eRuf8g6iBNuviesu4iiVsHKTipssrSf3lmpbkivmGhrSCIW/BNGVzmZBYXI3Hmo121tvLgtp29GDmTehKXEGMHVLoTbPhBmyLXh+/QKEQBRGiCg9jrVWhmVEgwFuANmSfmBrypgi1WKX3doIpj0XKNJBwRdgm+ImOZVw== 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=X3ThOLGhVWnDkKgI8BE3aHhWyP9mVZRtKdRj/+WuuuM=; b=jj2KQZc/i6WrOGvxyMrGx5WlOTb5cv5dAW0BCibPpzgAXKC/pIqPw1e6O4WHzF98Bdg+Jl9/jiPafNQ8BRHUkyYtXR1ZquexbflwthWPOJQmSsatMm9o7IrZdWU3Mv56rzYo7e1noludH/kdyq3KatnNHh0sb8ardqMuXUu6DuicmGHZqNkFt5CTRmIXUTKQgX6JI1NJ+vDHsmUKuzU8tdNMoiYqzTUL4yWev7rPKgTL5aBuha7VtMq091WZrtrYtKOKuKlYjreHkoGTI4DyxATdf/qQXUyL+Pb5xPhu/GnBHcIq6vjz466QOYlxjHbBLimh+C6fS7GiaWx2a8YhAw== 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=X3ThOLGhVWnDkKgI8BE3aHhWyP9mVZRtKdRj/+WuuuM=; b=Owg2f9c4wD6N+qsgOA24tOfzwrUMBvkE7CyTk0bPuk2VUS4qDhHsS/UcgVq66H2RJXDYvwlJfdRSF1m3Qd8ct4h6Tcfdk7exNl6mIjz94j12yrHsiHZeYjPO42z8pKtPp10KHizVzow1OAXheo4ddp+CUtmLQGfyo5DC8bzsfzY= Received: from SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) by SN6PR12MB2782.namprd12.prod.outlook.com (2603:10b6:805:73::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.19; Fri, 13 Aug 2021 06:32:06 +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.019; Fri, 13 Aug 2021 06:32:06 +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 v6 05/13] drm/amdkfd: generic type as sys mem on migration to ram Date: Fri, 13 Aug 2021 01:31:42 -0500 Message-Id: <20210813063150.2938-6-alex.sierra@amd.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210813063150.2938-1-alex.sierra@amd.com> References: <20210813063150.2938-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; Fri, 13 Aug 2021 06:32:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 71bfe2f9-9339-4452-9aaf-08d95e2411f7 X-MS-TrafficTypeDiagnostic: SN6PR12MB2782: 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: 41BSe1ceSMYGsk1V4tQNttUVH1V4vToWcnmdQNbGNHZlpX7e8yWk15clQUtV82M1X7wdqoqcxmzFlhrBqt7ZosI5/EmKTXptLjXkQdebgPpodE5DoA8iastOFFeSKETXMMP+77IgdbentRCezgTVusvztcp1ilT18d6BV+eh9pB++0/LBV7qxD95gWrVuCK1gcMUZ4f1Tw58iTOBU5F8hEUQc09faLVmk3n4hSXabFnbFInB8yNZhhjFj9wPwx7hiL9VysCpYY/Z4iAbrEzLfEVKrLk5sl5iA/Pbufm/a+nW8DTQeZvJkpu84PvNzjI04K4Fxp/bmJHm333+kyrPAChTh5wqmrhx4tAeL66j6uHKF8c91VJKYDfg45CpDQhoUHyCgzXrFxFaDoJbEwsO1M76k32/eoc1VUzTOiKdpzx1UbNMM1n4+EyPuSbPP9GZe495G6oN+fKKRnVGTgTJqLrkQexmrikBqvY6d5V9LQv1wCgr6a1ijgFH52UtxyyfdxfrpYRRd0G/jWSxKzD+ge1MbNwUNm7SzSHHhrQhL7sq94VjALEi4l93ICLnefEFRBPQQiWJhLxhYSjFfXJZg60PqjbE8n/Km/gh2dHCZ9KehOURx1S7B/HhMzMb9dybqkuVD0Ae+Ch5GOSJTKUVnKoejrKaPQLY5t+EwVCHu8DHEkVqbWXO71djjYvjB8MQ/qk3W9UsgP2KXTulOlGhbQWptnl5+oEshgyzBT/uMvU= 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)(366004)(376002)(346002)(396003)(39860400002)(136003)(316002)(2616005)(956004)(7416002)(38350700002)(7696005)(38100700002)(66946007)(66556008)(4326008)(52116002)(36756003)(6666004)(66476007)(1076003)(8936002)(5660300002)(83380400001)(44832011)(2906002)(478600001)(26005)(6486002)(186003)(8676002)(86362001)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4v5X2vns6d8FFuY4aH7+923wOI6+3ZD82bGck7OTW4YzAZF7jAhoNpOWZLkUheBV1BMx6BXoTNQTSatGqTFb3clvsooLYyFaC7KrK7aAMeElCJ0JNhIrV07o35y8lwqF9Mgk0fmjzWJbL9tpNZRSUkeA+961vHjriw6FgMiJhErDDOVy0Hzv7trMVpKipMA6IQpiqDCAHeWeFT/k6i3RfM4RRrwerIgKvUVi+k8paHbjoI8oEqEAV52BcR9A9g9G6lVFwEAqSwsHfA7zFJHZ39GhO+gWefR4nNrRWEO8mAlSLuqv7VJnV6eq7XCx7d/+X4L0YW10daKwa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d95e2411f7 X-MS-Exchange-CrossTenant-AuthSource: SA0PR12MB4430.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2021 06:32:06.4168 (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: 1mHUfx0r9yFmAgEGDCL0e2//lYys7pLCTjMubmKVfl1U4AHmSZkunD0oeivBBzm5UeMz3uNO8nCa6moZuOIVQQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2782 X-Rspamd-Queue-Id: B8293F005544 Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=Owg2f9c4; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf17.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.220.87 as permitted sender) smtp.mailfrom=Alex.Sierra@amd.com X-Rspamd-Server: rspam04 X-Stat-Signature: 5u81czez4gzx56rnwraouzpu85h7kayn X-HE-Tag: 1628836328-947308 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 24a8b6d4f947..e5b10de83a5f 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_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);