From patchwork Tue Feb 20 03:48:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: mawupeng X-Patchwork-Id: 13563361 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13F4EC48BC4 for ; Tue, 20 Feb 2024 03:48:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DF7716B007B; Mon, 19 Feb 2024 22:48:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DA5D46B0088; Mon, 19 Feb 2024 22:48:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C0B836B007B; Mon, 19 Feb 2024 22:48:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id A21D16B007B for ; Mon, 19 Feb 2024 22:48:47 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 792481A051D for ; Tue, 20 Feb 2024 03:48:47 +0000 (UTC) X-FDA: 81810800694.15.B249788 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf14.hostedemail.com (Postfix) with ESMTP id 727FB100005 for ; Tue, 20 Feb 2024 03:48:45 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of mawupeng1@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=mawupeng1@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708400925; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UBMm2ylMBBUFwI9+Hbt/7fHj5CXw3f0ET8LE1lr09gM=; b=UZpEF8DCIam84Z2uxfDzW1i/wKZs24dbbdWFxBsd9VxJu1mFa+ur03Fe9YPWQ0+KHVAHpU zTctx8VZ5rFhRyHWwdRfzsm81npj/i9rPKv+/eKQ5NQz15+c36rls38x7UQ96Cj48ckapN lfKEGT34wlqq1K9d86F4coB+NIBiswg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708400925; a=rsa-sha256; cv=none; b=tFkyn8u8rd6HLISGbT1fdea3b4d1C4lWDD+goX1FzGVFDJ4gYRv7j/aTA6xmKlzjZ7cUWI 4Ybuf8JR9bjJmwOLk2stFrqetDyXeSTz5Rpah0wtKj+eO8/R+X6F/fWmLarGNgl+a+eJ8x R4Y+EEbFo+7sV8yjXgsECno4/h1n68A= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of mawupeng1@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=mawupeng1@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Tf52J35Gtz1xnMy; Tue, 20 Feb 2024 11:47:20 +0800 (CST) Received: from dggpemd200001.china.huawei.com (unknown [7.185.36.224]) by mail.maildlp.com (Postfix) with ESMTPS id A29B0140120; Tue, 20 Feb 2024 11:48:41 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemd200001.china.huawei.com (7.185.36.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1258.28; Tue, 20 Feb 2024 11:48:40 +0800 From: Wupeng Ma To: , , , , , CC: , , , , , , , Subject: [PATCH v4 3/3] x86/mm/pat: Remove WARN_ON_ONCE if follow_phys fails Date: Tue, 20 Feb 2024 11:48:35 +0800 Message-ID: <20240220034835.507022-4-mawupeng1@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240220034835.507022-1-mawupeng1@huawei.com> References: <20240220034835.507022-1-mawupeng1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemd200001.china.huawei.com (7.185.36.224) X-Rspamd-Queue-Id: 727FB100005 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 9ytiejbuspsc4rwdfyjqrjigdxsipwpp X-HE-Tag: 1708400925-946771 X-HE-Meta: U2FsdGVkX1+YKulXnQnQHO+Br6kRvz7oih2NCoXI9iKS0cNtwC7QBGeaHjL9vrLUuLyD/C0Ge+aAcak7NIrR9haGZQc3Ands3Z52wCitwhSEPWkrh9VfLHdfPVsktmlDj2qMi/5F705QSy09Ml39JsB4akhJcaQ7ir7QKXN6jVQiLzDv9zxYN4yTUtf0U+DgNNsH9mtaMHNgV5NFSjg/lQwAqKguRY7Fx+yRt3efWldexJNPkqvTbiJeESgTm4J8dg+65yHuMje4+Ay/y7PvsB6wyatMIIHR+Q7RCqCD7IZHJ6fCkta7NXXJsMUlDBdn/XyyszF/Ru1HNq538dSs1HqaI4tsxyKmTjdqkIha5Pn/zAghgFNa275ddjWGq83x0kEiXnAqXdOu2kubXtZkYQYNMBu0d1YLxk1ooyA32oY8FVVaO2wF15UZmA2W6ubFEt3dCEEYQZjFEgZD3JM1IbRQ5wQgIuID2pQ7Zsn8Bb+ByXxtlDYI7fEa6oYKYwAxrxJpqqd4Pehv4EDX1dO4uaKl/Aq1R/VZ3ZltwaBD7gyZy4fFuJ27elePw6S0v06R5Wf28bwimOoHbLShUTD+9HMb3yYAKjQk6/GHoWlp0yCzJ6XWE716nSakZ81jMvmO/2QuB4vapzAFa1BYFlWxmv3lIX2NabL5xv4u7PrJQoS57UCpwW4uR8SD95HC5vUFdw/V8qoeMf45zToJJt9zv/shOhHfXkWDD75wDHsZyEyHhr8c40N7okWzD2aSFS8/KdG+TUslI5UgRVO69EzR6xFWSm7FCpWKs/IEtzZ6wxvdrWevOPtdziP66USxh1fV21D6tUw4zYVSiBhk/zDodPjbDgXRYL7jpKuBjxfum5E01/xIxEDfAZFG9FTv5PS1+ztf4GhGe37hascALHZWhQ== 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: List-Subscribe: List-Unsubscribe: From: Ma Wupeng Since there is no obvious reason to keep this WARN_ON_ONCE if follow_phys fails in track_pfn_copy/untrack_pfn, Drop it. Signed-off-by: Ma Wupeng --- arch/x86/mm/pat/memtype.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c index 5b56f08f8ce6..5b3a7a2b21e3 100644 --- a/arch/x86/mm/pat/memtype.c +++ b/arch/x86/mm/pat/memtype.c @@ -992,10 +992,9 @@ int track_pfn_copy(struct vm_area_struct *vma) * reserve the whole chunk covered by vma. We need the * starting address and protection from pte. */ - if (follow_phys(vma, vma->vm_start, &prot, &paddr)) { - WARN_ON_ONCE(1); + if (follow_phys(vma, vma->vm_start, &prot, &paddr)) return -EINVAL; - } + pgprot = __pgprot(prot); return reserve_pfn_range(paddr, vma_size, &pgprot, 1); } @@ -1079,10 +1078,8 @@ void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn, /* free the chunk starting from pfn or the whole chunk */ paddr = (resource_size_t)pfn << PAGE_SHIFT; if (!paddr && !size) { - if (follow_phys(vma, vma->vm_start, &prot, &paddr)) { - WARN_ON_ONCE(1); + if (follow_phys(vma, vma->vm_start, &prot, &paddr)) return; - } size = vma->vm_end - vma->vm_start; }