From patchwork Thu Jan 11 12:09:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: mawupeng X-Patchwork-Id: 187356 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp1400193dyi; Thu, 11 Jan 2024 04:11:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IErJj2jf3/SNwrxapMj3sc2k2PHviECVm5heYYvmFabDtWRQua5HPCcFn/OzicK5u6wGWyX X-Received: by 2002:a05:6358:2808:b0:173:fb40:2679 with SMTP id k8-20020a056358280800b00173fb402679mr1249621rwb.54.1704975069283; Thu, 11 Jan 2024 04:11:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704975069; cv=none; d=google.com; s=arc-20160816; b=X4rMHq6B74PMpmN4e1EAqZ9mT3rAt6E2wAqETQKs/KYCRIMcs4MAA5oOtghjkp3L9G ylYnISLX0iHTLq2xD8Ibx7tC7cwREgy5q/6twM+uT9K5ssZgfzEDVnqeoIJPufWtiWC5 oj2N6DHFKKrPX7OIeJYt4zceSHFIf/LctJoHcIlgK+t0BAhNzUaKxgglldF4vycDDGsF YcQPQ/iWOamHqUtblUBFirAirz8hm7q3GMB/4CS8beUN4V3qzqzPF/xNDHabDn2c3Njm lbso1JZxGGeMhqeI6k4p5fyGdEreSwklUqq4maH0t8MRsySS1FaVQ3DFLlvDjXUPpcxW wYGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=UO3kcs2EuDWBvakbB9Uce1w5hDcFQAkNwfCYmJDcv1Q=; fh=VDFt/Ez8CwS+3hxzG1nckgKJ9OcfII+UembkYqexFFw=; b=cTmAhycYcKdbgEN5B2fYpiS3MhFnzAPcBFlwJfZX1A7SEZ2hTrep36L+Fd2Ct+5Cj8 6R4P7SP6UccS+cykFRBIVQEpbtUYsk38Q6OF7kaC6aaN4MWsSrn3uELlhM9v3MZHpxmr ZUO6RTiJ9Fe9mMAX9kemAcgkDsiC1wwqVxsiENqL17xui4Ew17X6DUCR2nSaaaBZcL0F CWWDPddHwf6tExEV3xd6TLEajsXBUaYYkoyNAsxceJeg0XaFkGbntir8BUpGWt0zEEcB JrF4Z/G96D1VmMFwbUAM3ak5hf7iQi0p2LuBp0N/RQd0NvBZtnMLOxwyKJKloNYyNpOJ QWzw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-23564-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23564-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id eb15-20020a056a004c8f00b006d9ac97be1fsi916602pfb.286.2024.01.11.04.11.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 04:11:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23564-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-23564-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23564-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8C40128511D for ; Thu, 11 Jan 2024 12:11:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 36ABE1643D; Thu, 11 Jan 2024 12:09:45 +0000 (UTC) Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4987216402 for ; Thu, 11 Jan 2024 12:09:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4T9k2T2cGgz1Q8Bs; Thu, 11 Jan 2024 20:08:01 +0800 (CST) Received: from dggpemd200001.china.huawei.com (unknown [7.185.36.224]) by mail.maildlp.com (Postfix) with ESMTPS id 9534A1A0172; Thu, 11 Jan 2024 20:09:34 +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; Thu, 11 Jan 2024 20:09:34 +0800 From: Wupeng Ma To: , , , , CC: , , , , Subject: [PATCH v3 3/3] x86/mm/pat: Remove WARN_ON_ONCE if follow_phys fails Date: Thu, 11 Jan 2024 20:09:29 +0800 Message-ID: <20240111120929.2694440-4-mawupeng1@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240111120929.2694440-1-mawupeng1@huawei.com> References: <20240111120929.2694440-1-mawupeng1@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemd200001.china.huawei.com (7.185.36.224) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787795938355607316 X-GMAIL-MSGID: 1787795938355607316 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 94bcba399701..2fd37c2b29d6 100644 --- a/arch/x86/mm/pat/memtype.c +++ b/arch/x86/mm/pat/memtype.c @@ -994,10 +994,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); } @@ -1081,10 +1080,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; }