From patchwork Wed Aug 25 03:48:17 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: 12456315 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 EA07CC432BE for ; Wed, 25 Aug 2021 03:48:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 833F46103C for ; Wed, 25 Aug 2021 03:48:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 833F46103C 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 B1EC56B0073; Tue, 24 Aug 2021 23:48:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AA8276B0074; Tue, 24 Aug 2021 23:48:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8D4268D0001; Tue, 24 Aug 2021 23:48:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0175.hostedemail.com [216.40.44.175]) by kanga.kvack.org (Postfix) with ESMTP id 759546B0073 for ; Tue, 24 Aug 2021 23:48:44 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 21DEA1803F9DF for ; Wed, 25 Aug 2021 03:48:44 +0000 (UTC) X-FDA: 78512221368.25.F8AA0E6 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2089.outbound.protection.outlook.com [40.107.94.89]) by imf01.hostedemail.com (Postfix) with ESMTP id AC75F5030FEF for ; Wed, 25 Aug 2021 03:48:43 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MLaOpVOkqdVN8G3ufRCQJytBt8Cd3eDgLwIK6t4W+JGLAx1chL4RQ1HpXcDWLfXzcfZEeyOYikFHrLaBKQ3R79Enn8E4eMgKN+b1DMum+Axq9BVjisSFNn0kSZP4ptp8UFOFyGZyVAn2LRh185w0KlDk4mA8sWLVU8G8LUmevSKs+4PttZF/vWoS7EGZE8Iwd/KOxOJHg9mrnMTPhFlkf52zKvIqzCb7EVoRsgRirNiileD+1Dp5PtYOsgJEaRWFR+aaCYbzTIhQ0ROJI4R4yyHN9+JrvuhjJtu8rXII8IJMvDTyjCroMKcLWrxNfyAHoI06yJ9LUrdUMrNIAlmg+w== 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=8wRbV2DhV8DbE5TzDUTHl0JWq3DdgS2MRaH+D8hi2PQ=; b=dG0tH8LP/+wixoHvv8+n23m8UYmi3AmheQ8ZxHnT6hQM4+bxRjA9CPL07eDBjZs9FVB33hZfZxxQPOQeOqyTGa0ijSA1aFGYGj56HDTDJaOGRYeA4CACjdFcDQZxyRwmVKg5/w70Vz5SVnFaYF9FG44TKUme2PYSReL6vhrw3AzqRtcAdTGZ5orI2qZ35K77NkoF9usTR3mQHe/43qmDYBISrL26JXt0tZR0Eia8yDjMXxuGJBr1tZLjaAxGiOJwkugvAgvdXjO/LupvCNMEtLQA6K9BqJce96SYsJaJvqgJPOT0p09extP2qnrWpHlRtn7z3VfjA8tcuo54aV5bZw== 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=8wRbV2DhV8DbE5TzDUTHl0JWq3DdgS2MRaH+D8hi2PQ=; b=VO1VA21Fef/TSMP6ikLHZ69/W48/NmvAYUlgTEzGRf91mmR/6O4511VFM60FKI4cx1pK2XYTexMUri2JftE5Hh6CfpVM5LIya333fdHL2sRwEc9l3ReTDEELTWmNdakkLRXCiURus0OhkbE9a+TdqcHYsnfhaIzKDq7ZzrVTWFk= Received: from SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) by SA0PR12MB4511.namprd12.prod.outlook.com (2603:10b6:806:95::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Wed, 25 Aug 2021 03:48:42 +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:42 +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 03/14] mm: add iomem vma selection for memory migration Date: Tue, 24 Aug 2021 22:48:17 -0500 Message-Id: <20210825034828.12927-4-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:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3fb6dd18-a0b1-448f-aa24-08d9677b3b0c X-MS-TrafficTypeDiagnostic: SA0PR12MB4511: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2399; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ecMg3UaGjxV6r6jukGl7zrzu6qc+WHgAGpoGBhIt74g0g4Ikrc5IIOBCnIdpD/8n0o2a6zlVOSkv6wo9+epRAd/K0p9qT6bAMnQldnYdNUhx4pJsSEdeMzZyKKp+0a/XBCUu3oUvC1fbkkGmXaMC0JX14LGk9weqBwk7HSK9O+EuaV2w/a6LX2ZQzx3Gr6e0+j9skxTgZYOH2eZSXjyAbx3y/Sj3/5JMWkZCeZ8DDbH/jCaS7kHEC6zopd3YkJvFaJQkm5Nd26cMPcvmsLqKO52yKPaY0f96RZNN/jx3DoLTfMrHllkv3kRCHoSmYFWqGzAKtMckoaCuDqf5pcjBclvmWcxXtHspUAsz476PTe4TOP8wCiZ7hJsIsK8Qi265iRdq5jVrnR92vQ/OXM3yhY9txrvOnpzB9mn9642EpLI0QyrrmPAPFlXRxk3olE/QtsG6q9JkGeoC+6kyeMAhpynt8Da+Dki+X/3gVCrLytm16dVsUnLvyuTwdB1t/9McKBwkrIIRk3CbjbJWYIU2Xlaxn0ceJh4stx3Ar5rPCx43yEnM0QYDWXSNtjInQmIcqpjKK73MSyGBH/DX9XMYtykG/DttmaiC4jTCaYE9S65x+VpPdgdzxezdM3QyGrSDu+L6LCSSm/vqebiLCGIFfcwNXnWaY/k/QY0VmRCs/Y2YFvNT2xEW6ewiHspKuD+Of3I9+E6W3NUcksfDFXnDZw== 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)(136003)(346002)(376002)(396003)(39860400002)(316002)(478600001)(186003)(1076003)(83380400001)(8936002)(38100700002)(7696005)(66556008)(8676002)(66476007)(66946007)(6666004)(956004)(36756003)(52116002)(2616005)(4326008)(44832011)(7416002)(2906002)(6486002)(5660300002)(38350700002)(86362001)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6NfkD9rq7lw91ZDyR5Qq1waoUiJfPkG/uIQLI/xhXt0Kq5bQCg1LMD3XPCRirIT3vLt5qyVkolpg2WVmw3Fas5RhP5T0t29duZRHC9YmpajwbTh4uFtFk2rD3GV35W0p612YgGsvrnICsu1HOaBK/q1NENNNCg5PJ4MF07bZwqSjs1p0fQJLkrMt+66J9A9MvadNQRKvOQeYtIVQ011nAkP3wpcY9k7C0EpVq81JJ8MBSxh+MJTWtvbqG7s23Ni49w9RRLPAyQ2Xuz6MU0FuTq76Ib8OsLXJGPiGpzf5+2iyCJQt+PWwjzyDrKMHMd7GHJZfVfjE7V/NaKuTL/9Bp+nURy1P+V7sevZjE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thSource: SA0PR12MB4430.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2021 03:48:42.1249 (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: 5yEbHUz2A8M/xPc1ww8ORfcSoq50hWfbE/UOu+DrT7yHg05NbiuNYgjUkCa/nUpW/+vOgAaW1MrHxvFfvf3ekQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4511 Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=VO1VA21F; spf=pass (imf01.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.94.89 as permitted sender) smtp.mailfrom=Alex.Sierra@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: AC75F5030FEF X-Stat-Signature: x5xo1fmgaxx5bhawr7b43yy6qbbye55m X-HE-Tag: 1629863323-791209 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: In this case, this is used to migrate pages from device memory, back to system memory. This particular device memory type should be accessible by the CPU, through IOMEM access. Typically, zone device public type memory falls into this category. Signed-off-by: Alex Sierra --- include/linux/migrate.h | 1 + mm/migrate.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/migrate.h b/include/linux/migrate.h index 4bb4e519e3f5..6b16f417384f 100644 --- a/include/linux/migrate.h +++ b/include/linux/migrate.h @@ -156,6 +156,7 @@ static inline unsigned long migrate_pfn(unsigned long pfn) enum migrate_vma_direction { MIGRATE_VMA_SELECT_SYSTEM = 1 << 0, MIGRATE_VMA_SELECT_DEVICE_PRIVATE = 1 << 1, + MIGRATE_VMA_SELECT_IOMEM = 1 << 2, }; struct migrate_vma { diff --git a/mm/migrate.c b/mm/migrate.c index e3a10e2a1bb3..d4ae2da99607 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2406,7 +2406,8 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp, if (is_write_device_private_entry(entry)) mpfn |= MIGRATE_PFN_WRITE; } else { - if (!(migrate->flags & MIGRATE_VMA_SELECT_SYSTEM)) + if (!(migrate->flags & MIGRATE_VMA_SELECT_SYSTEM) && + !(migrate->flags & MIGRATE_VMA_SELECT_IOMEM)) goto next; pfn = pte_pfn(pte); if (is_zero_pfn(pfn)) {