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: 10939439 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 07333933 for ; Fri, 10 May 2019 19:53:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBDB828BA7 for ; Fri, 10 May 2019 19:53:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DFBD728C9D; Fri, 10 May 2019 19:53:28 +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=-1.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_WEB autolearn=no version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77D0D28BA7 for ; Fri, 10 May 2019 19:53:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ABA146B0005; Fri, 10 May 2019 15:53:26 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A42876B0006; Fri, 10 May 2019 15:53:26 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E2FA6B0007; Fri, 10 May 2019 15:53:26 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-it1-f197.google.com (mail-it1-f197.google.com [209.85.166.197]) by kanga.kvack.org (Postfix) with ESMTP id 6D8626B0005 for ; Fri, 10 May 2019 15:53:26 -0400 (EDT) Received: by mail-it1-f197.google.com with SMTP id q1so6135624itc.3 for ; Fri, 10 May 2019 12:53:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:thread-topic :thread-index:date:message-id:references:in-reply-to:accept-language :content-language:content-transfer-encoding:mime-version; bh=01TE663c8WMujIC20jubp91UV3+DQFkGrM3bWrl8IbU=; b=pFkqp4QztyOWKtp2pLhGiOI9VxZNCEEcADnIZWDeB7207N2IhruEeldlzx4XtrOl31 Hg/E4jq+N1RLq91isN8+PxabefZ+ZYH8FcakLq5hqoA5eMgacwYuO+uc48s92ookmsuY 17bF0P+RGykj7ew9wrLs+eFNtO4kPa0K7TUdTDOBkQ8KRY1mnIV0uVNdDsDtd23WrFv1 iUmonG/WKYEpz4hN43u5pJpdMqB79AyV+qn/qkirE5MoNfN1ZleuUSdEBBL1wkZZrJJj YOvJ/BhpMPeDzKpF/GlibrA6jyvVSySi3ZlY58eemG1yGKhUch1cH/U3OWgPER8s7s94 H1BQ== X-Gm-Message-State: APjAAAWvhJCekgwESufmgmeXyw1ZKSzIkfWJ9PgUuPCa8/3CBeKkLz+8 1hGqLUan7iR6APJVl++McvejB25dFmSPVLDWu0vjbc24wGOzyd0CCPPxROmu83wXnTw/mxRzZ6X aW7LJcug4xUoplxmddF1ATqqaPa3WJU81n3zpzHqpEcX6Ey90z1DUPfuXUy/tBH8= X-Received: by 2002:a02:a890:: with SMTP id l16mr9732404jam.137.1557518006214; Fri, 10 May 2019 12:53:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfTbT434/xMd7s9GswdmGPAjbQJjF4TsVMdlbA/Sl/8t8PY17dZp+uoNi+IKmIpFeB7VAB X-Received: by 2002:a02:a890:: with SMTP id l16mr9732264jam.137.1557518004867; Fri, 10 May 2019 12:53:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557518004; cv=none; d=google.com; s=arc-20160816; b=umWzoLxhfGI+HITpEGFSbYV9OZDpIZBg41azPXit64pXKgdM8zqqoU7Jj9pGJtlGi6 IP/o5Hh08CPfJjuXiX/aESlVinkzvu2yHIS644SlsZoZHK57SSadWC8N0h6Rf48hG4mT fIJBh9zVgvMmDnkZpqF43+E/Q5iChaAvf/Kj9MUmg40lNyhcW8En5xLDoe2FP6Go9Gt3 oD+FiCJ6jCafESFxkRYQB4s6589F93cxTF9i4gTES9v9VI0lmCiAqvPL0PyPpCAM7fGQ PFVzSLw0qTpo+lJ2P+zlKd0toyZ4dWzRyKcx2RRusubmkwsVCl6ecZU62zVenNCMpEx4 A7+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:content-transfer-encoding:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=01TE663c8WMujIC20jubp91UV3+DQFkGrM3bWrl8IbU=; b=VhrZRqafnyLjrsoirrZbAH3moGWY8IgT32jSGFSrJ0OWhcVVBhLTy91SqHvk3ySEpL wR0gMb0onczTuHXqPr+1z25B4Zatxv5pCVMbgKCCsHeOIRmbRmODZcBAPw5I3s0sZA+h mI1ro7Uc7VVDxxtUQ6h1NBByZb44vyUZ3En1DNqU+L0gnmnZyAfIA8+OQ/SH0zCb6jcf MdaHBea0T+jyMpgd/YzelzindgwQygRqMCntgFe6u4sXeKf36eWXfE9R6o83HAkqGaTv xw48rrU4yc+uGoV0Ht0vmIn/bnUXHGiqXh64++pRjav9p+9lkcAbOH3sRg7IvxEeIDHS F0Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=koIJQSAK; spf=neutral (google.com: 40.107.68.53 is neither permitted nor denied by best guess record for domain of felix.kuehling@amd.com) smtp.mailfrom=Felix.Kuehling@amd.com Received: from NAM04-BN3-obe.outbound.protection.outlook.com (mail-eopbgr680053.outbound.protection.outlook.com. [40.107.68.53]) by mx.google.com with ESMTPS id 129si3959864jai.75.2019.05.10.12.53.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 May 2019 12:53:24 -0700 (PDT) Received-SPF: neutral (google.com: 40.107.68.53 is neither permitted nor denied by best guess record for domain of felix.kuehling@amd.com) client-ip=40.107.68.53; Authentication-Results: mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=koIJQSAK; spf=neutral (google.com: 40.107.68.53 is neither permitted nor denied by best guess record for domain of felix.kuehling@amd.com) smtp.mailfrom=Felix.Kuehling@amd.com 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= 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" CC: "Yang, Philip" 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) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Felix.Kuehling@amd.com; 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-Bogosity: Ham, tests=bogofilter, spamicity=0.000121, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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] : From patchwork Fri May 10 19:53:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Felix Kuehling X-Patchwork-Id: 10939443 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 5BE6514DB for ; Fri, 10 May 2019 19:53:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4AF6628BA7 for ; Fri, 10 May 2019 19:53:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F73128C9B; Fri, 10 May 2019 19:53:31 +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=-1.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_WEB autolearn=no version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD7E228C9D for ; Fri, 10 May 2019 19:53:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6763B6B0006; Fri, 10 May 2019 15:53:27 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5FD116B0007; Fri, 10 May 2019 15:53:27 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 401226B0008; Fri, 10 May 2019 15:53:27 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by kanga.kvack.org (Postfix) with ESMTP id 1F3C06B0006 for ; Fri, 10 May 2019 15:53:27 -0400 (EDT) Received: by mail-qk1-f198.google.com with SMTP id g7so6519927qkb.7 for ; Fri, 10 May 2019 12:53:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:thread-topic :thread-index:date:message-id:references:in-reply-to:accept-language :content-language:content-transfer-encoding:mime-version; bh=r68dEYCklCFsZVBUW4IcTm6GYQl0JWxtn6eHLJELlhk=; b=F6CK377Dce27ZhuXKcyTWb/FJPB89uG4pdKuwmJyG5rV4TX5h1cqSw/SQbI9V4sX/g zi8h/rOQ0S8qj/ATPeSyRxVN4Yxf4BeDAc/UpDBnmmFUotQCrY6mVuhDfk2sjr+ut8JQ dp7tuW0Dh305kpTWNFk01ak3+PFLDNYXRctL1u4FEF02E8qnanYNdua1h3VndRsJrth6 UGMNYw24Qe42F7mWn3KNBx3jD5EmF6caM4BPJnD+tAUz3R4gGufhQDwsKh7qFe7tr/4k h+HFa7pMsT/XeAlmh4fgDA0EDgVCvwBwi2vA4zO9RTFZ0uKRc+1ksb4tgxpGtMCd0r4q CiRA== X-Gm-Message-State: APjAAAX5wH+R0IyeidEprqgRzpuKQ9GgBO1a/3VasPikB6LNNTM4Rw2U SiDedZnHlDqVnkk5VSeTNEuTK6EH7elxn68QjrPaJIQPtolf9tQBKNCqAYIJQssU8cKkjix/OtK ZWSpOVQjKd0g8GzSg8oVf/dPG0SoMJb0+4CFwjYfMWFGXoAdoAAprT370JnZjDac= X-Received: by 2002:a37:8bc7:: with SMTP id n190mr10452759qkd.108.1557518006836; Fri, 10 May 2019 12:53:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXnd0Tnz7oB0FIM35W9bzTrKjZNdcMJjtXr9+C11BcwlwQ6DffojZwVoNfcVKfNAIh7X5l X-Received: by 2002:a37:8bc7:: with SMTP id n190mr10452705qkd.108.1557518006014; Fri, 10 May 2019 12:53:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557518006; cv=none; d=google.com; s=arc-20160816; b=B1US887AoBakEonqFPsG0vGt7fES16wCKgq+wj/VsejuKSqVyciiEiHFPxT8WQEt9B u14vPofYCfPZQ1NtISbDbROvhpn25BAUyIAORYCavjxN2jsev8LRjCw6YYzqgFFJVdiZ Dk8oYlIPphZtpB4zczB673211Y+pN1LeHL5jmPcb1KPe+dWi2YV3D9siuBIwC/+Ltvvd EqQKWaTooFQHOHFTFQXx2YJmNnajuqM4wxSKOjRiRVdLf02EOCyBNbJr5L0W5mgUP0xx qgBkVoiPB/VP+KQqamdcTrJMpmloTEOQNEt4UoMLSdJ3Iu1uYJBLM9hJXhLOACGB1+C1 lECg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:content-transfer-encoding:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=r68dEYCklCFsZVBUW4IcTm6GYQl0JWxtn6eHLJELlhk=; b=En6EjsaLHKqUY6Qg/u6V5mBMPXolAZTgk+TS9Z+ZR6f1jGRkbLzOFchxY/KtiQmLZB 9fbvspcRQkUU6HZyKg1jfy5iNeCFV24SoI+QPl23Z+i98uPrGizfD6cplZR980Wp3duc 3Gcaaj8yeJIWpMl91nMW4Y/eddOj0a+X5KpMDdoFNo1g6wnmq37uxZohqxp82t3funWT Y6/6rurh73gJ6W+EJxkCjyFRnSHP5VPTSpiHitxX8Zr9dtUS3/ylunvmnmUesyiyJv9k U1ZzLxwnJ/rraGB20VkQUp4ZB8fnUB8bAOWcarqa7w37hzOLs+5ZfPdw1fXPyzwWPVzY Qrvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=t1Ik0Emj; spf=neutral (google.com: 40.107.68.55 is neither permitted nor denied by best guess record for domain of felix.kuehling@amd.com) smtp.mailfrom=Felix.Kuehling@amd.com Received: from NAM04-BN3-obe.outbound.protection.outlook.com (mail-eopbgr680055.outbound.protection.outlook.com. [40.107.68.55]) by mx.google.com with ESMTPS id d13si1447206qtb.405.2019.05.10.12.53.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 May 2019 12:53:26 -0700 (PDT) Received-SPF: neutral (google.com: 40.107.68.55 is neither permitted nor denied by best guess record for domain of felix.kuehling@amd.com) client-ip=40.107.68.55; Authentication-Results: mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=t1Ik0Emj; spf=neutral (google.com: 40.107.68.55 is neither permitted nor denied by best guess record for domain of felix.kuehling@amd.com) smtp.mailfrom=Felix.Kuehling@amd.com 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=r68dEYCklCFsZVBUW4IcTm6GYQl0JWxtn6eHLJELlhk=; b=t1Ik0EmjrTAmXwn1tFrtBpXamK9ghiEQtvc3CvB3OUk+oFeW8Z4GtAt5wTAHW2NBWKuq36LEzUb8PjrwxMltovb/5DiiG6chGG6SzC4uchONNehmrVIP9CwQdw8HF5sU7p46uBvgKboRz0quHaAzwLHc5+KcxHYrHngtQYPtBR4= 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:24 +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:24 +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" CC: "Kuehling, Felix" Subject: [PATCH 2/2] mm/hmm: Only set FAULT_FLAG_ALLOW_RETRY for non-blocking Thread-Topic: [PATCH 2/2] mm/hmm: Only set FAULT_FLAG_ALLOW_RETRY for non-blocking Thread-Index: AQHVB2oH3gumKK8uVkW/G1cJvzIbZg== Date: Fri, 10 May 2019 19:53:24 +0000 Message-ID: <20190510195258.9930-3-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) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Felix.Kuehling@amd.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0bb65e5e-6543-480a-32a4-08d6d5812935 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:1360; 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: rn/Ggjr1Nl/zRrTCRjOLymvE6YXZ1ceesRFPMg0pssZdDd7x2nsdvBY2xsJ3ZOvtNqnGWAw8l7NQ+n5lnJKDJ55ND1g+hRNTEGKb78y366B8p1HVRZ1MhjxLTMDvIsmIVO5IQtkX3avdH3Cw7QzcrUr5F5iYmNm0auaT6Fw5oVUGoOcluvaaqgyuIDiFmnPFpJKeIezp/9UVUv57G5FYf40FcpLur6sF7qUWNToXFGFaPsoV9JIdtIDWIX3SVV053p1J0fbxsT1CwIojY1gJo5mM0k+bkxx7t3oH31Uv6cD9FaTMKUXhFV3LgYXXxVFJbj0ZFLPSs/nNnpOMMd5GfhRTxbf2voNvzq2165Rj/E0yEGwAcLWKR3BY3Ps6nZ0dP0vKZbwaTzsrx1baAmwGYUX1mDfFUVJjrYNyuAce7HE= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0bb65e5e-6543-480a-32a4-08d6d5812935 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 May 2019 19:53:24.3777 (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-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: X-Virus-Scanned: ClamAV using ClamSMTP Don't set this flag by default in hmm_vma_do_fault. It is set conditionally just a few lines below. Setting it unconditionally can lead to handle_mm_fault doing a non-blocking fault, returning -EBUSY and unlocking mmap_sem unexpectedly. Signed-off-by: Felix Kuehling 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 b65c27d5c119..3c4f1d62202f 100644 --- a/mm/hmm.c +++ b/mm/hmm.c @@ -339,7 +339,7 @@ struct hmm_vma_walk { static int hmm_vma_do_fault(struct mm_walk *walk, unsigned long addr, bool write_fault, uint64_t *pfn) { - unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_REMOTE; + unsigned int flags = FAULT_FLAG_REMOTE; struct hmm_vma_walk *hmm_vma_walk = walk->private; struct hmm_range *range = hmm_vma_walk->range; struct vm_area_struct *vma = walk->vma;