Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1504833rdb; Mon, 19 Feb 2024 19:48:58 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXMO4iYIoSgzPPzRLnqB+toJzMyEk2Xc4xLp0J/+ZN8cQ6RvE6/QtJ8jYutvF+F1y3h81K+HCSGxzvBnTpMsblL6ANDVHJpkYY92wY7LA== X-Google-Smtp-Source: AGHT+IFsWH0GhuF6qGmoZ2JKeVM623ngAoOyYX/7zun5beCXWqNlSYET/QWWoRV7iGqbUnld5g61 X-Received: by 2002:a05:6402:214a:b0:563:bd95:4ef8 with SMTP id bq10-20020a056402214a00b00563bd954ef8mr9434380edb.23.1708400937857; Mon, 19 Feb 2024 19:48:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708400937; cv=pass; d=google.com; s=arc-20160816; b=lMiJGckvLSpkXs0Uw85G3ocHjINu2LNvCSLEkmdhtXlELLcRGBina/KoU7fHWKd+/T Doha9yjjmQAxQOW5582zBgnwbuyvFITJrQPeGn/Sy59k0JWE4Fk/phGVpay2EGFOK/dL v40EY0uvSWXXgLmw/AaRxIumDBchvBmx1Ie8AbL4Rpn8s4Ha0CK6iUakpsEZoUSlPgci TMNsIWP2Z5/wYLnIEx0wdhZOA2fbuV5lbcqr6aEBZuvj4P4cXvIAJrwPYVpELYmq4aiU t4mWEXwpUYM5JRWqVJv2zNzU1rH+LqYCLhnbirld+93QspapNE4ImsV5kbZed1xcPFWy +yaQ== ARC-Message-Signature: i=2; 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=UBMm2ylMBBUFwI9+Hbt/7fHj5CXw3f0ET8LE1lr09gM=; fh=zpgpHhi7NFRm0UrQnwLzLdFqTpbxRncqQ6HhcVWeB8c=; b=WutO/PQFTqDt/4adkKnPSASQXv8HFhZP+MRaD4Vka0FXeYyNcMGjgCSYjGWAkmVfj0 nhaETTk9lAo/62vb7WjuEVoEIITc4e8jj7PssmZdNFiniVrBzJ3dynZ0Ae0Aq6THv6NI 25gHh561otG11jhmSVZ2kEYDP4+T9bzv54ZKYR4Mz6CxIVCR0R+2TfE/H8XBMnHLCwp2 zs83Dz30lgHDPj2cAh2IjK3f6poqAVyeEx6E5X7cD5RRDbKqi7hyTUOHtmf6VO4fZeC3 bzvt6HiAGIQYxIAI6ja2kRDxzQqj/aDsJRt/rNwY7jEGO+yKh2ecFI6jpF/Hqkyx37w4 502A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-72286-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72286-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id z63-20020a509e45000000b005645c7dc5c9si1881534ede.364.2024.02.19.19.48.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 19:48:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72286-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-72286-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72286-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 9D03A1F226A5 for ; Tue, 20 Feb 2024 03:48:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C06453E3B; Tue, 20 Feb 2024 03:48:46 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (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 41AA247A4C for ; Tue, 20 Feb 2024 03:48:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708400926; cv=none; b=h/58vaSPM2kRei1xqkKb+iZzbYRXsT3mWk9guyi/sN+JeUBevyCtG3ENdQ7RyFy5bIBvFj5dr/MVIbIE6v8dqKlor0sLu8pR4/IcfHYJhTYiIehRupbFWthrpYYiFUNUTdcrSso0HHW+ilz3I/QybBdnRlNq9ESid+DvMTDisgc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708400926; c=relaxed/simple; bh=Z6elAPMbAM6XrnscquSpysia9b+peWJJ+5rOVH2M9ds=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Y2Vr7OWMf7P73mKSKAoU9Kz3tjc9KQK+NMCFXB79p0zviYVU05y3lI7oAME+JpdPKHo9A5ECf90VUMNw6Ba/tWSfMeEQFshRwsP1zEOMNVuVYX8iF+OYn/+8boEdbAkOyW6hPNR93reSH9mlTwf2dCxTXb0UfuxHhCKPDj9x6Ks= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 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.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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemd200001.china.huawei.com (7.185.36.224) 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; } -- 2.25.1