From patchwork Fri May 10 19:53:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Felix Kuehling X-Patchwork-Id: 10939445 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7485D933 for ; Fri, 10 May 2019 19:53:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 650FE28BA7 for ; Fri, 10 May 2019 19:53:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58FA928C9D; Fri, 10 May 2019 19:53:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_WEB autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 19A1D28BA7 for ; Fri, 10 May 2019 19:53:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0322189FDD; Fri, 10 May 2019 19:53:27 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM04-BN3-obe.outbound.protection.outlook.com (mail-eopbgr680087.outbound.protection.outlook.com [40.107.68.87]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3C6CD89B7D; Fri, 10 May 2019 19:53:25 +0000 (UTC) Received: from BYAPR12MB3176.namprd12.prod.outlook.com (20.179.92.82) by BYAPR12MB3447.namprd12.prod.outlook.com (20.178.196.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1878.21; Fri, 10 May 2019 19:53:23 +0000 Received: from BYAPR12MB3176.namprd12.prod.outlook.com ([fe80::9118:73f2:809c:22c7]) by BYAPR12MB3176.namprd12.prod.outlook.com ([fe80::9118:73f2:809c:22c7%4]) with mapi id 15.20.1856.016; Fri, 10 May 2019 19:53:23 +0000 From: "Kuehling, Felix" To: "jglisse@redhat.com" , "alex.deucher@amd.com" , "airlied@gmail.com" , "linux-mm@kvack.org" , "dri-devel@lists.freedesktop.org" , "amd-gfx@lists.freedesktop.org" Subject: [PATCH 1/2] mm/hmm: support automatic NUMA balancing Thread-Topic: [PATCH 1/2] mm/hmm: support automatic NUMA balancing Thread-Index: AQHVB2oGxdqwfWjT3keZMPNyIuFBZw== Date: Fri, 10 May 2019 19:53:23 +0000 Message-ID: <20190510195258.9930-2-Felix.Kuehling@amd.com> References: <20190510195258.9930-1-Felix.Kuehling@amd.com> In-Reply-To: <20190510195258.9930-1-Felix.Kuehling@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [165.204.55.251] x-mailer: git-send-email 2.17.1 x-clientproxiedby: YTXPR0101CA0021.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b00::34) To BYAPR12MB3176.namprd12.prod.outlook.com (2603:10b6:a03:133::18) x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2aa8c48f-0427-4877-df74-08d6d5812861 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:BYAPR12MB3447; x-ms-traffictypediagnostic: BYAPR12MB3447: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3383; x-forefront-prvs: 0033AAD26D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(136003)(366004)(39860400002)(346002)(376002)(189003)(199004)(110136005)(102836004)(2501003)(6512007)(86362001)(6436002)(2906002)(76176011)(52116002)(2201001)(6506007)(386003)(99286004)(6486002)(66066001)(3846002)(478600001)(6116002)(14454004)(72206003)(316002)(305945005)(53936002)(66476007)(66556008)(186003)(8936002)(81166006)(7736002)(486006)(4326008)(64756008)(66446008)(14444005)(256004)(25786009)(26005)(66946007)(73956011)(476003)(2616005)(71200400001)(446003)(11346002)(71190400001)(8676002)(36756003)(81156014)(5660300002)(50226002)(4744005)(68736007)(1076003); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR12MB3447; H:BYAPR12MB3176.namprd12.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: SozOdyCbVyWhsZucRi1nkqT89QpXVuUElrx98H8kPsylK1EJGgawzrDEfe+cLr9wWnjrZeIcUc3MUfZKpWVDNq4lxttKtLb76kVvErHyGKMW2uYrpXLCCWQxSDrQN8FXK+S0tpW3vwsN0PjeyMFqCdz7Y2PiCWzUB2apxyHa0u1IveEB3cL04d5Xv5QU1gs050l4HMDXT03dKi6YX8pMsLVMjOfgmsxxmc8KdYEqdK2gvPdep+9eTV6eT+wVQuQiJWR9JalT0jkPAx+dLEYbRbcq3BnJ/yxuxJ0xdc+pWrwswyhXnAxF1211TpUujkZZzAxbalvVEfUYea1v85bUJV7j/w9XT5WfU55bU77takcZrv/PpIiv2gIyvXKOrI/1ax3JS06iUNJ/492tp9GosdDHhv+Kjhh3bL/oMsVGWBI= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2aa8c48f-0427-4877-df74-08d6d5812861 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 May 2019 19:53:23.0778 (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-Transport-CrossTenantHeadersStamped: BYAPR12MB3447 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=01TE663c8WMujIC20jubp91UV3+DQFkGrM3bWrl8IbU=; b=koIJQSAKV4tSIdDeGAsJ8r8laUsSJeUbvwAIUPRqgRBW90AEy4QvL6qmIhh01au+Rld330cHy0FRXsvrj9s6FIwgDda/e4oypHixsOHBNXRwR0bI/whVVGVVxKLqhrPFnJ8zARmsy/dUIfBAmDYc/Pi3O+glwgMEZbLy2J2Zhvo= X-Mailman-Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Felix.Kuehling@amd.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Yang, Philip" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Philip Yang While the page is migrating by NUMA balancing, HMM failed to detect this condition and still return the old page. Application will use the new page migrated, but driver pass the old page physical address to GPU, this crash the application later. Use pte_protnone(pte) to return this condition and then hmm_vma_do_fault will allocate new page. Signed-off-by: Philip Yang Reviewed-by: Jérôme Glisse --- mm/hmm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/hmm.c b/mm/hmm.c index 75d2ea906efb..b65c27d5c119 100644 --- a/mm/hmm.c +++ b/mm/hmm.c @@ -554,7 +554,7 @@ static int hmm_vma_handle_pmd(struct mm_walk *walk, static inline uint64_t pte_to_hmm_pfn_flags(struct hmm_range *range, pte_t pte) { - if (pte_none(pte) || !pte_present(pte)) + if (pte_none(pte) || !pte_present(pte) || pte_protnone(pte)) return 0; return pte_write(pte) ? range->flags[HMM_PFN_VALID] | range->flags[HMM_PFN_WRITE] :